<?php
/**
 * Metabox definition for the 'product' post type.
 *
 * @package Sifency
 */

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

return [
	'sifency_product_metabox' => [
		'title'     => esc_html__( 'Product Extra Settings', 'sifency-addons' ),
		'post_type' => 'product',
		'context'   => 'normal',
		'priority'  => 'high',
		'class'     => 'sifency-metabox',
		'fields'    => [
			[
				'id'      => 'meta_product_single_type',
				'type'    => 'button_set',
				'title'   => esc_html__( 'Single Page Layout', 'sifency-addons' ),
				'desc'    => esc_html__( 'Choose between the default theme layout or a custom Elementor template.', 'sifency-addons' ),
				'options' => [
					'default' => esc_html__( 'Theme Default', 'sifency-addons' ),
					'custom'  => esc_html__( 'Custom Template', 'sifency-addons' ),
				],
				'default' => 'default',
			],
			[
				'id'         => 'meta_product_single_style',
				'type'       => 'select',
				'title'      => esc_html__( 'Select Custom Template', 'sifency-addons' ),
				'options'    => 'Sifency_Plugin_Helper::get_product_single_types',
				'dependency' => [ 'meta_product_single_type', '==', 'custom' ],
			],
			[
				'id'      => 'product_related_post_control',
				'type'    => 'button_set',
				'title'   => esc_html__( 'Related Products', 'sifency-addons' ),
				'desc'    => esc_html__( 'Show or hide the related products section.', 'sifency-addons' ),
				'options' => [
					'default'  => esc_html__( 'Default', 'sifency-addons' ),
					'enabled'  => esc_html__( 'Enable', 'sifency-addons' ),
					'disabled' => esc_html__( 'Disable', 'sifency-addons' ),
				],
				'default' => 'default',
			],
			[
				'id'    => 'product_extra_badge',
				'type'  => 'text',
				'title' => esc_html__( 'Product Badge Text', 'sifency-addons' ),
				'desc'  => esc_html__( 'Adds a text badge over the product image (e.g., "New Arrival").', 'sifency-addons' ),
			],
			[
				'id'    => 'product_badge_color',
				'type'  => 'color', // Using our new 'color' field type.
				'title' => esc_html__( 'Badge Background Color', 'sifency-addons' ),
				'desc'  => esc_html__( 'Customize badge color for this product.', 'sifency-addons' ),
			],
			[
				'id'    => 'product_subtitle',
				'type'  => 'text',
				'title' => esc_html__( 'Product Subtitle / Tagline', 'sifency-addons' ),
				'desc'  => esc_html__( 'A short line of text displayed below the main title.', 'sifency-addons' ),
			],
			[
				'id'    => 'product_video_url',
				'type'  => 'url',
				'title' => esc_html__( 'Product Video URL', 'sifency-addons' ),
				'desc'  => esc_html__( 'Adds a video link to the gallery. Supports YouTube/Vimeo.', 'sifency-addons' ),
			],
			[
				'id'      => 'product_size_guide_type',
				'type'    => 'button_set',
				'title'   => esc_html__( 'Size Guide', 'sifency-addons' ),
				'options' => [
					'none'   => esc_html__( 'None', 'sifency-addons' ),
					'image'  => esc_html__( 'Image', 'sifency-addons' ),
					'custom' => esc_html__( 'Custom Content', 'sifency-addons' ),
				],
				'default' => 'none',
			],
			[
				'id'         => 'product_size_guide_image',
				'type'       => 'media',
				'title'      => esc_html__( 'Upload Size Guide Image', 'sifency-addons' ),
				'dependency' => [ 'product_size_guide_type', '==', 'image' ],
			],
			[
				'id'         => 'product_size_guide_content',
				'type'       => 'wp_editor',
				'title'      => esc_html__( 'Size Guide Custom Content', 'sifency-addons' ),
				'sanitize'   => 'wp_kses_post',
				'dependency' => [ 'product_size_guide_type', '==', 'custom' ],
			],
			[
				'id'       => 'product_offer_expiry',
				'type'     => 'datetime', // Using our new 'datetime' field type.
				'title'    => esc_html__( 'Sale Countdown Timer', 'sifency-addons' ),
				'desc'     => esc_html__( 'Show a countdown timer for a sale price. Requires a sale price to be set.', 'sifency-addons' ),
			],
			[
				'id'    => 'product_custom_add_to_cart_text',
				'type'  => 'text',
				'title' => esc_html__( 'Custom "Add to Cart" Text', 'sifency-addons' ),
				'desc'  => esc_html__( 'Leave blank to use the default. E.g., "Book Now", "Add to Bag".', 'sifency-addons' ),
			],
			[
				'id'     => 'product_custom_tabs',
				'type'   => 'repeater',
				'title'  => esc_html__( 'Custom Product Tabs', 'sifency-addons' ),
				'desc'   => esc_html__( 'Add extra tabs to the product description area.', 'sifency-addons' ),
				'fields' => [
					[
						'id'    => 'tab_title',
						'type'  => 'text',
						'title' => esc_html__( 'Tab Title', 'sifency-addons' ),
					],
					[
						'id'       => 'tab_content',
						'type'     => 'wp_editor',
						'title'    => esc_html__( 'Tab Content', 'sifency-addons' ),
						'sanitize' => 'wp_kses_post',
					],
				],
			],
		],
	],
];