using SolutionErp.Domain.Common;

namespace SolutionErp.Domain.Office;

// Phase 10.3 G-O4 (Mig 39 — S38 2026-05-28) — Đơn xin nghỉ phép.
// Workflow V2 dynamic ApplicableType=LeaveRequest=5 (Mig 37 enum extend).
// Skeleton Phase 1: status flat WorkflowAppStatus + ApproveV2 wire DEFER Phase 11.
// LeaveBalance calculation business logic DEFER Phase 11.
public class LeaveRequest : AuditableEntity
{
    public string? MaDonTu { get; set; }                  // "DT/LR/2026/001"
    public Guid RequesterUserId { get; set; }
    public string RequesterFullName { get; set; } = string.Empty;  // denorm
    public Guid LeaveTypeId { get; set; }                 // FK Hrm_LeaveType (Mig 35)
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public decimal NumDays { get; set; }                  // computed client-side or BE
    public string Reason { get; set; } = string.Empty;
    public WorkflowAppStatus Status { get; set; } = WorkflowAppStatus.Nhap;
    public Guid? ApprovalWorkflowId { get; set; }         // pin ApplicableType=5
    public int? CurrentApprovalLevelOrder { get; set; }

    public WorkflowAppStatus? RejectedFromStatus { get; set; }   // smart return tracking (mirror Proposal)
    public List<LeaveRequestLevelOpinion> LevelOpinions { get; set; } = new();
}
