<?php
declare(strict_types=1);

namespace ROITheme\Admin\SocialShare\Infrastructure\FieldMapping;

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

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

    public function getFieldMapping(): array
    {
        return [
            // Visibility
            'socialShareEnabled' => ['group' => 'visibility', 'attribute' => 'is_enabled'],
            'socialShareShowOnDesktop' => ['group' => 'visibility', 'attribute' => 'show_on_desktop'],
            'socialShareShowOnMobile' => ['group' => 'visibility', 'attribute' => 'show_on_mobile'],

            // Page Visibility (grupo especial _page_visibility)
            'socialShareVisibilityHome' => ['group' => '_page_visibility', 'attribute' => 'show_on_home'],
            'socialShareVisibilityPosts' => ['group' => '_page_visibility', 'attribute' => 'show_on_posts'],
            'socialShareVisibilityPages' => ['group' => '_page_visibility', 'attribute' => 'show_on_pages'],
            'socialShareVisibilityArchives' => ['group' => '_page_visibility', 'attribute' => 'show_on_archives'],
            'socialShareVisibilitySearch' => ['group' => '_page_visibility', 'attribute' => 'show_on_search'],

            // Exclusions (grupo especial _exclusions - Plan 99.11)
            'socialShareExclusionsEnabled' => ['group' => '_exclusions', 'attribute' => 'exclusions_enabled'],
            'socialShareExcludeCategories' => ['group' => '_exclusions', 'attribute' => 'exclude_categories', 'type' => 'json_array'],
            'socialShareExcludePostIds' => ['group' => '_exclusions', 'attribute' => 'exclude_post_ids', 'type' => 'json_array_int'],
            'socialShareExcludeUrlPatterns' => ['group' => '_exclusions', 'attribute' => 'exclude_url_patterns', 'type' => 'json_array_lines'],

            // Content
            'socialShareShowLabel' => ['group' => 'content', 'attribute' => 'show_label'],
            'socialShareLabelText' => ['group' => 'content', 'attribute' => 'label_text'],

            // Networks
            'socialShareFacebook' => ['group' => 'networks', 'attribute' => 'show_facebook'],
            'socialShareFacebookUrl' => ['group' => 'networks', 'attribute' => 'facebook_url'],
            'socialShareInstagram' => ['group' => 'networks', 'attribute' => 'show_instagram'],
            'socialShareInstagramUrl' => ['group' => 'networks', 'attribute' => 'instagram_url'],
            'socialShareLinkedin' => ['group' => 'networks', 'attribute' => 'show_linkedin'],
            'socialShareLinkedinUrl' => ['group' => 'networks', 'attribute' => 'linkedin_url'],
            'socialShareWhatsapp' => ['group' => 'networks', 'attribute' => 'show_whatsapp'],
            'socialShareWhatsappNumber' => ['group' => 'networks', 'attribute' => 'whatsapp_number'],
            'socialShareTwitter' => ['group' => 'networks', 'attribute' => 'show_twitter'],
            'socialShareTwitterUrl' => ['group' => 'networks', 'attribute' => 'twitter_url'],
            'socialShareEmail' => ['group' => 'networks', 'attribute' => 'show_email'],
            'socialShareEmailAddress' => ['group' => 'networks', 'attribute' => 'email_address'],

            // Colors
            'socialShareLabelColor' => ['group' => 'colors', 'attribute' => 'label_color'],
            'socialShareBorderTopColor' => ['group' => 'colors', 'attribute' => 'border_top_color'],
            'socialShareButtonBg' => ['group' => 'colors', 'attribute' => 'button_background'],
            'socialShareFacebookColor' => ['group' => 'colors', 'attribute' => 'facebook_color'],
            'socialShareInstagramColor' => ['group' => 'colors', 'attribute' => 'instagram_color'],
            'socialShareLinkedinColor' => ['group' => 'colors', 'attribute' => 'linkedin_color'],
            'socialShareWhatsappColor' => ['group' => 'colors', 'attribute' => 'whatsapp_color'],
            'socialShareTwitterColor' => ['group' => 'colors', 'attribute' => 'twitter_color'],
            'socialShareEmailColor' => ['group' => 'colors', 'attribute' => 'email_color'],

            // Typography
            'socialShareLabelFontSize' => ['group' => 'typography', 'attribute' => 'label_font_size'],
            'socialShareIconFontSize' => ['group' => 'typography', 'attribute' => 'icon_font_size'],

            // Spacing
            'socialShareMarginTop' => ['group' => 'spacing', 'attribute' => 'container_margin_top'],
            'socialShareMarginBottom' => ['group' => 'spacing', 'attribute' => 'container_margin_bottom'],
            'socialSharePaddingTop' => ['group' => 'spacing', 'attribute' => 'container_padding_top'],
            'socialSharePaddingBottom' => ['group' => 'spacing', 'attribute' => 'container_padding_bottom'],
            'socialShareLabelMarginBottom' => ['group' => 'spacing', 'attribute' => 'label_margin_bottom'],
            'socialShareButtonsGap' => ['group' => 'spacing', 'attribute' => 'buttons_gap'],
            'socialShareButtonPadding' => ['group' => 'spacing', 'attribute' => 'button_padding'],

            // Visual Effects
            'socialShareBorderTopWidth' => ['group' => 'visual_effects', 'attribute' => 'border_top_width'],
            'socialShareButtonBorderWidth' => ['group' => 'visual_effects', 'attribute' => 'button_border_width'],
            'socialShareButtonBorderRadius' => ['group' => 'visual_effects', 'attribute' => 'button_border_radius'],
            'socialShareTransitionDuration' => ['group' => 'visual_effects', 'attribute' => 'transition_duration'],
            'socialShareHoverBoxShadow' => ['group' => 'visual_effects', 'attribute' => 'hover_box_shadow'],
        ];
    }
}
