using StellaOps.Plugin.Abstractions; namespace StellaOps.Plugin.Sdk; /// /// Fluent builder for creating PluginInfo. /// public sealed class PluginInfoBuilder { private string _id = ""; private string _name = ""; private string _version = "1.0.0"; private string _vendor = ""; private string? _description; private string? _licenseId; private string? _projectUrl; private string? _iconUrl; /// /// Sets the plugin ID. /// /// Plugin ID in reverse domain notation (e.g., com.example.plugin). public PluginInfoBuilder WithId(string id) { _id = id; return this; } /// /// Sets the plugin name. /// /// Human-readable plugin name. public PluginInfoBuilder WithName(string name) { _name = name; return this; } /// /// Sets the plugin version. /// /// SemVer version string. public PluginInfoBuilder WithVersion(string version) { _version = version; return this; } /// /// Sets the plugin vendor. /// /// Vendor/company name. public PluginInfoBuilder WithVendor(string vendor) { _vendor = vendor; return this; } /// /// Sets the plugin description. /// /// Description of what the plugin does. public PluginInfoBuilder WithDescription(string description) { _description = description; return this; } /// /// Sets the plugin license. /// /// SPDX license identifier. public PluginInfoBuilder WithLicense(string licenseId) { _licenseId = licenseId; return this; } /// /// Sets the plugin project URL. /// /// Project URL. public PluginInfoBuilder WithProjectUrl(string projectUrl) { _projectUrl = projectUrl; return this; } /// /// Sets the plugin icon URL. /// /// Icon URL. public PluginInfoBuilder WithIconUrl(string iconUrl) { _iconUrl = iconUrl; return this; } /// /// Builds the PluginInfo. /// /// If required fields are not set. public PluginInfo Build() { if (string.IsNullOrEmpty(_id)) throw new InvalidOperationException("Plugin ID is required"); if (string.IsNullOrEmpty(_name)) throw new InvalidOperationException("Plugin name is required"); return new PluginInfo( Id: _id, Name: _name, Version: _version, Vendor: _vendor, Description: _description, LicenseId: _licenseId, ProjectUrl: _projectUrl, IconUrl: _iconUrl); } }