using IamService.Domain.SeedWork;

namespace IamService.Domain.AggregatesModel.PrivilegedAccessAggregate;

/// <summary>
/// EN: Privileged access status enumeration.
/// VI: Enumeration trạng thái truy cập đặc quyền.
/// </summary>
public class PrivilegedAccessStatus : Enumeration
{
    public static readonly PrivilegedAccessStatus Pending = new(1, nameof(Pending));
    public static readonly PrivilegedAccessStatus Active = new(2, nameof(Active));
    public static readonly PrivilegedAccessStatus Expired = new(3, nameof(Expired));
    public static readonly PrivilegedAccessStatus Revoked = new(4, nameof(Revoked));

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

    public static PrivilegedAccessStatus? FromId(int id) => id switch
    {
        1 => Pending,
        2 => Active,
        3 => Expired,
        4 => Revoked,
        _ => null
    };

    public bool IsTerminal => this == Expired || this == Revoked;
}
