namespace ApiRegistrationTool;
///
/// Bound from appsettings.json → "ToolConfig" section.
///
public sealed class ToolConfig
{
/// Root path of GB5Solution (tool scans all *SL/Endpoints under here).
public string SolutionRoot { get; set; } = @"C:\GB5\GB5Solution";
/// TenantId (ClientId) stamped on all inserted rows.
public int TenantId { get; set; } = -1;
/// UserId stamped on CREATEDBYID / MODIFIEDBYID.
public int UserId { get; set; } = -1;
/// When true, scan and report only — no DB writes.
public bool DryRun { get; set; } = false;
/// Progress print every N endpoints processed.
public int BatchSize { get; set; } = 50;
/// Path where the per-run CSV report is written.
public string ReportOutputPath { get; set; } =
@"C:\GB5\GB5Solution\Tools\ApiRegistrationTool\LastRunReport.csv";
/// If set, only scan these modules. Empty = all modules.
public List IncludeModules { get; set; } = new();
/// Always skip these modules even if found during scan.
public List ExcludeModules { get; set; } = new() { "AMP" };
///
/// The CONNECTIONNAME stored in the SERVERCONFIG table for this tenant's database.
/// This is the DatabaseName field in your JWT/login. Run this query to find it:
/// SELECT CONNECTIONNAME, SERVERNAME, DATABASENAME FROM SERVERCONFIG
/// WHERE CLIENTID = <your TenantId>
///
public string DatabaseName { get; set; } = "";
///
/// Limit the number of APIs to process in this run. 0 = no limit (process all).
/// Use a small value (e.g. 5) for a quick test before doing the full bulk run.
///
public int MaxApis { get; set; } = 0;
///
/// Path to the gateway's appsettings.json (GB5Build) that defines the
/// module → short-code prefix mapping under ReverseProxy:Routes.
/// Adding a new module there is picked up automatically — no Tool code change needed.
/// Empty = defaults to "{SolutionRoot}\GB5Build\GB5Build\appsettings.json".
///
public string GatewayAppSettingsPath { get; set; } = "";
///
/// When true, after syncing, delete MAPIDOMAIN rows for this tenant that are no
/// longer referenced by any MAPI or MAPICAPABILITY row (leftover from the old
/// one-domain-per-API scheme, now superseded by one shared domain per module).
///
public bool CleanupOrphanedDomains { get; set; } = true;
///
/// Number of endpoints processed concurrently against the DB. 1 = sequential
/// (old behavior). Higher values speed up large runs but increase DB load —
/// tune to what the connection pool / server can sustain.
///
public int MaxConcurrency { get; set; } = 8;
}