<?php

namespace iwbvel\classes\repositories;

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

use iwbvel\classes\helpers\Operator;

class FilterFormItems
{
    public static function general_tab()
    {
        return [
            'product_ids' => [
                'name' => 'product_ids',
                'id' => 'ids',
                'label' => esc_html__('Product ID(s)', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_ids',
                'field_type' => 'text',
                'operators' => [
                    'exact' => esc_html__('Exact', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'placeholder' => esc_html__('for example: 1,2,3 or 1-10 or 1,2,3|10-20', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => false,
            ],
            'product_title' => [
                'name' => 'product_title',
                'id' => 'title',
                'label' => esc_html__('Product title', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_title',
                'field_type' => 'text',
                'operators' => Operator::filter_text(),
                'placeholder' => esc_html__('Product title', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => false,
            ],
            'product_content' => [
                'name' => 'product_content',
                'id' => 'content',
                'label' => esc_html__('Description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_content',
                'field_type' => 'text',
                'operators' => Operator::filter_text(),
                'placeholder' => esc_html__('Description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => false,
            ],
            'product_excerpt' => [
                'name' => 'product_excerpt',
                'id' => 'excerpt',
                'label' => esc_html__('Short description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_excerpt',
                'field_type' => 'textarea',
                'operators' => Operator::filter_text(),
                'placeholder' => esc_html__('Short description', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => true,
            ],
            'product_slug' => [
                'name' => 'product_slug',
                'id' => 'slug',
                'label' => esc_html__('Product slug', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_slug',
                'field_type' => 'text',
                'operators' => Operator::filter_text(),
                'placeholder' => esc_html__('Product slug', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => true,
            ],
            'product_sku' => [
                'name' => 'product_sku',
                'id' => 'sku',
                'label' => esc_html__('Product SKU', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_sku',
                'field_type' => 'text',
                'operators' => Operator::filter_text(),
                'placeholder' => esc_html__('Product SKU', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => true,
            ],
            'product_url' => [
                'name' => 'product_url',
                'id' => 'url',
                'label' => esc_html__('Product url', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_url',
                'field_type' => 'text',
                'operators' => Operator::filter_text(),
                'placeholder' => esc_html__('Product url', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => true,
            ],
            'date_created' => [
                'name' => 'date_created',
                'id' => 'date-created',
                'label' => esc_html__('Product date', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'date_created',
                'field_type' => 'from_to_date',
                'operators' => [], // No operators for date range
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => true,
            ],
        ];
    }

    public static function taxonomies_tab()
    {
        return [
            'taxonomy_section' => [
                'name' => 'taxonomy_section',
                'label' => esc_html__('Taxonomy', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => '',
                'field_type' => '',
                'variable' => false,
                'disabled' => true,
            ],
            'attribute_section' => [
                'name' => 'attribute_section',
                'label' => esc_html__('Attribute', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => '',
                'field_type' => '',
                'variable' => false,
                'disabled' => true,
            ],
        ];
    }

    public static function pricing_tab()
    {
        return [
            'regular_price' => [
                'name' => 'regular-price',
                'id' => 'iwbvel-filter-form-product-regular-price',
                'label' => esc_html__('Regular price', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'regular_price',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => false,
            ],
            'sale_price' => [
                'name' => 'sale-price',
                'id' => 'iwbvel-filter-form-product-sale-price',
                'label' => esc_html__('Sale price', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'sale_price',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => false,
            ],
            'date_on_sale_from' => [
                'name' => 'date-on-sale-from',
                'id' => 'sale-price-date',
                'class' => 'iwbvel-input-md iwbvel-datepicker iwbvel-date-from',
                'label' => esc_html__('Sale date from', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => '',
                'field_type' => 'date',
                'placeholder' => esc_html__('Sale date from', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'date_range' => true,
                'variable' => false,
                'disabled' => true,
            ],
            'date_on_sale_to' => [
                'name' => 'date-on-sale-to',
                'id' => 'sale-price-date',
                'class' => 'iwbvel-input-md iwbvel-datepicker',
                'label' => esc_html__('Sale date to', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => '',
                'field_type' => 'date',
                'placeholder' => esc_html__('Sale date to', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'variable' => false,
                'disabled' => true,
            ],
        ];
    }

    public static function shipping_tab()
    {
        return [
            'shipping_class' => [
                'name' => 'shipping_class',
                'id' => 'shipping-class',
                'label' => esc_html__('Shipping Class', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'shipping_class',
                'field_type' => 'select',
                'options' => [],
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'width' => [
                'name' => 'width',
                'id' => 'iwbvel-filter-form-product-width',
                'label' => esc_html__('Width', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'width',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'height' => [
                'name' => 'height',
                'id' => 'iwbvel-filter-form-product-height',
                'label' => esc_html__('Height', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'height',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'length' => [
                'name' => 'length',
                'id' => 'iwbvel-filter-form-product-length',
                'label' => esc_html__('Length', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'length',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'weight' => [
                'name' => 'weight',
                'id' => 'iwbvel-filter-form-product-width',
                'label' => esc_html__('Weight', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'weight',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ]
        ];
    }
    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'),
                'filter_type' => 'manage_stock',
                'field_type' => 'select',
                'options' => Operator::get_current_value(),
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'stock_quantity' => [
                'name' => 'stock_quantity',
                'id' => 'iwbvel-filter-form-stock-quantity',
                'label' => esc_html__('Stock quantity', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'stock_quantity',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'stock_status' => [
                'name' => 'stock_status',
                'id' => 'stock-status',
                'label' => esc_html__('Stock status', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'stock_status',
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ],
            'backorders' => [
                'name' => 'backorders',
                'id' => 'backorders',
                'label' => esc_html__('Allow backorders', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'backorders',
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ]
        ];
    }

    public static function type_tab()
    {
        return [
            'product_type' => [
                'name' => 'product_type',
                'id' => 'type',
                'label' => esc_html__('Product type', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_type',
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'product_status' => [
                'name' => 'status',
                'id' => 'status',
                'label' => esc_html__('Product status', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'product_status',
                'field_type' => 'select',
                'options' => [], // Will be filled from controller
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce')
            ],
            'featured' => [
                'name' => 'featured',
                'id' => 'featured',
                'label' => esc_html__('Featured', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'featured',
                'field_type' => 'select',
                'options' => [
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ],
            'downloadable' => [
                'name' => 'downloadable',
                'id' => 'downloadable',
                'label' => esc_html__('Downloadable', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'downloadable',
                'field_type' => 'select',
                'options' => Operator::get_current_value(),
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ],
            'sold_individually' => [
                'name' => 'sold_individually',
                'id' => 'downloadable',
                'label' => esc_html__('Sold individually', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'sold_individually',
                'field_type' => 'select',
                'options' => [
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ],
            'author' => [
                'name' => 'author',
                'id' => 'author',
                'label' => esc_html__('By author', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'author',
                'field_type' => 'user_select',
                'select2' => true
            ],
            'visibility' => [
                'name' => 'visibility',
                'id' => 'visibility',
                'label' => esc_html__('Catalog visibility', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'catalog_visibility',
                'field_type' => 'select',
                'options' => [],
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ],
            'menu_order' => [
                'name' => 'menu-order',
                'id' => 'iwbvel-filter-form-product-menu-order',
                'label' => esc_html__('Menu order', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'menu_order',
                'field_type' => 'from_to_number',
                'placeholder_from' => esc_html__('From', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'placeholder_to' => esc_html__('To', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => true
            ],
            'pos_product_visibility' => [
                'name' => 'pos_product_visibility',
                'id' => 'iwbvel-filter-form-pos-product-visibility',
                'label' => esc_html__('Available for POS', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'filter_type' => 'pos_product_visibility',
                'field_type' => 'select',
                'options' => [
                    'yes' => esc_html__('Yes', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                    'no' => esc_html__('No', 'ithemeland-bulk-variation-editing-for-woocommerce')
                ],
                'first_option' => esc_html__('Select', 'ithemeland-bulk-variation-editing-for-woocommerce'),
                'disabled' => false
            ]
        ];
    }
}
