namespace PartnerDAL.DTO.PartnerApiKey
{
public class PartnerApiKeyDTO
{
public int ApiKeyId { get; set; }
public int PartnerProductId { get; set; }
/// Resolved once at save time from the tenant DB's TPARTNERPRODUCT (see
/// PartnerApiKeyDAL.SavePartnerApiKey) and stored denormalized on this row — leave
/// null/0 to have it resolved automatically from PartnerProductId.
public int? PartnerId { get; set; }
public string KeyName { get; set; } = "";
public string HashedKey { get; set; } = "";
public string KeyHint { get; set; } = "";
public string? Scopes { get; set; }
public int RateLimitPerMinute { get; set; }
public DateTime? ExpiresOn { get; set; }
public DateTime? LastUsedUtc { get; set; }
public int Status { get; set; } = 1;
public short Version { get; set; }
public short SortOrder { get; set; } = 9999;
public byte SourceType { get; set; } = 1;
public int CreatedById { get; set; }
public DateTime CreatedOn { get; set; } = DateTime.UtcNow;
public int ModifiedById { get; set; }
public DateTime ModifiedOn { get; set; } = DateTime.UtcNow;
}
// Read-only view returned by GetPartnerApiKeyList — never exposes HashedKey
public class PartnerApiKeyListDTO
{
public int ApiKeyId { get; set; }
public int PartnerProductId { get; set; }
/// Denormalized directly onto TPARTNERAPIKEY (see PartnerApiKeyDTO.PartnerId) —
/// always populated now, not just on the hash lookup.
public int? PartnerId { get; set; }
public string KeyName { get; set; } = "";
public string KeyHint { get; set; } = "";
public string? Scopes { get; set; }
public int RateLimitPerMinute { get; set; }
public DateTime? ExpiresOn { get; set; }
public DateTime? LastUsedUtc { get; set; }
public int Status { get; set; }
public DateTime CreatedOn { get; set; }
}
}