using System.Text.Json.Serialization; namespace JdeScoping.ConfigManager.Models; /// /// Root model for appsettings.json configuration. /// public class ConfigModel { /// /// Gets or sets the data synchronization configuration. /// public DataSyncSection DataSync { get; set; } = new(); /// /// Gets or sets the data access configuration. /// public DataAccessSection DataAccess { get; set; } = new(); /// /// Gets or sets the authentication configuration. /// public AuthSection Auth { get; set; } = new(); /// /// Gets or sets the LDAP directory configuration. /// public LdapSection Ldap { get; set; } = new(); /// /// Gets or sets the search processing configuration. /// public SearchSection Search { get; set; } = new(); /// /// Gets or sets the Excel export configuration. /// public ExcelExportSection ExcelExport { get; set; } = new(); /// /// Gets or sets the connection strings for external data sources. /// public ConnectionStringsSection ConnectionStrings { get; set; } = new(); /// /// Gets or sets the secure store configuration. /// public SecureStoreSection SecureStore { get; set; } = new(); /// /// Gets or sets the pipelines configuration. /// public PipelinesSection Pipelines { get; set; } = new(); } public class DataSyncSection { /// /// Gets or sets the interval between successive data sync checks. /// public TimeSpan CheckInterval { get; set; } = TimeSpan.FromMinutes(1); /// /// Gets or sets the maximum degree of parallelism for sync operations. /// public int MaxDegreeOfParallelism { get; set; } = 4; /// /// Gets or sets the batch size for data sync operations. /// public int BatchSize { get; set; } = 50000; /// /// Gets or sets the batch size for bulk copy operations. /// public int BulkCopyBatchSize { get; set; } = 5000; /// /// Gets or sets the lookback multiplier for data sync delta calculations. /// public double LookbackMultiplier { get; set; } = 1.5; /// /// Gets or sets the number of days to retain synced data before purging. /// public int PurgeRetentionDays { get; set; } = 90; /// /// Gets or sets the timeout in seconds for sync operations. /// public int SyncTimeoutSeconds { get; set; } = 3600; /// /// Gets or sets a value indicating whether data synchronization is enabled. /// public bool Enabled { get; set; } = true; } public class DataAccessSection { /// /// Gets or sets the default timeout in seconds for database queries. /// public int DefaultTimeoutSeconds { get; set; } = 30; /// /// Gets or sets the timeout in seconds for lot usage queries. /// public int LotUsageTimeoutSeconds { get; set; } = 120; /// /// Gets or sets the timeout in seconds for MIS data queries. /// public int MisDataTimeoutSeconds { get; set; } = 300; /// /// Gets or sets the schema name for production data. /// public string ProductionSchema { get; set; } = "prod"; /// /// Gets or sets the schema name for archive data. /// public string ArchiveSchema { get; set; } = "archive"; /// /// Gets or sets the schema name for staging data. /// public string StageSchema { get; set; } = "stage"; /// /// Gets or sets a value indicating whether detailed query logging is enabled. /// public bool EnableDetailedLogging { get; set; } = false; } public class AuthSection { /// /// Gets or sets the name of the authentication cookie. /// public string CookieName { get; set; } = ".JdeScoping.Auth"; /// /// Gets or sets the cookie expiration time in minutes. /// public int CookieExpirationMinutes { get; set; } = 480; } public class LdapSection { /// /// Gets or sets the LDAP server URLs to connect to. /// public string[] ServerUrls { get; set; } = []; /// /// Gets or sets the distinguished name of the LDAP group for authorization. /// public string GroupDn { get; set; } = string.Empty; /// /// Gets or sets the base distinguished name for LDAP searches. /// public string SearchBase { get; set; } = string.Empty; /// /// Gets or sets the connection timeout in seconds for LDAP operations. /// public int ConnectionTimeoutSeconds { get; set; } = 30; /// /// Gets or sets a value indicating whether to use fake authentication instead of LDAP. /// public bool UseFakeAuth { get; set; } = false; /// /// Gets or sets an array of user names that bypass group membership validation. /// public string[] AdminBypassUsers { get; set; } = []; } public class SearchSection { /// /// Gets or sets the maximum number of result rows returned by a search. /// public int MaxResultRows { get; set; } = 100000; /// /// Gets or sets the timeout in seconds for search operations. /// public int TimeoutSeconds { get; set; } = 300; /// /// Gets or sets the maximum number of concurrent search operations allowed. /// public int MaxConcurrentSearches { get; set; } = 5; } public class ExcelExportSection { /// /// Gets or sets the password for protecting the criteria worksheet. /// public string CriteriaSheetPassword { get; set; } = string.Empty; /// /// Gets or sets the password for protecting the data worksheet. /// public string DataSheetPassword { get; set; } = string.Empty; /// /// Gets or sets the maximum number of rows per Excel worksheet. /// public int MaxRowsPerSheet { get; set; } = 1000000; /// /// Gets or sets the default date format for Excel exports. /// public string DefaultDateFormat { get; set; } = "yyyy-MM-dd HH:mm:ss"; /// /// Gets or sets a value indicating whether to write debug output to files. /// public bool DebugWriteToFile { get; set; } = false; /// /// Gets or sets the directory path for debug output files. /// public string DebugOutputDirectory { get; set; } = string.Empty; /// /// Gets or sets the time zone identifier for date/time conversions. /// public string TimezoneId { get; set; } = "America/Chicago"; /// /// Gets or sets the time zone abbreviation for display purposes. /// public string TimezoneAbbreviation { get; set; } = "CT"; } /// /// Configuration section for the secure store. /// public class SecureStoreSection { /// /// Gets or sets the path to the secure store file. /// public string StorePath { get; set; } = "data/secrets.json"; /// /// Gets or sets the path to the key file for encryption/decryption. /// public string KeyFilePath { get; set; } = "data/secrets.key"; /// /// Gets or sets a value indicating whether to auto-create the store if it doesn't exist. /// public bool AutoCreateStore { get; set; } = true; /// /// Gets or sets the list of required secret keys that must exist in the store. /// public List RequiredKeys { get; set; } = []; } /// /// Configuration section for pipelines. /// public class PipelinesSection { /// /// Gets or sets the directory containing pipeline.*.json files. /// public string ConfigDirectory { get; set; } = "Pipelines"; }