using SolutionErp.Domain.Common;
using SolutionErp.Domain.Contracts;   // reuse ChangelogAction enum

namespace SolutionErp.Domain.PurchaseEvaluations;

// Audit log unified cho mọi thay đổi trên phiếu — Header / Supplier / Detail
// / Quote / Workflow / Attachment. Populate tương tự ContractChangelog qua
// IPurchaseEvaluationChangelogService.
public class PurchaseEvaluationChangelog : BaseEntity
{
    public Guid PurchaseEvaluationId { get; set; }
    public PurchaseEvaluation? PurchaseEvaluation { get; set; }

    public PurchaseEvaluationEntityType EntityType { get; set; }
    public Guid? EntityId { get; set; }
    public ChangelogAction Action { get; set; }
    public PurchaseEvaluationPhase? PhaseAtChange { get; set; }
    public Guid? UserId { get; set; }
    public string? UserName { get; set; }
    public string? Summary { get; set; }
    public string? FieldChangesJson { get; set; }
    public string? ContextNote { get; set; }
}

public enum PurchaseEvaluationEntityType
{
    Header = 1,
    Supplier = 2,
    Detail = 3,
    Quote = 4,
    Workflow = 5,
    Attachment = 6,
}
