<?php
namespace Bookaro\Controller\Admin\Settings;

defined( 'ABSPATH' ) || exit;

final class ShortcodesTab extends AbstractSettingsTab
{
    public function get_key(): string
    {
        return 'shortcodes';
    }

    public function get_section(): array
    {
        return [
            'id'    => 'bookaro_shortcodes',
            'title' => __( 'Embed', 'mybookaro' ),
            'page'  => 'bookaro-booking-settings-shortcodes',
            'desc'  => __( 'Copy embed codes for booking UI and dashboards.', 'mybookaro' ),
        ];
    }

    public function get_fields(): array
    {
        return [
            [
                'id' => 'heading_embed_generator',
                'label' => '',
                'callback' => 'render_heading_field',
                'section' => 'bookaro_shortcodes',
                'page' => 'bookaro-booking-settings-shortcodes',
                'args' => [
                    'title' => __( 'Generator', 'mybookaro' ),
                    'description' => __( 'Build shortcodes and block configs for booking UI.', 'mybookaro' ),
                    'field_type' => 'heading',
                ],
            ],
            [
                'id' => 'note_embed_mode_woocommerce',
                'label' => '',
                'callback' => 'render_note_field',
                'section' => 'bookaro_shortcodes',
                'page' => 'bookaro-booking-settings-shortcodes',
                'args' => [
                    'title' => __( 'WooCommerce mode', 'mybookaro' ),
                    'description' => __( 'Dashboards live in My Account. Use these embeds only if you switch to Shortcodes mode.', 'mybookaro' ),
                    'variant' => 'info',
                    'field_type' => 'note',
                    'depends' => [
                        [ 'field' => 'ui_mode', 'operator' => 'equals', 'value' => 'woocommerce' ],
                    ],
                ],
            ],
            [
                'id' => 'note_embed_mode_shortcodes',
                'label' => '',
                'callback' => 'render_note_field',
                'section' => 'bookaro_shortcodes',
                'page' => 'bookaro-booking-settings-shortcodes',
                'args' => [
                    'title' => __( 'Shortcodes mode', 'mybookaro' ),
                    'description' => __( 'Place booking form + dashboards on pages you choose. Use the generator below to copy embeds.', 'mybookaro' ),
                    'variant' => 'success',
                    'field_type' => 'note',
                    'depends' => [
                        [ 'field' => 'ui_mode', 'operator' => 'equals', 'value' => 'shortcodes' ],
                    ],
                ],
            ],
            [ 'id'=>'available_shortcodes','label'=>__( 'Available Shortcodes', 'mybookaro' ), 'callback'=>'render_shortcodes_field','section'=>'bookaro_shortcodes','page'=>'bookaro-booking-settings-shortcodes','args'=>[ 'tooltip'=>__( 'Use the generator to copy and paste into pages or blocks.', 'mybookaro' ) ] ],
        ];
    }
}
