using IamService.Domain.SeedWork;

namespace IamService.Domain.AggregatesModel.VerificationAggregate;

/// <summary>
/// EN: Verification status enumeration.
/// VI: Enumeration trạng thái xác thực.
/// </summary>
public class VerificationStatus : Enumeration
{
    /// <summary>
    /// EN: Verification is pending (awaiting user action).
    /// VI: Xác thực đang chờ (đợi user hành động).
    /// </summary>
    public static readonly VerificationStatus Pending = new(1, nameof(Pending));

    /// <summary>
    /// EN: Verification is in progress (e.g., document under review).
    /// VI: Xác thực đang xử lý (ví dụ: tài liệu đang được xem xét).
    /// </summary>
    public static readonly VerificationStatus InProgress = new(2, nameof(InProgress));

    /// <summary>
    /// EN: Verification completed successfully.
    /// VI: Xác thực hoàn thành thành công.
    /// </summary>
    public static readonly VerificationStatus Verified = new(3, nameof(Verified));

    /// <summary>
    /// EN: Verification was rejected.
    /// VI: Xác thực bị từ chối.
    /// </summary>
    public static readonly VerificationStatus Rejected = new(4, nameof(Rejected));

    /// <summary>
    /// EN: Verification expired.
    /// VI: Xác thực đã hết hạn.
    /// </summary>
    public static readonly VerificationStatus Expired = new(5, nameof(Expired));

    /// <summary>
    /// EN: Verification was cancelled.
    /// VI: Xác thực đã bị hủy.
    /// </summary>
    public static readonly VerificationStatus Cancelled = new(6, nameof(Cancelled));

    public VerificationStatus(int id, string name) : base(id, name)
    {
    }

    /// <summary>
    /// EN: Get all verification statuses.
    /// VI: Lấy tất cả trạng thái xác thực.
    /// </summary>
    public static IEnumerable<VerificationStatus> GetAll() =>
    [
        Pending,
        InProgress,
        Verified,
        Rejected,
        Expired,
        Cancelled
    ];

    /// <summary>
    /// EN: Check if this status is a final status.
    /// VI: Kiểm tra trạng thái này có phải là trạng thái cuối cùng không.
    /// </summary>
    public bool IsFinal => this == Verified || this == Rejected || this == Expired || this == Cancelled;
}
