using System.Text.Json.Serialization;
namespace StabilityMatrix.Core.Models;
///
/// Defines a launch option for a BasePackage.
///
public record LaunchOptionDefinition
{
///
/// Name or title of the card.
///
public required 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 required LaunchOptionType Type { get; init; }
///
/// Optional description of the option.
///
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; init; }
///
/// Minimum number of selected options (for validation)
///
public int? MinSelectedOptions { get; init; }
///
/// Maximum number of selected options (for validation)
///
public int? MaxSelectedOptions { get; init; }
///
/// List of option flags like "--api", "--lowvram", etc.
///
public List Options { get; init; } = new();
///
/// Constant for the Extras launch option.
///
[JsonIgnore]
public static LaunchOptionDefinition Extras => new()
{
Name = "Extra Launch Arguments",
Type = LaunchOptionType.String,
Options = new List {""}
};
}