<?php
declare(strict_types=1);

namespace ROITheme\Admin\Hero\Infrastructure\FieldMapping;

use ROITheme\Admin\Shared\Domain\Contracts\FieldMapperInterface;

/**
 * Field Mapper para Hero Section
 *
 * RESPONSABILIDAD:
 * - Mapear field IDs del formulario a atributos de BD
 * - Solo conoce sus propios campos (modularidad)
 */
final class HeroFieldMapper implements FieldMapperInterface
{
    public function getComponentName(): string
    {
        return 'hero';
    }

    public function getFieldMapping(): array
    {
        return [
            // Visibility
            'heroEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
            'heroShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
            'heroShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
            'heroIsCritical' => ['group' => 'visibility', 'attribute' => 'is_critical'],

            // Page Visibility (grupo especial _page_visibility)
            'heroVisibilityHome' => ['group' => '_page_visibility', 'attribute' => 'show_on_home'],
            'heroVisibilityPosts' => ['group' => '_page_visibility', 'attribute' => 'show_on_posts'],
            'heroVisibilityPages' => ['group' => '_page_visibility', 'attribute' => 'show_on_pages'],
            'heroVisibilityArchives' => ['group' => '_page_visibility', 'attribute' => 'show_on_archives'],
            'heroVisibilitySearch' => ['group' => '_page_visibility', 'attribute' => 'show_on_search'],

            // Exclusions (grupo especial _exclusions - Plan 99.11)
            'heroExclusionsEnabled' => ['group' => '_exclusions', 'attribute' => 'exclusions_enabled'],
            'heroExcludeCategories' => ['group' => '_exclusions', 'attribute' => 'exclude_categories', 'type' => 'json_array'],
            'heroExcludePostIds' => ['group' => '_exclusions', 'attribute' => 'exclude_post_ids', 'type' => 'json_array_int'],
            'heroExcludeUrlPatterns' => ['group' => '_exclusions', 'attribute' => 'exclude_url_patterns', 'type' => 'json_array_lines'],

            // Content
            'heroShowCategories' => ['group' => 'content', 'attribute' => 'show_categories'],
            'heroShowBadgeIcon' => ['group' => 'content', 'attribute' => 'show_badge_icon'],
            'heroBadgeIconClass' => ['group' => 'content', 'attribute' => 'badge_icon_class'],
            'heroTitleTag' => ['group' => 'content', 'attribute' => 'title_tag'],

            // Colors
            'heroGradientStart' => ['group' => 'colors', 'attribute' => 'gradient_start'],
            'heroGradientEnd' => ['group' => 'colors', 'attribute' => 'gradient_end'],
            'heroTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
            'heroBadgeBgColor' => ['group' => 'colors', 'attribute' => 'badge_bg_color'],
            'heroBadgeTextColor' => ['group' => 'colors', 'attribute' => 'badge_text_color'],
            'heroBadgeIconColor' => ['group' => 'colors', 'attribute' => 'badge_icon_color'],
            'heroBadgeHoverBg' => ['group' => 'colors', 'attribute' => 'badge_hover_bg'],

            // Typography
            'heroTitleFontSize' => ['group' => 'typography', 'attribute' => 'title_font_size'],
            'heroTitleFontSizeMobile' => ['group' => 'typography', 'attribute' => 'title_font_size_mobile'],
            'heroTitleFontWeight' => ['group' => 'typography', 'attribute' => 'title_font_weight'],
            'heroTitleLineHeight' => ['group' => 'typography', 'attribute' => 'title_line_height'],
            'heroBadgeFontSize' => ['group' => 'typography', 'attribute' => 'badge_font_size'],

            // Spacing
            'heroPaddingVertical' => ['group' => 'spacing', 'attribute' => 'padding_vertical'],
            'heroMarginBottom' => ['group' => 'spacing', 'attribute' => 'margin_bottom'],
            'heroBadgePadding' => ['group' => 'spacing', 'attribute' => 'badge_padding'],
            'heroBadgeBorderRadius' => ['group' => 'spacing', 'attribute' => 'badge_border_radius'],

            // Visual Effects
            'heroBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
            'heroTitleTextShadow' => ['group' => 'visual_effects', 'attribute' => 'title_text_shadow'],
            'heroBadgeBackdropBlur' => ['group' => 'visual_effects', 'attribute' => 'badge_backdrop_blur'],
        ];
    }
}
