using SolutionErp.Domain.Common;

namespace SolutionErp.Domain.Office;

// Phase 10.3 G-O4 (Mig 39 — S38) — Đơn đăng ký làm thêm giờ (OT).
// Workflow V2 ApplicableType=OtRequest=6 (Mig 37 enum extend).
// Reference OtPolicy (Hrm Mig 35) cho multiplier weekday/weekend/holiday.
public class OtRequest : AuditableEntity
{
    public string? MaDonTu { get; set; }                  // "DT/OT/2026/001"
    public Guid RequesterUserId { get; set; }
    public string RequesterFullName { get; set; } = string.Empty;
    public DateTime OtDate { get; set; }
    public TimeSpan StartTime { get; set; }
    public TimeSpan EndTime { get; set; }
    public decimal Hours { get; set; }                    // computed (EndTime - StartTime)
    public string Reason { get; set; } = string.Empty;
    public Guid? OtPolicyId { get; set; }                 // FK Hrm_OtPolicy (Mig 35) optional
    public WorkflowAppStatus Status { get; set; } = WorkflowAppStatus.Nhap;
    public Guid? ApprovalWorkflowId { get; set; }
    public int? CurrentApprovalLevelOrder { get; set; }

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