<?php
declare(strict_types=1);

namespace ROITheme\Admin\CtaLetsTalk\Infrastructure\FieldMapping;

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

/**
 * Field Mapper para CTA Lets Talk
 *
 * RESPONSABILIDAD:
 * - Mapear field IDs del formulario a atributos de BD
 * - Solo conoce sus propios campos (modularidad)
 */
final class CtaLetsTalkFieldMapper implements FieldMapperInterface
{
    public function getComponentName(): string
    {
        return 'cta-lets-talk';
    }

    public function getFieldMapping(): array
    {
        return [
            // Visibility
            'ctaLetsTalkEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
            'ctaLetsTalkShowDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
            'ctaLetsTalkShowMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],
            'ctaLetsTalkHideForLoggedIn' => ['group' => 'visibility', 'attribute' => 'hide_for_logged_in'],

            // Page Visibility (grupo especial _page_visibility)
            'ctaLetsTalkVisibilityHome' => ['group' => '_page_visibility', 'attribute' => 'show_on_home'],
            'ctaLetsTalkVisibilityPosts' => ['group' => '_page_visibility', 'attribute' => 'show_on_posts'],
            'ctaLetsTalkVisibilityPages' => ['group' => '_page_visibility', 'attribute' => 'show_on_pages'],
            'ctaLetsTalkVisibilityArchives' => ['group' => '_page_visibility', 'attribute' => 'show_on_archives'],
            'ctaLetsTalkVisibilitySearch' => ['group' => '_page_visibility', 'attribute' => 'show_on_search'],

            // Exclusions (grupo especial _exclusions - Plan 99.11)
            'letsTalkExclusionsEnabled' => ['group' => '_exclusions', 'attribute' => 'exclusions_enabled'],
            'letsTalkExcludeCategories' => ['group' => '_exclusions', 'attribute' => 'exclude_categories', 'type' => 'json_array'],
            'letsTalkExcludePostIds' => ['group' => '_exclusions', 'attribute' => 'exclude_post_ids', 'type' => 'json_array_int'],
            'letsTalkExcludeUrlPatterns' => ['group' => '_exclusions', 'attribute' => 'exclude_url_patterns', 'type' => 'json_array_lines'],

            // Content
            'ctaLetsTalkButtonText' => ['group' => 'content', 'attribute' => 'button_text'],
            'ctaLetsTalkShowIcon' => ['group' => 'content', 'attribute' => 'show_icon'],
            'ctaLetsTalkIconClass' => ['group' => 'content', 'attribute' => 'icon_class'],
            'ctaLetsTalkModalTarget' => ['group' => 'content', 'attribute' => 'modal_target'],
            'ctaLetsTalkAriaLabel' => ['group' => 'content', 'attribute' => 'aria_label'],

            // Behavior
            'ctaLetsTalkEnableModal' => ['group' => 'behavior', 'attribute' => 'enable_modal'],
            'ctaLetsTalkCustomUrl' => ['group' => 'behavior', 'attribute' => 'custom_url'],
            'ctaLetsTalkOpenNewTab' => ['group' => 'behavior', 'attribute' => 'open_in_new_tab'],

            // Typography
            'ctaLetsTalkFontSize' => ['group' => 'typography', 'attribute' => 'font_size'],
            'ctaLetsTalkFontWeight' => ['group' => 'typography', 'attribute' => 'font_weight'],
            'ctaLetsTalkTextTransform' => ['group' => 'typography', 'attribute' => 'text_transform'],

            // Colors
            'ctaLetsTalkBgColor' => ['group' => 'colors', 'attribute' => 'background_color'],
            'ctaLetsTalkBgHoverColor' => ['group' => 'colors', 'attribute' => 'background_hover_color'],
            'ctaLetsTalkTextColor' => ['group' => 'colors', 'attribute' => 'text_color'],
            'ctaLetsTalkTextHoverColor' => ['group' => 'colors', 'attribute' => 'text_hover_color'],
            'ctaLetsTalkBorderColor' => ['group' => 'colors', 'attribute' => 'border_color'],

            // Spacing
            'ctaLetsTalkPaddingTB' => ['group' => 'spacing', 'attribute' => 'padding_top_bottom'],
            'ctaLetsTalkPaddingLR' => ['group' => 'spacing', 'attribute' => 'padding_left_right'],
            'ctaLetsTalkMarginLeft' => ['group' => 'spacing', 'attribute' => 'margin_left'],
            'ctaLetsTalkIconSpacing' => ['group' => 'spacing', 'attribute' => 'icon_spacing'],

            // Visual Effects
            'ctaLetsTalkBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'border_radius'],
            'ctaLetsTalkBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'border_width'],
            'ctaLetsTalkBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'box_shadow'],
            'ctaLetsTalkTransition' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
        ];
    }
}
