using EntitlementDAL.Enums; namespace EntitlementDAL.DTOs; // MENTITLEMENTBUNDLE — the signed, verifiable snapshot row. public class BundleDTO { public int BundleId { get; set; } public int ClientId { get; set; } public string BundleJson { get; set; } = string.Empty; public string Signature { get; set; } = string.Empty; // ECDSA P-256 base64 public string KeyId { get; set; } = string.Empty; public byte IsCurrent { get; set; } = 1; public DateTime IssuedOn { get; set; } public DateTime ValidUntil { get; set; } // audit tail public short Version { get; set; } public byte Status { get; set; } = 1; public int SortOrder { get; set; } public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } public byte SourceType { get; set; } public int TenantId { get; set; } = -1; } // ── Service-layer bundle payload shapes (not 1:1 table rows) ── public class BundleEntitlementItemDto { public string Feature { get; set; } = string.Empty; // FeatureCode public bool Enabled { get; set; } public string? Quota { get; set; } // raw FeatureValue JSON fragment, if any public int FeatureGroupId { get; set; } = -1; // MENTITLEMENTFEATURE.FEATUREGROUPID public BundleFlagStateEnum FlagState { get; set; } = BundleFlagStateEnum.Normal; } public class BundleLicenseItemDto { public string LicenseType { get; set; } = string.Empty; public int Seats { get; set; } public DateTime ExpiryDate { get; set; } } /// /// The resolved, unsigned entitlement snapshot for a client — the canonical payload shape /// that gets JSON-canonicalized and signed by IEntitlementBundleService.IssueSignedBundleAsync. /// public class EntitlementBundleDto { public int TenantId { get; set; } public List Subscriptions { get; set; } = new(); public List Entitlements { get; set; } = new(); public Dictionary Licenses { get; set; } = new(); public List BetaPrograms { get; set; } = new(); public DateTime ValidUntil { get; set; } public DateTime IssuedAt { get; set; } } /// The signed wire shape returned by IssueSignedBundleAsync / verified by VerifyBundle. public class SignedBundleDto { public EntitlementBundleDto Payload { get; set; } = new(); public string Kid { get; set; } = string.Empty; public string Sig { get; set; } = string.Empty; }