using MilitaryTrainingManagement.Models.Enums;

namespace MilitaryTrainingManagement.Models.Entities;

/// <summary>
/// 审批请求实体
/// </summary>
public class ApprovalRequest
{
    public int Id { get; set; }
    
    /// <summary>
    /// 审批请求类型
    /// </summary>
    public ApprovalRequestType Type { get; set; }
    
    /// <summary>
    /// 目标实体ID（配额分配ID、人员ID等）
    /// </summary>
    public int TargetEntityId { get; set; }
    
    /// <summary>
    /// 请求人用户ID
    /// </summary>
    public int RequestedByUserId { get; set; }
    
    /// <summary>
    /// 请求人用户
    /// </summary>
    public UserAccount RequestedByUser { get; set; } = null!;
    
    /// <summary>
    /// 请求人所属组织单位ID
    /// </summary>
    public int RequestedByUnitId { get; set; }
    
    /// <summary>
    /// 请求人所属组织单位
    /// </summary>
    public OrganizationalUnit RequestedByUnit { get; set; } = null!;
    
    /// <summary>
    /// 修改原因
    /// </summary>
    public string Reason { get; set; } = string.Empty;
    
    /// <summary>
    /// 原始数据（JSON格式）
    /// </summary>
    public string OriginalData { get; set; } = string.Empty;
    
    /// <summary>
    /// 请求的更改（JSON格式）
    /// </summary>
    public string RequestedChanges { get; set; } = string.Empty;
    
    /// <summary>
    /// 审批状态
    /// </summary>
    public ApprovalStatus Status { get; set; } = ApprovalStatus.Pending;
    
    /// <summary>
    /// 审批人用户ID
    /// </summary>
    public int? ReviewedByUserId { get; set; }
    
    /// <summary>
    /// 审批人用户
    /// </summary>
    public UserAccount? ReviewedByUser { get; set; }
    
    /// <summary>
    /// 审批意见
    /// </summary>
    public string? ReviewComments { get; set; }
    
    /// <summary>
    /// 请求时间
    /// </summary>
    public DateTime RequestedAt { get; set; } = DateTime.UtcNow;
    
    /// <summary>
    /// 审批时间
    /// </summary>
    public DateTime? ReviewedAt { get; set; }
}
