<?php

namespace ThemesflatAddons\i18n;

use WPML_Elementor_Module_With_Items;

if (class_exists('WPML_Elementor_Module_With_Items')) {
    /**
     * Class TFL_WPML_Pricing_Table
     */
    class TFL_WPML_Pricing_Table extends WPML_Elementor_Module_With_Items {

        /**
         * @return string
         */
        public function get_items_field() {
            return 'pricing_plans';
        }

        /**
         * @return array
         */
        public function get_fields() {
            return array('pricing_title', 'tagline', 'price_tag', 'pricing_content', 'button_text', 'button_url' => array('url'));
        }

        /**
         * @param string $field
         *
         * @return string
         */
        protected function get_title($field) {
            switch ($field) {
                case 'pricing_title':
                    return esc_html__('Pricing: Title', 'themesflat');

                case 'tagline':
                    return esc_html__('Pricing: Tagline', 'themesflat');

                case 'price_tag':
                    return esc_html__('Pricing: Price Tag', 'themesflat');

                case 'button_text':
                    return esc_html__('Pricing: Button Text', 'themesflat');

                case 'url':
                    return esc_html__('Pricing: Button URL', 'themesflat');

                case 'pricing_content':
                    return esc_html__('Pricing: Content', 'themesflat');

                default:
                    return '';
            }
        }

        /**
         * @param string $field
         *
         * @return string
         */
        protected function get_editor_type($field) {
            switch ($field) {
                case 'pricing_title':
                case 'tagline':
                case 'price_tag':
                case 'button_text':
                    return 'LINE';

                case 'pricing_content':
                    return 'AREA';

                case 'url':
                    return 'LINK';

                default:
                    return '';
            }
        }

    }

}