using System.Text.Json.Serialization; namespace StabilityMatrix.Core.Models; /// /// Defines a launch option for a BasePackage. /// public class LaunchOptionDefinition { public string Name { get; init; } /// /// Type of the option. "bool", "int", or "string" /// - "bool" can supply 1 or more flags in the Options list (e.g. ["--api", "--lowvram"]) /// - "int" and "string" should supply a single flag in the Options list (e.g. ["--width"], ["--api"]) /// public LaunchOptionType Type { get; init; } = LaunchOptionType.Bool; public string? Description { get; init; } /// /// Server-side default for the option. (Ignored for launch and saving if value matches) /// Use `InitialValue` to provide a default that is set as the user value and used for launch. /// public object? DefaultValue { get; init; } /// /// Initial value for the option if no set value is available, set as the user value on save. /// Use `DefaultValue` to provide a server-side default that is ignored for launch and saving. /// public object? InitialValue { get; set; } // Minimum number of selected options public int? MinSelectedOptions { get; set; } // Maximum number of selected options public int? MaxSelectedOptions { get; set; } /// /// List of option flags like "--api", "--lowvram", etc. /// public List Options { get; set; } [JsonIgnore] public static LaunchOptionDefinition Extras => new() { Name = "Extra Launch Arguments", Type = LaunchOptionType.String, Options = new() {""} }; }