<?php
declare(strict_types=1);

namespace ROITheme\Admin\ContactForm\Infrastructure\FieldMapping;

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

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

    public function getFieldMapping(): array
    {
        return [
            // Visibility
            'contactFormEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
            'contactFormShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
            'contactFormShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],

            // Page Visibility (grupo especial _page_visibility)
            'contactFormVisibilityHome' => ['group' => '_page_visibility', 'attribute' => 'show_on_home'],
            'contactFormVisibilityPosts' => ['group' => '_page_visibility', 'attribute' => 'show_on_posts'],
            'contactFormVisibilityPages' => ['group' => '_page_visibility', 'attribute' => 'show_on_pages'],
            'contactFormVisibilityArchives' => ['group' => '_page_visibility', 'attribute' => 'show_on_archives'],
            'contactFormVisibilitySearch' => ['group' => '_page_visibility', 'attribute' => 'show_on_search'],

            // Exclusions (grupo especial _exclusions - Plan 99.11)
            'contactFormExclusionsEnabled' => ['group' => '_exclusions', 'attribute' => 'exclusions_enabled'],
            'contactFormExcludeCategories' => ['group' => '_exclusions', 'attribute' => 'exclude_categories', 'type' => 'json_array'],
            'contactFormExcludePostIds' => ['group' => '_exclusions', 'attribute' => 'exclude_post_ids', 'type' => 'json_array_int'],
            'contactFormExcludeUrlPatterns' => ['group' => '_exclusions', 'attribute' => 'exclude_url_patterns', 'type' => 'json_array_lines'],

            // Content
            'contactFormSectionTitle' => ['group' => 'content', 'attribute' => 'section_title'],
            'contactFormSectionDescription' => ['group' => 'content', 'attribute' => 'section_description'],
            'contactFormSubmitButtonText' => ['group' => 'content', 'attribute' => 'submit_button_text'],
            'contactFormSubmitButtonIcon' => ['group' => 'content', 'attribute' => 'submit_button_icon'],

            // Contact Info
            'contactFormShowContactInfo' => ['group' => 'contact_info', 'attribute' => 'show_contact_info'],
            'contactFormPhoneLabel' => ['group' => 'contact_info', 'attribute' => 'phone_label'],
            'contactFormPhoneValue' => ['group' => 'contact_info', 'attribute' => 'phone_value'],
            'contactFormEmailLabel' => ['group' => 'contact_info', 'attribute' => 'email_label'],
            'contactFormEmailValue' => ['group' => 'contact_info', 'attribute' => 'email_value'],
            'contactFormLocationLabel' => ['group' => 'contact_info', 'attribute' => 'location_label'],
            'contactFormLocationValue' => ['group' => 'contact_info', 'attribute' => 'location_value'],

            // Form Labels
            'contactFormFullnamePlaceholder' => ['group' => 'form_labels', 'attribute' => 'fullname_placeholder'],
            'contactFormCompanyPlaceholder' => ['group' => 'form_labels', 'attribute' => 'company_placeholder'],
            'contactFormWhatsappPlaceholder' => ['group' => 'form_labels', 'attribute' => 'whatsapp_placeholder'],
            'contactFormEmailPlaceholder' => ['group' => 'form_labels', 'attribute' => 'email_placeholder'],
            'contactFormMessagePlaceholder' => ['group' => 'form_labels', 'attribute' => 'message_placeholder'],

            // Integration
            'contactFormWebhookUrl' => ['group' => 'integration', 'attribute' => 'webhook_url'],
            'contactFormWebhookMethod' => ['group' => 'integration', 'attribute' => 'webhook_method'],
            'contactFormIncludePageUrl' => ['group' => 'integration', 'attribute' => 'include_page_url'],
            'contactFormIncludeTimestamp' => ['group' => 'integration', 'attribute' => 'include_timestamp'],

            // Messages
            'contactFormSuccessMessage' => ['group' => 'messages', 'attribute' => 'success_message'],
            'contactFormErrorMessage' => ['group' => 'messages', 'attribute' => 'error_message'],
            'contactFormSendingMessage' => ['group' => 'messages', 'attribute' => 'sending_message'],
            'contactFormValidationRequired' => ['group' => 'messages', 'attribute' => 'validation_required'],
            'contactFormValidationEmail' => ['group' => 'messages', 'attribute' => 'validation_email'],

            // Colors
            'contactFormSectionBgColor' => ['group' => 'colors', 'attribute' => 'section_bg_color'],
            'contactFormTitleColor' => ['group' => 'colors', 'attribute' => 'title_color'],
            'contactFormDescriptionColor' => ['group' => 'colors', 'attribute' => 'description_color'],
            'contactFormIconColor' => ['group' => 'colors', 'attribute' => 'icon_color'],
            'contactFormInfoLabelColor' => ['group' => 'colors', 'attribute' => 'info_label_color'],
            'contactFormInfoValueColor' => ['group' => 'colors', 'attribute' => 'info_value_color'],
            'contactFormInputBorderColor' => ['group' => 'colors', 'attribute' => 'input_border_color'],
            'contactFormInputFocusBorder' => ['group' => 'colors', 'attribute' => 'input_focus_border'],
            'contactFormButtonBgColor' => ['group' => 'colors', 'attribute' => 'button_bg_color'],
            'contactFormButtonTextColor' => ['group' => 'colors', 'attribute' => 'button_text_color'],
            'contactFormButtonHoverBg' => ['group' => 'colors', 'attribute' => 'button_hover_bg'],
            'contactFormSuccessBgColor' => ['group' => 'colors', 'attribute' => 'success_bg_color'],
            'contactFormSuccessTextColor' => ['group' => 'colors', 'attribute' => 'success_text_color'],
            'contactFormErrorBgColor' => ['group' => 'colors', 'attribute' => 'error_bg_color'],
            'contactFormErrorTextColor' => ['group' => 'colors', 'attribute' => 'error_text_color'],

            // Spacing
            'contactFormSectionPaddingY' => ['group' => 'spacing', 'attribute' => 'section_padding_y'],
            'contactFormSectionMarginTop' => ['group' => 'spacing', 'attribute' => 'section_margin_top'],
            'contactFormTitleMarginBottom' => ['group' => 'spacing', 'attribute' => 'title_margin_bottom'],
            'contactFormDescriptionMarginBottom' => ['group' => 'spacing', 'attribute' => 'description_margin_bottom'],
            'contactFormFormGap' => ['group' => 'spacing', 'attribute' => 'form_gap'],

            // Visual Effects
            'contactFormInputBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'input_border_radius'],
            'contactFormButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
            'contactFormButtonPadding' => ['group' => 'visual_effects', 'attribute' => 'button_padding'],
            'contactFormTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
            'contactFormTextareaRows' => ['group' => 'visual_effects', 'attribute' => 'textarea_rows'],
        ];
    }
}
