using System; using System.Collections.Generic; using System.Diagnostics; using System.Text.Json.Serialization; using BO.ProcessServer.Business.Enums; namespace BO.ProcessServer.Options { internal class Configuration { [JsonPropertyName("api-base-url")] public Uri ApiBaseUrl { get; set; } [JsonPropertyName("api-user")] public string ApiUser { get; set; } [JsonPropertyName("api-pwd")] public string ApiUserPwd { get; set; } [JsonPropertyName("api-magic")] public string ApiMagic { get; set; } [JsonPropertyName("api-timeout")] public string ApiTimeoutRaw { get; set; } public TimeSpan ApiTimeout => TimeSpan.Parse(ApiTimeoutRaw); public CfgSystem System { get; set; } public class CfgSystem { [JsonPropertyName("mode")] public AppModeEnum Mode { get; set; } [JsonPropertyName("identification")] public string Identification { get; set; } [JsonPropertyName("preferred-interface")] public string PreferredInterface { get; set; } [JsonPropertyName("pool-pull-documents")] public int PoolPullDocuments { get; set; } [JsonPropertyName("pool-pull-interval")] public string PoolPullIntervalRaw { get; set; } public TimeSpan PoolPullInterval => TimeSpan.Parse(PoolPullIntervalRaw); [JsonPropertyName("pool-path-base")] public string PoolPathBase { get; set; } [JsonPropertyName("pool-path-pending")] public string PoolPathPending { get; set; } [JsonPropertyName("pool-path-working")] public string PoolPathWorking { get; set; } [JsonPropertyName("pool-path-done")] public string PoolPathDone { get; set; } [JsonPropertyName("pool-path-fail")] public string PoolPathFail { get; set; } [JsonPropertyName("pool-retention")] public CfgPoolRetention Retention { get; set; } [JsonPropertyName("status-monitoring")] public CfgStatusMonitoring Status { get; set; } [JsonPropertyName("scenario-path-base")] public string ScenarioPathBase { get; set; } [JsonPropertyName("scenario-parallels")] public int ScenarioParallelThreads { get; set; } [JsonPropertyName("scenarios")] public IEnumerable Scenarios { get; set; } [JsonPropertyName("proxy")] public CfgProxies Proxy { get; set; } } public class CfgScenarioAcceptFilter { [JsonPropertyName("code")] public ScenarioAcceptFilterCodeEnum Code { get; set; } [JsonPropertyName("value")] public string Value { get; set; } } public class CfgScenario { [JsonPropertyName("name")] public string Name { get; set; } [JsonPropertyName("cmd")] public string ShellCommand { get; set; } [JsonPropertyName("run-windows-style")] public string RunWindowsStyleRaw { get; set; } public ProcessWindowStyle RunWindowsStyle => Enum.Parse(RunWindowsStyleRaw); [JsonPropertyName("run-hidden")] public bool RunHidden { get; set; } [JsonPropertyName("args")] public string ShellCommandArguments { get; set; } [JsonPropertyName("accept-filters-if-all")] public bool AcceptFiltersIfAll { get; set; } [JsonPropertyName("accept-filters")] public IEnumerable AcceptFilters { get; set; } [JsonPropertyName("timeout-interval")] public string TimeoutIntervalRaw { get; set; } public TimeSpan TimeoutInterval => TimeSpan.Parse(TimeoutIntervalRaw); [JsonPropertyName("exitcode-succ")] public int ExitCodeSucc { get; set; } [JsonPropertyName("exitcode-fail")] public int ExitCodeFail { get; set; } } public class CfgStatusMonitoring { [JsonPropertyName("enabled")] public bool Enabled { get; set; } [JsonPropertyName("monitoring-interval")] public string IntervalRaw { get; set; } public TimeSpan Interval => TimeSpan.Parse(IntervalRaw); [JsonPropertyName("file")] public string File { get; set; } } public class CfgPoolRetention { [JsonPropertyName("enabled")] public bool Enabled { get; set; } [JsonPropertyName("retention-interval")] public string IntervalRaw { get; set; } public TimeSpan Interval => TimeSpan.Parse(IntervalRaw); [JsonPropertyName("size")] public long Size { get; set; } [JsonPropertyName("items")] public int Items { get; set; } } public class CfgProxies { [JsonPropertyName("process")] public CfgProxiesProcess Process { get; set; } [JsonPropertyName("app")] public CfgProxiesApp App { get; set; } } public class CfgProxiesProcess { [JsonPropertyName("succ")] public IEnumerable Succ { get; set; } [JsonPropertyName("output")]public IEnumerable Output { get; set; } } public class CfgProxiesApp { [JsonPropertyName("default-documents-count")] public int DefaultDocumentsCount { get; set; } [JsonPropertyName("max-documents-count")] public int MaxDocumentsCount { get; set; } [JsonPropertyName("default-artifacts-count")] public int DefaultArtifactCount { get; set; } [JsonPropertyName("extension")] public IEnumerable Extension { get; set; } [JsonPropertyName("nameprefix")] public IEnumerable NameProfix { get; set; } [JsonPropertyName("presetcreditcost")] public IEnumerable PresetCreditCost { get; set; } [JsonPropertyName("presetwatermark")] public IEnumerable PresetWatermark { get; set; } [JsonPropertyName("presetquality")] public IEnumerable PresetQuality { get; set; } [JsonPropertyName("presetprocessprofile")] public IEnumerable PresetProcessProfile { get; set; } [JsonPropertyName("presettest")] public IEnumerable PresetTest { get; set; } } } }