namespace ZB.MOM.WW.Secrets.Abstractions;
///
/// The encrypted, at-rest representation of a secret — one database row. This type
/// never holds plaintext: the secret material lives only in ,
/// sealed under AES-256-GCM with a per-secret data-encryption key (DEK) that is itself
/// wrapped by the key-encryption key (KEK) identified by .
///
public record StoredSecret
{
/// The normalized secret name (primary identity).
public required SecretName Name { get; init; }
/// Optional human-readable description shown in management surfaces.
public string? Description { get; init; }
/// How the decrypted plaintext should be interpreted.
public required SecretContentType ContentType { get; init; }
/// The AES-256-GCM ciphertext of the secret plaintext.
public required byte[] Ciphertext { get; init; }
/// The AES-256-GCM nonce used to seal .
public required byte[] Nonce { get; init; }
/// The AES-256-GCM authentication tag for .
public required byte[] Tag { get; init; }
/// The per-secret data-encryption key (DEK), wrapped by the KEK.
public required byte[] WrappedDek { get; init; }
/// The AES-256-GCM nonce used to wrap .
public required byte[] WrapNonce { get; init; }
/// The AES-256-GCM authentication tag for .
public required byte[] WrapTag { get; init; }
/// Identifier of the key-encryption key (KEK) that wrapped the DEK.
public required string KekId { get; init; }
/// Monotonic revision number, incremented on each update.
public required long Revision { get; init; }
/// Whether the secret is soft-deleted (tombstoned).
public bool IsDeleted { get; init; }
/// When the secret was soft-deleted, if it is deleted; otherwise null.
public DateTimeOffset? DeletedUtc { get; init; }
/// When the secret was first created (UTC).
public required DateTimeOffset CreatedUtc { get; init; }
/// When the secret was last updated (UTC).
public required DateTimeOffset UpdatedUtc { get; init; }
/// Principal that created the secret, if known.
public string? CreatedBy { get; init; }
/// Principal that last updated the secret, if known.
public string? UpdatedBy { get; init; }
}