namespace SwDAL.DTO.ClientDatabaseKey;
/// Registers the public key an on-prem/BYOC client database has provided for encrypted,
/// disconnected DDL/DML delivery (Offline Rollout Package). Rotatable, not overwritable — old
/// keys are Superseded/Revoked, never deleted, mirroring MSWUPGRADEPACKAGE's own
/// append-and-supersede convention rather than a single mutable "the" key column.
public class ClientDatabaseKeyDTO
{
public int ClientDatabaseKeyId { get; set; }
public int ClientDbId { get; set; }
public string PublicKeyPem { get; set; } = string.Empty;
/// 0=Active 1=Superseded 2=Revoked. Exactly one Active row per ClientDbId at a
/// time — enforced in ClientDatabaseKeyBLL.RegisterKeyAsync, not a DB constraint (same
/// posture as UpgradePackageBLL's "immutable once Released" guard).
public byte KeyStatus { get; set; }
public DateTime RegisteredOn { get; set; }
public DateTime? SupersededOn { get; set; }
// Standard M-table fields
public short Version { get; set; }
public byte Status { get; set; } = 1;
public short SortOrder { get; set; } = 9999;
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; } = 5;
public int TenantId { get; set; }
}