<?php
/**
 * 2007-2023 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 *  @author    PrestaShop SA <contact@prestashop.com>
 *  @copyright 2007-2023 PrestaShop SA
 *  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 *  International Registered Trademark & Property of PrestaShop SA
 */

namespace PrestaShop\Module\AgileMultisellerPro\Adapter;

if (!defined('_PS_VERSION_')) {
    exit;
}

class SellerInfoAdapter
{
    const FORM_FIELD_TYPES = [
        'hidden' => 'hidden',
        'text' => 'text',
        'textarea' => 'textarea',
        'number' => 'number',
        'select' => 'select',
        'radio' => 'radio-buttons',
        'checkbox' => 'checkbox',
        'date' => 'date',
        'html' => 'html',
        'countrySelect' => 'countrySelect',
        'label' => 'label',
        'email' => 'email',
        'password' => 'password',
        'image' => 'image',
    ];

    const FORM_FIELD_AVAILABLE_TYPES = [
        'type' => 'type',
        'payment_collection' => 'payment_collection',
        'country' => 'country',
    ];

    public static function getSellerinfoFields()
    {
        $translator = \Context::getContext()->getTranslator();

        return [
            'id_sellerinfo' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('ID', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['hidden'],
                ],
            ],
            'id_country' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Country', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['countrySelect'],
                    'availableValues' => self::FORM_FIELD_AVAILABLE_TYPES['country'],
                    'required' => true,
                ],
            ],
            'id_state' => [
                'validate' => 'isNullOrUnsignedId',
                'label' => $translator->trans('State', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['select'],
                ],
            ],
            'postcode' => [
                'validate' => 'isPostCode',
                'required' => true,
                'label' => $translator->trans('Zip / Postal code', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                    'required' => true,
                ],
            ],
            'phone' => [
                'validate' => 'isPhoneNumber',
                'label' => $translator->trans('Phone', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                ],
            ],
            'fax' => [
                'validate' => 'isPhoneNumber',
                'label' => $translator->trans('Fax', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                ],
            ],
            'latitude' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Latitude', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                ],
            ],
            'longitude' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Longitude', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                ],
            ],
            'active' => [
                'validate' => 'isBool',
                'label' => $translator->trans('Status', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'date_add' => [
                'validate' => 'isDate',
                'label' => $translator->trans('Date add', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'date_upd' => [
                'validate' => 'isDateOrNull',
                'label' => $translator->trans('Date modify', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'id_customer' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Customer', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['hidden'],
                ],
            ],
            'id_manufacturer' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Brand', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['hidden'],
                ],
            ],
            'id_supplier' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Supplier', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['hidden'],
                ],
            ],
            'theme_name' => [
                'validate' => 'isString',
                'label' => $translator->trans('Virtual Shop Theme', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'payment_collection' => [
                'validate' => 'isBool',
                'label' => $translator->trans('Payment Collection', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['select'],
                    'availableValues' => self::FORM_FIELD_AVAILABLE_TYPES['payment_collection'],
                    'required' => true,
                ],
            ],
            'service_zipcodes' => [
                'validate' => 'isString',
                'label' => $translator->trans('Service Area Restrictions', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'service_distance' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Maximum Service Distance', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'dni' => [
                'validate' => 'isString',
                'label' => $translator->trans('Identification', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                ],
            ],
            'id_shop' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Shop', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'id_category_default' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Seller Home Category', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'id_sellertype1' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Primary Type', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['select'],
                    'availableValues' => self::FORM_FIELD_AVAILABLE_TYPES['type'],
                ],
            ],
            'id_sellertype2' => [
                'validate' => 'isUnsignedId',
                'label' => $translator->trans('Secondary Type', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['select'],
                    'availableValues' => self::FORM_FIELD_AVAILABLE_TYPES['type'],
                ],
            ],
            'ams_custom_number1' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number1', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number2' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number2', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number3' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number3', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number4' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number4', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number5' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number5', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number6' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number6', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number7' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number7', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number8' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number8', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number9' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number9', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_number10' => [
                'validate' => 'isFloat',
                'label' => $translator->trans('Number10', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['number'],
                ],
            ],
            'ams_custom_date1' => [
                'validate' => 'isDateOrNull',
                'label' => $translator->trans('Date1', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['date'],
                ],
            ],
            'ams_custom_date2' => [
                'validate' => 'isDateOrNull',
                'label' => $translator->trans('Date2', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['date'],
                ],
            ],
            'ams_custom_date3' => [
                'validate' => 'isDateOrNull',
                'label' => $translator->trans('Date3', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['date'],
                ],
            ],
            'ams_custom_date4' => [
                'validate' => 'isDateOrNull',
                'label' => $translator->trans('Date4', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['date'],
                ],
            ],
            'ams_custom_date5' => [
                'validate' => 'isDateOrNull',
                'label' => $translator->trans('Date5', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['date'],
                ],
            ],
            'ams_custom_string1' => [
                'validate' => 'isString',
                'label' => $translator->trans('String1', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string2' => [
                'validate' => 'isString',
                'label' => $translator->trans('String2', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string3' => [
                'validate' => 'isString',
                'label' => $translator->trans('String3', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string4' => [
                'validate' => 'isString',
                'label' => $translator->trans('String4', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string5' => [
                'validate' => 'isString',
                'label' => $translator->trans('String5', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string6' => [
                'validate' => 'isString',
                'label' => $translator->trans('String6', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string7' => [
                'validate' => 'isString',
                'label' => $translator->trans('String7', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string8' => [
                'validate' => 'isString',
                'label' => $translator->trans('String8', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string9' => [
                'validate' => 'isString',
                'label' => $translator->trans('String9', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string10' => [
                'validate' => 'isString',
                'label' => $translator->trans('String10', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string11' => [
                'validate' => 'isString',
                'label' => $translator->trans('String11', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string12' => [
                'validate' => 'isString',
                'label' => $translator->trans('String12', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string13' => [
                'validate' => 'isString',
                'label' => $translator->trans('String13', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string14' => [
                'validate' => 'isString',
                'label' => $translator->trans('String14', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],
            'ams_custom_string15' => [
                'validate' => 'isString',
                'label' => $translator->trans('String15', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
            ],

            // Langs fields
            'company' => [
                'lang' => true,
                'validate' => 'isString',
                'required' => true,
                'label' => $translator->trans('Company', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                    'required' => true,
                ],
            ],
            'description' => [
                'lang' => true,
                'validate' => 'isCleanHtml',
                'label' => $translator->trans('Description', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                    'required' => false,
                    'maxLength' => 400,
                ],
            ],
            'address1' => [
                'lang' => true,
                'validate' => 'isAddress',
                'required' => true,
                'label' => $translator->trans('Address', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                    'required' => true,
                ],
            ],
            'address2' => [
                'lang' => true,
                'validate' => 'isAddress',
                'label' => $translator->trans('Address (Line 2)', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                    'required' => false,
                ],
            ],
            'city' => [
                'lang' => true,
                'validate' => 'isCityName',
                'required' => true,
                'label' => $translator->trans('City', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['text'],
                    'required' => true,
                ],
            ],
            'ams_custom_text1' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text1', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text2' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text2', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text3' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text3', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text4' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text4', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text5' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text5', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text6' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text6', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text7' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text7', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text8' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text8', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text9' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text9', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_text10' => [
                'lang' => true,
                'validate' => 'isString',
                'label' => $translator->trans('Text9', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['textarea'],
                ],
            ],
            'ams_custom_html1' => [
                'lang' => true,
                'validate' => 'isCleanHtml',
                'label' => $translator->trans('Html1', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['html'],
                ],
            ],
            'ams_custom_html2' => [
                'lang' => true,
                'validate' => 'isCleanHtml',
                'label' => $translator->trans('Html2', [], 'Modules.Agilemultisellerpro.Sellerinfo'),
                'formOptions' => [
                    'type' => self::FORM_FIELD_TYPES['html'],
                ],
            ],
        ];
    }
}
