<?php
declare(strict_types=1);

namespace App\Theme;

final class ThemePresetService
{
    /** @return array<string,array{name:string,description:string,tokens:array<string,array<string,string>>}> */
    public static function all(): array
    {
        $presets = [
            'saas_nebula' => ['name'=>'SaaS Nebula','description'=>'Cool SaaS palette with indigo and cyan accents.','colors'=>['bg'=>'#F7F8FB','surface'=>'#FFFFFF','surface_soft'=>'#F1F5F9','text'=>'#0F172A','muted'=>'#64748B','border'=>'#E2E8F0','primary'=>'#4F46E5','primary_hover'=>'#4338CA','secondary'=>'#0284C7','accent'=>'#7C3AED','success'=>'#047857','warning'=>'#A16207','danger'=>'#B91C1C']],
            'clean_business' => ['name'=>'Clean Business','description'=>'Neutral business interface with a restrained blue primary.','colors'=>['bg'=>'#F8FAFC','surface'=>'#FFFFFF','surface_soft'=>'#F1F5F9','text'=>'#111827','muted'=>'#5B6472','border'=>'#DDE3EA','primary'=>'#1D4ED8','primary_hover'=>'#1E40AF','secondary'=>'#0369A1','accent'=>'#7C3AED','success'=>'#047857','warning'=>'#A16207','danger'=>'#B91C1C']],
            'jordan_green' => ['name'=>'Jordan Green','description'=>'Warm local-friendly green palette based on Quaeriva defaults.','colors'=>['bg'=>'#F6F7F5','surface'=>'#FFFFFF','surface_soft'=>'#F0F4F1','text'=>'#17211D','muted'=>'#59645F','border'=>'#DDE5E0','primary'=>'#0E6F5C','primary_hover'=>'#0A5546','secondary'=>'#326B85','accent'=>'#A66F14','success'=>'#16734C','warning'=>'#9A6700','danger'=>'#A84848']],
            'warm_editorial' => ['name'=>'Warm Editorial','description'=>'Soft editorial surfaces for reading-heavy communities.','colors'=>['bg'=>'#F8F4EC','surface'=>'#FFFDF8','surface_soft'=>'#F2ECE1','text'=>'#2A2118','muted'=>'#6D6258','border'=>'#E3D8C8','primary'=>'#7C4A24','primary_hover'=>'#653A1C','secondary'=>'#315E6B','accent'=>'#9A6A16','success'=>'#2D6A4F','warning'=>'#8A5A00','danger'=>'#9B3D3D']],
            'luxury_dark' => ['name'=>'Luxury Dark','description'=>'Dark high-contrast theme for a polished community.','colors'=>['bg'=>'#080D1A','surface'=>'#111827','surface_soft'=>'#1E293B','text'=>'#EEF2FF','muted'=>'#B1BDD0','border'=>'#334155','primary'=>'#818CF8','primary_hover'=>'#A5B4FC','secondary'=>'#38BDF8','accent'=>'#C4B5FD','success'=>'#34D399','warning'=>'#FBBF24','danger'=>'#F87171']],
            'medical_calm' => ['name'=>'Medical Calm','description'=>'Calm blue-green palette with clear contrast.','colors'=>['bg'=>'#F4F9FA','surface'=>'#FFFFFF','surface_soft'=>'#EAF4F5','text'=>'#102A31','muted'=>'#526B72','border'=>'#D5E6E9','primary'=>'#0F6F78','primary_hover'=>'#0B5961','secondary'=>'#2563A6','accent'=>'#6D4AA8','success'=>'#19734E','warning'=>'#946200','danger'=>'#A83F4A']],
            'industrial_pro' => ['name'=>'Industrial Pro','description'=>'Charcoal and navy surfaces with a controlled amber accent.','colors'=>['bg'=>'#F2F4F6','surface'=>'#FFFFFF','surface_soft'=>'#E8ECEF','text'=>'#17202A','muted'=>'#58636F','border'=>'#D5DAE0','primary'=>'#273C58','primary_hover'=>'#1C2D45','secondary'=>'#3F647C','accent'=>'#9A5A0A','success'=>'#227052','warning'=>'#8A5A00','danger'=>'#A53D3D']],
        ];
        $result=[];
        foreach($presets as $key=>$preset){$tokens=ThemeTokenService::normalize(['colors'=>$preset['colors']]);$result[$key]=['name'=>$preset['name'],'description'=>$preset['description'],'tokens'=>$tokens];}
        return $result;
    }

    /** @return array{name:string,description:string,tokens:array<string,array<string,string>>}|null */
    public static function get(string $key): ?array { $all=self::all(); return $all[$key]??null; }
}
