<?php

namespace  WPT\Cf7Divi\Divi5\Conversion;

class Conversion
{
    protected $container;

    public function __construct($container)
    {
        $this->container = $container;
    }

    /**
     * Conversion map
     */
    public function map($map)
    {
        $moduleName = 'd5-wpt-divi-contact-form7/contact-form7';

        if (isset($map[$moduleName])) {
            $attrMap = $map[$moduleName]['attributeMap'];

            $functionMap = $map[$moduleName]['valueExpansionFunctionMap'] ?? [];
            $convertSpacingFunction = '\ET\Builder\Packages\Conversion\AdvancedOptionConversion::convertSpacing';

            $functionMap['row_custom_padding'] = $convertSpacingFunction;
            $functionMap['row_custom_margin'] = $convertSpacingFunction;
            $functionMap['column_custom_padding'] = $convertSpacingFunction;
            $functionMap['column_custom_margin'] = $convertSpacingFunction;
            $functionMap['label_custom_padding'] = $convertSpacingFunction;
            $functionMap['label_custom_margin'] = $convertSpacingFunction;
            $functionMap['text_select_custom_padding'] = $convertSpacingFunction;
            $functionMap['text_select_custom_margin'] = $convertSpacingFunction;
            $functionMap['radio_checkbox_options_custom_padding'] = $convertSpacingFunction;
            $functionMap['radio_checkbox_options_custom_margin'] = $convertSpacingFunction;
            $functionMap['field_error_custom_padding'] = $convertSpacingFunction;
            $functionMap['field_error_custom_margin'] = $convertSpacingFunction;
            $functionMap['form_error_custom_padding'] = $convertSpacingFunction;
            $functionMap['form_error_custom_margin'] = $convertSpacingFunction;
            $functionMap['form_success_custom_padding'] = $convertSpacingFunction;
            $functionMap['form_success_custom_margin'] = $convertSpacingFunction;


            $map[$moduleName]['valueExpansionFunctionMap'] = $functionMap;
            $map[$moduleName]['attributeMap'] = $attrMap;
        }

        return $map;
    }
}
