<?php

namespace iwbvel\classes\repositories;

use iwbvel\classes\helpers\Operator;

defined('ABSPATH') || exit();

class EditFormItems
{
    public static function general_tab()
    {
        return [
            'title' => [
                'name' => 'title',
                'id' => 'title',
                'label' => esc_html__('Product title', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_text(),
                'field_type' => 'text',
                'placeholder' => esc_html__('Product title', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => true
            ],
            'slug' => [
                'name' => 'slug',
                'id' => 'slug',
                'label' => esc_html__('Product slug', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_text(),
                'field_type' => 'text',
                'placeholder' => esc_html__('Product slug', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => true
            ],
            'sku' => [
                'name' => 'sku',
                'id' => 'sku',
                'label' => esc_html__('Product SKU', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_text(),
                'field_type' => 'text',
                'placeholder' => esc_html__('Product SKU', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => true
            ],
            'description' => [
                'name' => 'description',
                'id' => 'description',
                'label' => esc_html__('Description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_text(),
                'field_type' => 'text',
                'placeholder' => esc_html__('Description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => true
            ],
            'short_description' => [
                'name' => 'short_description',
                'id' => 'short-description',
                'label' => esc_html__('Short description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_text(),
                'field_type' => 'textarea',
                'placeholder' => esc_html__('Short description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => true
            ],
            'purchase_note' => [
                'name' => 'purchase_note',
                'id' => 'purchase-note',
                'label' => esc_html__('Purchase note', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_text(),
                'field_type' => 'text',
                'placeholder' => esc_html__('Purchase note', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => true
            ],
            'menu_order' => [
                'name' => 'menu_order',
                'id' => 'menu-order',
                'label' => esc_html__('Menu order', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_number(),
                'field_type' => 'number',
                'placeholder' => esc_html__('Menu order', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'pos_product_visibility' => [
                'name' => 'pos_product_visibility',
                'id' => 'pos-product-visibility',
                'label' => esc_html__('Available for POS', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ]
            ],
            'sold_individually' => [
                'name' => 'sold_individually',
                'id' => 'sold-individually',
                'label' => esc_html__('Sold individually', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ]
            ],
            'reviews_allowed' => [
                'name' => 'reviews_allowed',
                'id' => 'enable-reviews',
                'label' => esc_html__('Enable reviews', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'disabled' => true
            ],
            'status' => [
                'name' => 'status',
                'id' => 'status',
                'label' => esc_html__('Product status', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'no_default_option' => false
            ],
            'catalog_visibility' => [
                'name' => 'catalog_visibility',
                'id' => 'catalog-visibility',
                'label' => esc_html__('Catalog visibility', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'no_default_option' => false
            ],
            'date_created' => [
                'name' => 'date_created',
                'id' => 'date-created',
                'class' => 'iwbvel-input-md iwbvel-datepicker',
                'label' => esc_html__('Date', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'date',
                'data_to_id' => '',
                'placeholder' => esc_html__('Date', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'post_author' => [
                'name' => 'post_author',
                'id' => 'author',
                'label' => esc_html__('Author', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'wp_posts_field',
                'operators' => [],
                'field_type' => 'user_select',
                'select2' => true
            ],
            'image_id' => [
                'name' => 'image_id',
                'label' => esc_html__('Image', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'image_upload',
                'upload_type' => 'single'
            ],
            'gallery_image_ids' => [
                'name' => 'gallery_image_ids',
                'label' => esc_html__('Gallery', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'image_upload',
                'upload_type' => 'multiple',
                'disabled' => true
            ]
        ];
    }

    public static function taxonomies_tab()
    {
        return [
            'taxonomy' => [
                'name' => 'taxonomy',
                'label' => esc_html__('Taxonomy', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'taxonomy',
                'operators' => Operator::edit_taxonomy(),
                'field_type' => 'taxonomy_group',
                'disabled' => true,
                'is_taxonomy_group' => true
            ],
            'attribute' => [
                'name' => 'attribute',
                'label' => esc_html__('Attribute', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'taxonomy',
                'operators' => Operator::edit_taxonomy(),
                'field_type' => 'attribute_group',
                'disabled' => true,
                'is_attribute_group' => true,
                'attribute_fields' => [
                    'is_visible' => [
                        'label' => esc_html__('Visible on Product Page', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                        'options' => [
                            '' => esc_html__('Current Value', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                            'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                            'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                        ]
                    ],
                    'used_for_variations' => [
                        'label' => esc_html__('Used for variations', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                        'options' => [
                            '' => esc_html__('Current Value', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                            'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                            'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                        ]
                    ]
                ]
            ]
        ];
    }
    public static function pricing_tab()
    {
        return [
            'regular_price' => [
                'name' => 'regular_price',
                'id' => 'regular-price',
                'label' => esc_html__('Regular price', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => array_merge(Operator::edit_number(), Operator::edit_regular_price()),
                'field_type' => 'price',
                'placeholder' => esc_html__('Regular price', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'has_rounding' => true,
                'formula_note' => true
            ],
            'sale_price' => [
                'name' => 'sale_price',
                'id' => 'sale-price',
                'label' => esc_html__('Sale price', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => array_merge(Operator::edit_number(), Operator::edit_sale_price()),
                'field_type' => 'price',
                'placeholder' => esc_html__('Sale price', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'has_rounding' => true,
                'formula_note' => true
            ],
            'date_on_sale_from' => [
                'name' => 'date_on_sale_from',
                'id' => 'sale-date-from',
                'class' => 'iwbvel-input-md iwbvel-datepicker iwbvel-date-from',
                'label' => esc_html__('Sale date from', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'date',
                'placeholder' => esc_html__('Sale date from', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'data_to_id' => 'iwbvel-bulk-edit-form-sale-date-to'

            ],
            'date_on_sale_to' => [
                'name' => 'date_on_sale_to',
                'id' => 'sale-date-to',
                'class' => 'iwbvel-input-md iwbvel-datepicker',
                'label' => esc_html__('Sale date to', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'date',
                'placeholder' => esc_html__('Sale date to', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'data_to_id' => '',
                'disabled' => true
            ],
            'tax_status' => [
                'name' => 'tax_status',
                'id' => 'tax-status',
                'label' => esc_html__('Tax status', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'taxable' => esc_html__('Taxable', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'shipping' => esc_html__('Shipping Only', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'none' => esc_html__('None', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'disabled' => true
            ],
            'tax_class' => [
                'name' => 'tax_class',
                'id' => 'tax-class',
                'label' => esc_html__('Tax class', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'disabled' => true
            ]
        ];
    }
    public static function shipping_tab()
    {
        return [];
    }
    public static function stock_tab()
    {
        return [
            'manage_stock' => [
                'name' => 'manage_stock',
                'id' => 'manage-stock',
                'label' => esc_html__('Manage stock', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'no_default_option' => false,
                'variable' => false
            ],
            'stock_status' => [
                'name' => 'stock_status',
                'id' => 'stock-status',
                'label' => esc_html__('Stock status', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => wc_get_product_stock_status_options(),
                'no_default_option' => false,
                'disabled' => true,
                'variable' => false
            ],
            'stock_quantity' => [
                'name' => 'stock_quantity',
                'id' => 'stock-quantity',
                'label' => esc_html__('Stock quantity', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder' => esc_html__('Set Number', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_number(),
                'field_type' => 'number',
                'variable' => false
            ],
            'backorders' => [
                'name' => 'backorders',
                'id' => 'backorders',
                'label' => esc_html__('Allow backorders', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => wc_get_product_backorder_options(),
                'no_default_option' => false,
                'disabled' => true,
                'variable' => false
            ]
        ];
    }
    public static function type_tab()
    {
        return [
            'product_type' => [
                'name' => 'product_type',
                'id' => 'product-type',
                'label' => esc_html__('Product type', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => wc_get_product_types(),
                'no_default_option' => false,
                'disabled' => true,
                'variable' => false
            ],
            'featured' => [
                'name' => 'featured',
                'id' => 'featured',
                'label' => esc_html__('Featured', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'no_default_option' => false,
                'variable' => false
            ],
            'virtual' => [
                'name' => 'virtual',
                'id' => 'virtual',
                'label' => esc_html__('Virtual', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'no_default_option' => false,
                'disabled' => true,
                'variable' => false
            ],
            'downloadable' => [
                'name' => 'downloadable',
                'id' => 'downloadable',
                'label' => esc_html__('Downloadable', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => [],
                'field_type' => 'select',
                'options' => [
                    '' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'no_default_option' => false,
                'disabled' => true,
                'variable' => false
            ],
            'download_limit' => [
                'name' => 'download_limit',
                'id' => 'download-limit',
                'label' => esc_html__('Download limit', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_number(),
                'field_type' => 'number',
                'placeholder' => esc_html__('Download limit', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => false
            ],
            'download_expiry' => [
                'name' => 'download_expiry',
                'id' => 'download-expiry',
                'label' => esc_html__('Download expiry', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_number(),
                'field_type' => 'number',
                'placeholder' => esc_html__('Download expiry', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => false
            ],
            '_product_url' => [
                'name' => '_product_url',
                'id' => 'product-url',
                'label' => esc_html__('Product url', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'meta_field',
                'operators' => [],
                'field_type' => 'text',
                'placeholder' => esc_html__('Product url', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true,
                'variable' => false
            ],
            '_button_text' => [
                'name' => '_button_text',
                'id' => 'button-text',
                'label' => esc_html__('Button text', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'meta_field',
                'operators' => [],
                'field_type' => 'text',
                'placeholder' => esc_html__('Button text', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false
            ],

            'upsell_ids' => [
                'name' => 'upsell_ids',
                'id' => 'iwbvel-bulk-edit-form-upsells',
                'class' => 'iwbvel-get-products-ajax iwbvel-select2-item',
                'label' => esc_html__('Upsells', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_taxonomy(),
                'field_type' => 'upsell_crosssell',
                'select2' => true,
                'multiple' => true,
                'variable' => false,
            ],
            'cross_sell_ids' => [
                'name' => 'cross_sell_ids',
                'id' => 'iwbvel-bulk-edit-form-cross-sells',
                'class' => 'iwbvel-get-products-ajax iwbvel-select2-item',
                'label' => esc_html__('Cross-Sells', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'update_type' => 'woocommerce_field',
                'operators' => Operator::edit_taxonomy(),
                'field_type' => 'upsell_crosssell',
                'select2' => true,
                'multiple' => true,
                'variable' => false,
            ]
        ];
    }
}
