using System; using System.Collections.Generic; namespace StellaOps.Scheduler.WebService.Options; /// /// Scheduler host configuration defaults consumed at startup for cross-cutting concerns /// such as plug-in discovery. /// public sealed class SchedulerOptions { public PluginOptions Plugins { get; set; } = new(); public void Validate() { Plugins.Validate(); } public sealed class PluginOptions { /// /// Base directory resolving relative plug-in paths. Defaults to solution root. /// public string? BaseDirectory { get; set; } /// /// Directory containing plug-in binaries. Defaults to plugins/scheduler. /// public string? Directory { get; set; } /// /// Controls whether sub-directories are scanned for plug-ins. /// public bool RecursiveSearch { get; set; } = false; /// /// Ensures the plug-in directory exists on startup. /// public bool EnsureDirectoryExists { get; set; } = true; /// /// Explicit plug-in discovery patterns (supports globbing). /// public IList SearchPatterns { get; } = new List(); /// /// Optional ordered plug-in assembly names (without extension). /// public IList OrderedPlugins { get; } = new List(); public void Validate() { foreach (var pattern in SearchPatterns) { if (string.IsNullOrWhiteSpace(pattern)) { throw new InvalidOperationException("Scheduler plug-in search patterns cannot contain null or whitespace entries."); } } foreach (var assemblyName in OrderedPlugins) { if (string.IsNullOrWhiteSpace(assemblyName)) { throw new InvalidOperationException("Scheduler ordered plug-in entries cannot contain null or whitespace values."); } } } } }