<?php

namespace App\Support;

/**
 * Single source of truth for the "Pick a look" style gallery shown in ChatWizard's
 * style step, also consulted by the video providers so a selected style actually
 * changes the video prompt instead of only labelling image ads (see each
 * VideoAvatarProvider's buildPrompt()).
 */
class StyleCatalogue
{
    public const CARDS = [
        [
            'id' => 'ugc',
            'dir' => '9',
            'name' => 'UGC',
            'label' => 'User Generated Content',
            'tag' => 'UGC',
            'desc' => 'Authentic creator testimonial with phone-shot aesthetics. Relatable real-person framing in a bright, modern everyday setting, natural smartphone camera optics, candid expression holding or demonstrating the hero product, believable daylight, crisp focus, and high-trust social proof visual hierarchy.',
            'video_prompt' => 'Authentic creator-style performance ad captured as stable front-facing phone footage in a real room. Use natural window light, casual wardrobe, realistic skin texture, direct eye contact, and a medium close-up with minimal cuts while speaking. The presenter speaks with relatable enthusiasm and natural micro-expressions directly to camera. Keep one consistent presenter, camera position, voice, and background; place brief handheld product demonstrations only between spoken phrases.',
        ],
        [
            'id' => 'botanical-product',
            'dir' => '1',
            'name' => 'Botanical Product',
            'tag' => 'Beauty',
            'desc' => 'High-end organic botanical commercial set. Soft diffused natural morning sunlight casting delicate leaf shadows, fresh lush botanical foliage framing the hero product, smooth stone or wood pedestal, dewy fresh organic textures, and elegant minimalist luxury cosmetics composition.',
            'video_prompt' => 'Premium botanical ad in a refined studio garden set. Keep the presenter in a stable medium close-up while speaking, with soft diffused daylight, fresh botanical foreground layers, clean shadows, shallow depth of field, subtle leaf movement, and a slow controlled camera push-in. Show polished product detail inserts only between spoken phrases.',
        ],
        [
            'id' => 'clean-beauty',
            'dir' => '2',
            'name' => 'Clean Beauty',
            'tag' => 'Skincare',
            'desc' => 'Pristine clean beauty commercial aesthetic. Bright sun-drenched minimalist studio, soft pastel and neutral cream surfaces, elegant architectural negative space, dewy glowing skin texture, crystal-clear glass bottle and product reflections, and sophisticated luxury skincare art direction.',
            'video_prompt' => 'Minimal premium beauty commercial in a bright sunlit studio with warm natural highlights, white and neutral surfaces, generous negative space, and precise editorial composition. Use a steady medium close-up for dialogue, gentle dolly motion, clean product macro inserts between phrases, and realistic skin texture. Do not render headlines or decorative text.',
        ],
        [
            'id' => 'break-out-type',
            'dir' => '3',
            'name' => 'Break-Out Type',
            'tag' => 'Tech',
            'desc' => 'Cutting-edge technology commercial showcase. Sleek modern architectural interior, dramatic edge lighting, bold geometric framing, floating dimensional product presentation, matte metallic textures, and premium industrial design hero staging.',
            'video_prompt' => 'Bold technology ad in a real contemporary interior, using oversized abstract geometric set pieces and layered depth to create a break-through effect without readable typography. Keep dialogue shots stable and front-facing; use a fast but smooth push-through transition to a crisp product hero insert, controlled parallax, high contrast, and warm practical lighting.',
        ],
        [
            'id' => 'splash-energy',
            'dir' => '4',
            'name' => 'Splash Energy',
            'tag' => 'Beverage',
            'desc' => 'High-energy dynamic beverage commercial hero shot. Mid-air product freeze-frame surrounded by crystalline liquid splashes, glistening cold condensation droplets, flying ice cubes, vibrant fresh fruit wedges, dramatic backlighting, and crisp commercial stop-motion detail.',
            'video_prompt' => 'High-energy beverage commercial with vivid color, bright backlighting, condensation, fruit and ice details, and high-speed liquid splash inserts. Keep the presenter dry, clearly visible, and stable while speaking; place dynamic product and splash shots only between dialogue beats, using crisp freeze-motion detail and smooth match cuts.',
        ],
        [
            'id' => 'moody-gourmet',
            'dir' => '5',
            'name' => 'Moody Gourmet',
            'tag' => 'Food',
            'desc' => 'Cinematic Michelin-grade gourmet ad photography. Dark matte slate background, warm directional golden rim lighting, delicate rising steam, rich artisanal food textures, shallow depth of field, velvety shadows, and quiet luxury culinary presentation.',
            'video_prompt' => 'Cinematic gourmet ad with a dark matte environment, warm side and back lighting, restrained practical highlights, shallow depth of field, elegant plating, and slow deliberate camera movement. Hold a flattering medium close-up during speech, then use tactile macro food inserts between phrases. Convey quiet luxury without captions or typography.',
        ],
        [
            'id' => 'bold-type-pop',
            'dir' => '6',
            'name' => 'Bold Type Pop',
            'tag' => 'Lifestyle',
            'desc' => 'Vibrant high-contrast lifestyle ad photography. Bold saturated color-blocked studio background, punchy commercial fashion lighting, playful geometric props, ultra-crisp hero product isolation, and high-energy modern aesthetic.',
            'video_prompt' => 'Playful lifestyle ad with saturated primary color blocking, bold abstract graphic shapes, punchy lighting, clean hard-edged transitions, and energetic product framing. Keep the presenter centered and readable during dialogue with restrained camera movement; add rhythmic product inserts between phrases. Use graphic forms rather than readable lettering.',
        ],
        [
            'id' => 'appetite-offer',
            'dir' => '7',
            'name' => 'Appetite Offer',
            'tag' => 'QSR',
            'desc' => 'Mouthwatering hero food commercial photography. Golden warm key lighting, succulent sizzling textures, crisp fresh ingredients, rich appetizing colors, steam rising, shallow depth of field, and irresistible commercial hero staging.',
            'video_prompt' => 'Fast, appetizing quick-service food commercial with bright natural key light, rich accurate food color, steam and texture detail, macro hero shots, and energetic push-in transitions. Maintain a clean medium close-up for every spoken line and place food close-ups between phrases. Build promotional urgency through pacing and framing, not rendered discount badges or text.',
        ],
        [
            'id' => 'kinetic-sport',
            'dir' => '8',
            'name' => 'Kinetic Sport',
            'tag' => 'Sport',
            'desc' => 'High-impact athletic sports commercial photography. Dramatic storm sky or dusk stadium lighting, powerful low-angle heroic perspective, dynamic energy accents, sweat and motion detail, sharp focus on the hero product, and intense athletic performance atmosphere.',
            'video_prompt' => 'Kinetic sports commercial with dramatic natural skies, low dynamic camera angles, directional light, controlled motion blur, abstract brush-stroke energy accents, and strong product hero framing. Keep dialogue in a stable front-facing medium close-up; reserve fast tracking shots and athletic action inserts for gaps between spoken phrases while preserving presenter continuity.',
        ],
    ];

    /** Looks up a card's mood/lighting "desc" by its display name, label, or id. */
    public static function descriptionFor(?string $styleName): ?string
    {
        if ($styleName === null || trim($styleName) === '') {
            return null;
        }

        foreach (self::CARDS as $card) {
            if (
                strcasecmp($card['name'], $styleName) === 0
                || strcasecmp($card['id'], $styleName) === 0
                || (isset($card['label']) && strcasecmp($card['label'], $styleName) === 0)
            ) {
                return $card['desc'];
            }
        }

        return null;
    }

    public static function videoPromptFor(?string $styleName): ?string
    {
        if ($styleName === null || trim($styleName) === '' || strcasecmp($styleName, 'auto') === 0) {
            return null;
        }

        foreach (self::CARDS as $card) {
            if (
                strcasecmp($card['name'], $styleName) === 0
                || strcasecmp($card['id'], $styleName) === 0
                || (isset($card['label']) && strcasecmp($card['label'], $styleName) === 0)
            ) {
                return $card['video_prompt'];
            }
        }

        // Dynamically synthesize custom or AI-suggested styles rather than silently discarding them
        return sprintf(
            'A polished commercial performance advertisement styled with %s, using professional studio lighting, shallow depth of field, balanced composition, and clean cinematic camera movement.',
            trim($styleName),
        );
    }
}
