using Microsoft.FluentUI.AspNetCore.Components;

namespace {Namespace}.Themes;

/// <summary>
/// Fluent UI Design Theme customizado para {Project Name}.
/// Gerado automaticamente baseado em ui-design-system.md
/// </summary>
/// <remarks>
/// Template MORPH-SPEC v2.1.1 by Polymorphism Tech
/// </remarks>
public static class FluentDesignTheme
{
    /// <summary>
    /// Paleta de cores do tema
    /// </summary>
    public static DesignThemePalette GetPalette() => new()
    {
        // Cores Principais
        Primary = "#{hex da cor primária}",        // Ex: #3b82f6
        Secondary = "#{hex da cor secundária}",    // Ex: #6b7280

        // Cores de Estado
        Success = "#{hex}",   // Ex: #10b981
        Error = "#{hex}",     // Ex: #ef4444
        Warning = "#{hex}",   // Ex: #f59e0b
        Info = "#{hex}",      // Ex: #06b6d4

        // Neutros
        NeutralLight = "#{hex do gray-50}",        // Ex: #f9fafb
        NeutralLighter = "#{hex do gray-100}",     // Ex: #f3f4f6
        NeutralDark = "#{hex do gray-800}",        // Ex: #1f2937
        NeutralDarker = "#{hex do gray-900}",      // Ex: #111827

        // Background e Foreground
        Background = "#ffffff",
        Foreground = "#{hex do gray-900}",         // Texto principal

        // Accent (geralmente = Primary)
        Accent = "#{hex da cor primária}",
    };

    /// <summary>
    /// Configuração de tipografia
    /// </summary>
    public static DesignThemeTypography GetTypography() => new()
    {
        FontFamily = "'{Font Name}', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",

        // Tamanhos
        FontSizeBase = "1rem",       // 16px
        FontSizeSmall = "0.875rem",  // 14px
        FontSizeLarge = "1.125rem",  // 18px

        // Weights
        FontWeightRegular = 400,
        FontWeightSemibold = 600,
        FontWeightBold = 700,

        // Line Heights
        LineHeightBase = 1.5,
    };

    /// <summary>
    /// Configuração de espaçamento e layout
    /// </summary>
    public static DesignThemeLayout GetLayout() => new()
    {
        // Espaçamento (baseado em múltiplos de {base}px - ex: 4px)
        SpacingBase = "0.25rem",  // 4px
        SpacingSmall = "0.5rem",  // 8px
        SpacingMedium = "1rem",   // 16px
        SpacingLarge = "1.5rem",  // 24px

        // Border Radius
        BorderRadiusSmall = "0.125rem",  // 2px
        BorderRadiusMedium = "0.375rem", // 6px
        BorderRadiusLarge = "0.5rem",    // 8px

        // Shadows (depende da biblioteca - ajustar conforme API)
        Elevation1 = "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
        Elevation2 = "0 4px 6px -1px rgba(0, 0, 0, 0.1)",
        Elevation3 = "0 10px 15px -3px rgba(0, 0, 0, 0.1)",
    };

    /// <summary>
    /// Aplica o tema customizado ao FluentUI
    /// </summary>
    /// <param name="services">Service collection</param>
    public static void AddFluentUIWithCustomTheme(this IServiceCollection services)
    {
        services.AddFluentUIComponents(options =>
        {
            // Aplicar paleta customizada
            options.DesignThemePalette = GetPalette();

            // Outras configurações do Fluent UI
            // ...
        });
    }
}

/// <summary>
/// Classe de configuração de tipografia
/// (Ajustar conforme API do Fluent UI Blazor v4.x)
/// </summary>
public class DesignThemeTypography
{
    public string FontFamily { get; set; } = string.Empty;
    public string FontSizeBase { get; set; } = string.Empty;
    public string FontSizeSmall { get; set; } = string.Empty;
    public string FontSizeLarge { get; set; } = string.Empty;
    public int FontWeightRegular { get; set; }
    public int FontWeightSemibold { get; set; }
    public int FontWeightBold { get; set; }
    public double LineHeightBase { get; set; }
}

/// <summary>
/// Classe de configuração de layout
/// (Ajustar conforme API do Fluent UI Blazor v4.x)
/// </summary>
public class DesignThemeLayout
{
    public string SpacingBase { get; set; } = string.Empty;
    public string SpacingSmall { get; set; } = string.Empty;
    public string SpacingMedium { get; set; } = string.Empty;
    public string SpacingLarge { get; set; } = string.Empty;

    public string BorderRadiusSmall { get; set; } = string.Empty;
    public string BorderRadiusMedium { get; set; } = string.Empty;
    public string BorderRadiusLarge { get; set; } = string.Empty;

    public string Elevation1 { get; set; } = string.Empty;
    public string Elevation2 { get; set; } = string.Empty;
    public string Elevation3 { get; set; } = string.Empty;
}

/// <summary>
/// EXEMPLO DE USO:
///
/// // Program.cs
/// builder.Services.AddFluentUIWithCustomTheme();
///
/// // App.razor ou MainLayout.razor
/// <FluentDesignTheme Mode="DesignThemeMode.Light" />
///
/// // Componentes podem acessar cores via CSS variables ou propriedades do tema
/// </summary>
