// This file is auto-generated by alef. DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
#nullable enable

using System;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Kreuzberg;
/// <summary>
/// Built-in HTML theme selection.
/// </summary>
[JsonConverter(typeof(HtmlThemeJsonConverter))]
public enum HtmlTheme
{
    /// <summary>
    /// Sensible defaults: system font stack, neutral colours, readable line
    /// measure. CSS custom properties (`--kb-*`) are all defined so user CSS
    /// can override individual values.
    /// </summary>
    [JsonPropertyName("default")]
    Default,
    /// <summary>
    /// GitHub Markdown-inspired palette and spacing.
    /// </summary>
    [JsonPropertyName("github")]
    GitHub,
    /// <summary>
    /// Dark background, light text.
    /// </summary>
    [JsonPropertyName("dark")]
    Dark,
    /// <summary>
    /// Minimal light theme with generous whitespace.
    /// </summary>
    [JsonPropertyName("light")]
    Light,
    /// <summary>
    /// No built-in stylesheet emitted. CSS custom properties are still defined
    /// on `:root` so user stylesheets can reference `var(--kb-*)` tokens.
    /// </summary>
    [JsonPropertyName("unstyled")]
    Unstyled,
}


/// <summary>
/// Custom JSON converter for <see cref="HtmlTheme"/> that respects explicit variant names.
/// </summary>
internal sealed class HtmlThemeJsonConverter : JsonConverter<HtmlTheme>
{
    public override HtmlTheme Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
    {
        var value = reader.GetString();
        return value switch
        {
            "default" => HtmlTheme.Default,
            "github" => HtmlTheme.GitHub,
            "dark" => HtmlTheme.Dark,
            "light" => HtmlTheme.Light,
            "unstyled" => HtmlTheme.Unstyled,
            _ => throw new JsonException($"Unknown HtmlTheme value: {value}")
        };
    }

    public override void Write(Utf8JsonWriter writer, HtmlTheme value, JsonSerializerOptions options)
    {
        var str = value switch
        {
            HtmlTheme.Default => "default",
            HtmlTheme.GitHub => "github",
            HtmlTheme.Dark => "dark",
            HtmlTheme.Light => "light",
            HtmlTheme.Unstyled => "unstyled",
            _ => throw new JsonException($"Unknown HtmlTheme value: {value}")
        };
        writer.WriteStringValue(str);
    }
}
