using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace MiAssessment.Admin.Business.Entities;
///
/// 订单表
///
[Table("orders")]
public class Order
{
///
/// 主键ID
///
[Key]
public long Id { get; set; }
///
/// 订单编号
///
[Required]
[MaxLength(32)]
public string OrderNo { get; set; } = null!;
///
/// 用户ID
///
public long UserId { get; set; }
///
/// 订单类型:1测评订单 2学业规划订单
///
public int OrderType { get; set; }
///
/// 商品ID
///
public long ProductId { get; set; }
///
/// 商品名称
///
[Required]
[MaxLength(100)]
public string ProductName { get; set; } = null!;
///
/// 订单金额
///
[Column(TypeName = "decimal(10,2)")]
public decimal Amount { get; set; }
///
/// 实付金额
///
[Column(TypeName = "decimal(10,2)")]
public decimal PayAmount { get; set; }
///
/// 支付方式:1微信支付 2邀请码
///
public int? PayType { get; set; }
///
/// 使用的邀请码ID
///
public long? InviteCodeId { get; set; }
///
/// 状态:1待支付 2已支付 3已完成 4退款中 5已退款 6已取消
///
public int Status { get; set; } = 1;
///
/// 支付时间
///
public DateTime? PayTime { get; set; }
///
/// 微信支付交易号
///
[MaxLength(64)]
public string? TransactionId { get; set; }
///
/// 退款时间
///
public DateTime? RefundTime { get; set; }
///
/// 退款金额
///
[Column(TypeName = "decimal(10,2)")]
public decimal? RefundAmount { get; set; }
///
/// 退款原因
///
[MaxLength(500)]
public string? RefundReason { get; set; }
///
/// 备注
///
[MaxLength(500)]
public string? Remark { get; set; }
///
/// 创建时间
///
public DateTime CreateTime { get; set; }
///
/// 更新时间
///
public DateTime UpdateTime { get; set; }
///
/// 软删除标记
///
public bool IsDeleted { get; set; }
///
/// 关联的用户
///
[ForeignKey(nameof(UserId))]
public virtual User? User { get; set; }
}