namespace NTP.Application.Grains.Permits; /// /// Configuration for the Grains permits slice (config section "Grains:Permits"). Replaces the legacy ColdFusion /// application-scope variables that are NOT in the repository (application.GN_BadiyaSCAC, grnsOprationShft_*, /// grnsdtrbutnshft_*, GN_ALLOWEDSTATUSES, PetWS, autoCallerIP, nafethApiKey). Defaults marked UNVERIFIED must be confirmed. /// public sealed class GrainsPermitsOptions { public const string SectionName = "Grains:Permits"; /// SCAC of the "owners / individuals" pseudo company (legacy application.GN_BadiyaSCAC; hard-coded 327 elsewhere in grains.cfc). public long BadiyaScac { get; set; } = 327; /// Stakeholder id of trucking companies (legacy session.stkid = 62): they only see their own permits. public long CompanyStakeholderId { get; set; } = 62; /// Operation window of shift 1/2 as [firstHour, lastHour] relative to the order date (legacy grnsOprationShft_1/2). UNVERIFIED defaults. public int[] OperationShift1 { get; set; } = [6, 18]; public int[] OperationShift2 { get; set; } = [18, 30]; /// Distribution shifts [start, end] used to compute blacklist expiry (legacy grnsdtrbutnshft_N). UNVERIFIED defaults. public int[] DistributionShift1 { get; set; } = [6, 18]; public int[] DistributionShift2 { get; set; } = [18, 30]; public int[] DistributionShift3 { get; set; } = [30, 42]; /// Statuses a truck/trailer/driver registration must have to be usable on a permit (legacy GN_ALLOWEDSTATUSES). UNVERIFIED. public string[] AllowedStatuses { get; set; } = ["OPEN", "ACCPT"]; /// Initial value of the in-memory "absence" feature flag (legacy application.GNABSENCEFEATURE). UNVERIFIED. public bool AbsenceFeatureEnabled { get; set; } = true; /// MOT ownership codes allowed for owners / for companies (legacy GN_BadyahOwnership / GN_OthersOwnership). /// Empty = the check is skipped (UNVERIFIED: the legacy values are not in the repository). public string[] BadiyaOwnershipCodes { get; set; } = []; public string[] OtherOwnershipCodes { get; set; } = []; public TcsOptions Tcs { get; set; } = new(); public AutoCallOptions AutoCall { get; set; } = new(); public NotificationOptions Notifications { get; set; } = new(); public WeighbridgeSourceOptions WeighbridgeSource { get; set; } = new(); public JobOptions Jobs { get; set; } = new(); public int[] DistributionShift(long shift) => shift switch { 2 => DistributionShift2, 3 => DistributionShift3, _ => DistributionShift1 }; public int[] OperationShift(long shift) => shift == 1 ? OperationShift1 : OperationShift2; } /// Outbound TCS (petroleum permit web service, legacy application.PetWS) integration. public sealed class TcsOptions { public bool Enabled { get; set; } /// Endpoint of CreatePermitWS (legacy application.PetWS, ApplicationVariables.xml). public string PermitServiceUrl { get; set; } = "http://192.168.1.90:8080/FDfolioWS/services/CreatePermitWS"; public int TimeoutSeconds { get; set; } = 60; } /// Outbound IVR / auto-dialer integration (GrainsFactoryWeb.autoCallService / autoCallService2, autoCallResponse.cfc). public sealed class AutoCallOptions { public bool Enabled { get; set; } /// Legacy application.autoCallerIP: receives {"TYPE":"TEST","FILE":"<base64 csv>"}. public string SendUrl { get; set; } = string.Empty; /// Legacy IVR web service (http://aqtcs.nafith.net/IVR/callivr.cfc) - callAPI. public string IvrUrl { get; set; } = string.Empty; /// Expected X-Api-Key of the dialer's callback (legacy application.nafethApiKey). Empty = callback disabled. public string ApiKey { get; set; } = string.Empty; public int TimeoutSeconds { get; set; } = 30; /// How long the voice-call button waits for the IVR service before it reports "started" (the service answers only when it has dialed everybody). public int IvrWaitSeconds { get; set; } = 20; /// Longest time one IVR call may keep running in the background before it is abandoned. public int IvrTimeoutMinutes { get; set; } = 15; } /// Mobile notifications (legacy NTP.components.MobileNotifications.PrepareNotificationMessage). public sealed class NotificationOptions { public bool Enabled { get; set; } public string Url { get; set; } = string.Empty; public int TimeoutSeconds { get; set; } = 15; } /// External weighbridge database (legacy datasource GrainsWeighbridge, table CARGO). public sealed class WeighbridgeSourceOptions { public string ConnectionString { get; set; } = string.Empty; } /// Scheduled jobs. Every job is disabled by default; set Enabled=true per job to run it inside the API process. public sealed class JobOptions { public JobSchedule ActivateDestinations { get; set; } = new() { IntervalMinutes = 60 }; public JobSchedule GabanTimeout { get; set; } = new() { IntervalMinutes = 60 }; public JobSchedule WeighbridgeSync { get; set; } = new() { IntervalMinutes = 5 }; public JobSchedule AqabaWeighbridgeSync { get; set; } = new() { IntervalMinutes = 5 }; public JobSchedule PermitSeeding { get; set; } = new() { IntervalMinutes = 60 }; } public sealed class JobSchedule { public bool Enabled { get; set; } public int IntervalMinutes { get; set; } = 60; } /// Supplies the bound "Grains:Permits" settings (implemented in Infrastructure; registered by the *Service naming convention). public interface IGrainsPermitsSettingsService { GrainsPermitsOptions Value { get; } }