using SolutionErp.Domain.Common;

namespace SolutionErp.Domain.PurchaseEvaluations;

// 2-stage department approval cho PE workflow (Phase 9 — Migration 16).
// Mirror schema ContractDepartmentApproval — pattern thống nhất cho cả 3
// module (HĐ / PE / Budget).
//
// LƯU Ý: KHÁC `PurchaseEvaluationDepartmentOpinion` (Migration 15) — Opinion
// là sign-off block "Ý kiến 4 phòng ban" (Phê duyệt/CCM/MuaHàng/SM-PM) trên
// header phiếu. DepartmentApproval là 2-stage approval per phase trong
// workflow chính.
public class PurchaseEvaluationDepartmentApproval : AuditableEntity
{
    public Guid PurchaseEvaluationId { get; set; }
    public int PhaseAtApproval { get; set; }              // snapshot PurchaseEvaluationPhase int
    public Guid DepartmentId { get; set; }
    public ApprovalStage Stage { get; set; }               // 1=Review (NV), 2=Confirm (TPB) — legacy 2-stage Mig 16
    public Guid ApproverUserId { get; set; }
    public string? ApproverRoleSnapshot { get; set; }
    public string? Comment { get; set; }
    public DateTime ApprovedAt { get; set; }
    public bool IsBypassed { get; set; }

    public PurchaseEvaluation? PurchaseEvaluation { get; set; }
}
