<?php

namespace Devnet\EBC\Admin;

use Devnet\EBC\Includes\Defaults;

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

class Options
{

    public static function general()
    {
        $general = [
            [
                'type'    => 'checkbox',
                'name'    => 'multilingual',
                'label'   => esc_html__('Multilingual', 'easy-booking-calendar'),
                'desc'    => esc_html__('Use your own translated strings.', 'easy-booking-calendar'),
                'default' => Defaults::general('multilingual')
            ],
            [
                'type'    => 'checkbox',
                'name'    => 'only_logged_users',
                'label'   => esc_html__('Show only for logged in users', 'easy-booking-calendar'),
                'default' => Defaults::general('only_logged_users')
            ],
            [
                'type'    => 'checkbox',
                'name'    => 'delete_plugin_data',
                'label'   => esc_html__('Delete all plugin data on uninstall', 'easy-booking-calendar'),
                'desc'    => esc_html__('Enabling this option will ensure that all data associated with the plugin, including settings and all booked dates, will be completely removed from the database upon uninstallation of the plugin.', 'easy-booking-calendar'),
                'default' => Defaults::general('delete_plugin_data')
            ]
        ];

        return apply_filters('devnet_ebc_settings_general', $general);
    }

    public static function calendar()
    {
        $calendar = [
            [
                'type'    => 'select',
                'name'    => 'locale',
                'label'   => esc_html__('Locale', 'easy-booking-calendar'),
                'options' => [
                    'ar'      => esc_html__('Arabic', 'easy-booking-calendar'),
                    'at'      => esc_html__('Austria', 'easy-booking-calendar'),
                    'az'      => esc_html__('Azerbaijani', 'easy-booking-calendar'),
                    'be'      => esc_html__('Belarusian', 'easy-booking-calendar'),
                    'bg'      => esc_html__('Bulgarian', 'easy-booking-calendar'),
                    'bn'      => esc_html__('Bengali', 'easy-booking-calendar'),
                    'bs'      => esc_html__('Bosnian', 'easy-booking-calendar'),
                    'ca'      => esc_html__('Catalan', 'easy-booking-calendar'),
                    'ckb'     => esc_html__('Sorani Kurdish', 'easy-booking-calendar'),
                    'cat'     => esc_html__('Catalan', 'easy-booking-calendar'),
                    'cs'      => esc_html__('Czech', 'easy-booking-calendar'),
                    'cy'      => esc_html__('Welsh', 'easy-booking-calendar'),
                    'da'      => esc_html__('Danish', 'easy-booking-calendar'),
                    'de'      => esc_html__('German', 'easy-booking-calendar'),
                    'default' => esc_html__('English', 'easy-booking-calendar'),
                    'eo'      => esc_html__('Esperanto', 'easy-booking-calendar'),
                    'es'      => esc_html__('Spanish', 'easy-booking-calendar'),
                    'et'      => esc_html__('Estonian', 'easy-booking-calendar'),
                    'fa'      => esc_html__('Persian', 'easy-booking-calendar'),
                    'fi'       => esc_html__('Finnish', 'easy-booking-calendar'),
                    'fo'      => esc_html__('Faroese', 'easy-booking-calendar'),
                    'fr'      => esc_html__('French', 'easy-booking-calendar'),
                    'gr'      => esc_html__('Greek', 'easy-booking-calendar'),
                    'he'      => esc_html__('Hebrew', 'easy-booking-calendar'),
                    'hi'      => esc_html__('Hindi', 'easy-booking-calendar'),
                    'hr'      => esc_html__('Croatian', 'easy-booking-calendar'),
                    'hu'      => esc_html__('Hungarian', 'easy-booking-calendar'),
                    'hy'      => esc_html__('Armenian', 'easy-booking-calendar'),
                    'id'      => esc_html__('Indonesian', 'easy-booking-calendar'),
                    'is'      => esc_html__('Icelandic', 'easy-booking-calendar'),
                    'it'      => esc_html__('Italian', 'easy-booking-calendar'),
                    'ja'      => esc_html__('Japanese', 'easy-booking-calendar'),
                    'ka'      => esc_html__('Georgian', 'easy-booking-calendar'),
                    'ko'      => esc_html__('Korean', 'easy-booking-calendar'),
                    'km'      => esc_html__('Khmer', 'easy-booking-calendar'),
                    'kz'      => esc_html__('Kazakh', 'easy-booking-calendar'),
                    'lt'      => esc_html__('Lithuanian', 'easy-booking-calendar'),
                    'lv'      => esc_html__('Latvian', 'easy-booking-calendar'),
                    'mk'      => esc_html__('Macedonian', 'easy-booking-calendar'),
                    'mn'      => esc_html__('Mongolian', 'easy-booking-calendar'),
                    'ms'      => esc_html__('Malay', 'easy-booking-calendar'),
                    'my'      => esc_html__('Burmese', 'easy-booking-calendar'),
                    'nl'      => esc_html__('Dutch', 'easy-booking-calendar'),
                    'nn'      => esc_html__('Norwegian Nynorsk', 'easy-booking-calendar'),
                    'no'      => esc_html__('Norwegian', 'easy-booking-calendar'),
                    'pa'      => esc_html__('Punjabi', 'easy-booking-calendar'),
                    'pl'      => esc_html__('Polish', 'easy-booking-calendar'),
                    'pt'      => esc_html__('Portuguese', 'easy-booking-calendar'),
                    'ro'      => esc_html__('Romanian', 'easy-booking-calendar'),
                    'ru'      => esc_html__('Russian', 'easy-booking-calendar'),
                    'si'      => esc_html__('Sinhala', 'easy-booking-calendar'),
                    'sk'      => esc_html__('Slovak', 'easy-booking-calendar'),
                    'sl'      => esc_html__('Slovenian', 'easy-booking-calendar'),
                    'sq'      => esc_html__('Albanian', 'easy-booking-calendar'),
                    'sr'      => esc_html__('Serbian', 'easy-booking-calendar'),
                    'sv'      => esc_html__('Swedish', 'easy-booking-calendar'),
                    'th'      => esc_html__('Thai', 'easy-booking-calendar'),
                    'tr'      => esc_html__('Turkish', 'easy-booking-calendar'),
                    'uk'      => esc_html__('Ukrainian', 'easy-booking-calendar'),
                    'vn'      => esc_html__('Vietnamese', 'easy-booking-calendar'),
                    'zh'      => esc_html__('Chinese (Simplified)', 'easy-booking-calendar'),
                    'zh_tw'   => esc_html__('Chinese (Traditional)', 'easy-booking-calendar'),
                    'uz'      => esc_html__('Uzbek', 'easy-booking-calendar'),
                    'uz_latn' => esc_html__('Uzbek (Latin)', 'easy-booking-calendar')
                ],

                'default' => Defaults::calendar('locale')
            ],
            [
                'type'    => 'select',
                'name'    => 'date_format',
                'label'   => esc_html__('Date format', 'easy-booking-calendar'),
                'options' => [
                    'Y-m-d' => '2024-01-31', // ISO 8601 format
                    'm/d/Y' => '01/31/2024', // US format
                    'd/m/Y' => '31/01/2024', // European format
                    'd-m-Y' => '31-01-2024', // Dash-separated format
                    'd.m.Y' => '31.01.2024', // Dot-separated format
                    'F j, Y' => 'January 31, 2024' // Full date format
                ],
                'default' => Defaults::calendar('date_format')
            ],
            [
                'type'    => 'checkbox',
                'name'    => 'open',
                'label'   => esc_html__('Initially open', 'easy-booking-calendar'),
                'default' => Defaults::calendar('open')
            ],
            [
                'type'    => 'text',
                'name'    => 'title',
                'label'   => esc_html__('Title', 'easy-booking-calendar'),
                'default' => Defaults::calendar('title')
            ],
            [
                'type'    => 'select',
                'name'    => 'theme',
                'label'   => esc_html__('Theme', 'easy-booking-calendar'),
                'options' => [
                    ''                => esc_html__('Default', 'easy-booking-calendar'),
                    'dark'            => esc_html__('Dark', 'easy-booking-calendar'),
                    'material_blue'   => esc_html__('Material Blue', 'easy-booking-calendar'),
                    'material_green'  => esc_html__('Material Green', 'easy-booking-calendar'),
                    'material_red'    => esc_html__('Material Red', 'easy-booking-calendar'),
                    'material_orange' => esc_html__('Material Orange', 'easy-booking-calendar'),
                    'airbnb'          => esc_html__('Airbnb', 'easy-booking-calendar'),
                    'confetti'        => esc_html__('Confetti', 'easy-booking-calendar')
                ],

                'default' => Defaults::calendar('date_format')
            ],
            [
                'type'    => 'color',
                'name'    => 'primary_color',
                'label'   => esc_html__('Primary color', 'easy-booking-calendar'),
                'default' => Defaults::calendar('primary_color')
            ],
            [
                'type'  => 'info',
                'name'  => 'info-calendar-availability',
                'label' => esc_html__('Booking availability', 'easy-booking-calendar'),
                'class' => 'info availability'
            ],
            [
                'type'    => 'select',
                'name'    => 'max_date_limit',
                'label'   => esc_html__('Max future date allowed', 'easy-booking-calendar'),
                'options' => [
                    ''    => esc_html__('No limit', 'easy-booking-calendar'),
                    '+7d' => esc_html__('1 week from today', 'easy-booking-calendar'),
                    '+1m' => esc_html__('1 month from today', 'easy-booking-calendar'),
                    '+3m' => esc_html__('3 months from today', 'easy-booking-calendar'),
                    '+6m' => esc_html__('6 months from today', 'easy-booking-calendar'),
                    '+1y' => esc_html__('1 year from today', 'easy-booking-calendar'),
                ],

                'default' => Defaults::calendar('max_date_limit')
            ],
            [
                'type'    => 'select',
                'name'    => 'availability_mode',
                'label'   => esc_html__('Availability mode', 'easy-booking-calendar'),
                'options' => [
                    ''                 => esc_html__('Allow all dates', 'easy-booking-calendar'),
                    'allow_selected'   => esc_html__('Allow only selected dates', 'easy-booking-calendar'),
                    'disable_selected' => esc_html__('Disable selected dates', 'easy-booking-calendar'),
                ],

                'default' => Defaults::calendar('availability_mode')
            ],
            [
                'type'    => 'text',
                'name'    => 'dates',
                'label'   => esc_html__('Dates', 'easy-booking-calendar'),
                'default' => Defaults::calendar('dates')
            ],
        ];

        return apply_filters('devnet_ebc_settings_calendar', $calendar);
    }

    public static function product()
    {
        $product = [
            [
                'type'    => 'select',
                'name'    => 'booking_calculation_mode',
                'label'   => esc_html__('Booking calculation mode', 'easy-booking-calendar'),
                'options' => [
                    'nights' => esc_html__('By nights (e.g., Jan 1-3 = 2 nights)', 'easy-booking-calendar'),
                    'days'   => esc_html__('By selected days (e.g., Jan 1-3 = 3 days)', 'easy-booking-calendar'),
                ],
                'default' => Defaults::product('booking_calculation_mode'),
            ],
            [
                'type'    => 'checkbox',
                'name'    => 'double_bookings',
                'label'   => esc_html__('Allow double bookings', 'easy-booking-calendar'),
                'desc'    => esc_html__('Enable multiple bookings for the same dates.', 'easy-booking-calendar'),
                'default' => Defaults::product('double_bookings')
            ],
            [
                'type'    => 'text',
                'name'    => 'button_text',
                'label'   => esc_html__('Button text', 'easy-booking-calendar'),
                'default' => Defaults::product('button_text')
            ],
            [
                'type'    => 'checkbox',
                'name'    => 'disable_quantity',
                'label'   => esc_html__('Disable quantity field', 'easy-booking-calendar'),
                'default' => Defaults::product('disable_quantity')
            ],

        ];

        return apply_filters('devnet_ebc_settings_product', $product);
    }
}
