namespace CMSDAL.DTO.DataSource; // AuthMode values — kept as a plain byte (not a C# enum) to match the DB TINYINT column and // every other CMS status-style field in this module (ContentStatus, NavigationLinkType, etc.). public static class DataSourceAuthMode { public const byte None = 0; public const byte ApiKey = 1; public const byte Bearer = 2; public const byte Basic = 3; } public class DataSourceDTO { public int DataSourceId { get; set; } public string DataSourceCode { get; set; } = string.Empty; public string DataSourceName { get; set; } = string.Empty; public string? DataSourceDescription { get; set; } // e.g. "https://api.example.com/stats/{region}" — {placeholder} tokens are filled in from // TCMSBLOCKDATABINDING.ParamsJson at resolve time (see DataSourceProxyBLL). public string EndpointTemplate { get; set; } = string.Empty; public string HttpMethod { get; set; } = "GET"; public byte AuthMode { get; set; } // Only meaningful for AuthMode.ApiKey — the header name the secret value is sent under // (e.g. "X-Api-Key"). Bearer always uses "Authorization: Bearer {secret}". public string? AuthHeaderName { get; set; } // Path into Vault's KV store holding the actual secret — never the secret itself. Null when // AuthMode is None. public string? VaultSecretPath { get; set; } public int CacheTtlSeconds { get; set; } = 300; // {"targetPropKey": "$.path.in.response", ...} — a flat map of block-prop keys to a // Newtonsoft JObject.SelectToken path into the raw response body. Applied by // DataSourceProxyBLL to build the patch object merged into the block's PropsJson. public string? ResponseMappingJson { get; set; } public byte Status { get; set; } public int TenantId { get; set; } public int CreatedById { get; set; } public System.DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public System.DateTime ModifiedOn { get; set; } }