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

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

return array(
	'sifency_product_metabox' => array(
		'title'     => esc_html__( 'Product Extra Settings', 'sifency-addons' ),
		'post_type' => 'product',
		'context'   => 'normal',
		'priority'  => 'high',
		'class'     => 'sifency-metabox',
		'fields'    => array(
			array(
				'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' => array(
					'default'  => esc_html__( 'Default', 'sifency-addons' ),
					'enabled'  => esc_html__( 'Enable', 'sifency-addons' ),
					'disabled' => esc_html__( 'Disable', 'sifency-addons' ),
				),
				'default' => 'default',
			),
			array(
				'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' ),
			),
			array(
				'id'    => 'product_badge_color',
				'type'  => 'color',
				'title' => esc_html__( 'Badge Background Color', 'sifency-addons' ),
				'desc'  => esc_html__( 'Customize badge color for this product.', 'sifency-addons' ),
			),
			array(
				'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' ),
			),
			array(
				'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' ),
			),
			array(
				'id'      => 'product_size_guide_type',
				'type'    => 'button_set',
				'title'   => esc_html__( 'Size Guide', 'sifency-addons' ),
				'options' => array(
					'none'   => esc_html__( 'None', 'sifency-addons' ),
					'image'  => esc_html__( 'Image', 'sifency-addons' ),
					'custom' => esc_html__( 'Custom Content', 'sifency-addons' ),
				),
				'default' => 'none',
			),
			array(
				'id'         => 'product_size_guide_image',
				'type'       => 'media',
				'title'      => esc_html__( 'Upload Size Guide Image', 'sifency-addons' ),
				'dependency' => array( 'product_size_guide_type', '==', 'image' ),
			),
			array(
				'id'         => 'product_size_guide_content',
				'type'       => 'wp_editor',
				'title'      => esc_html__( 'Size Guide Custom Content', 'sifency-addons' ),
				'sanitize'   => 'wp_kses_post',
				'dependency' => array( 'product_size_guide_type', '==', 'custom' ),
			),
			array(
				'id'    => 'product_offer_expiry',
				'type'  => 'datetime',
				'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' ),
			),
			array(
				'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' ),
			),
			array(
				'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' => array(
					array(
						'id'    => 'tab_title',
						'type'  => 'text',
						'title' => esc_html__( 'Tab Title', 'sifency-addons' ),
					),
					array(
						'id'       => 'tab_content',
						'type'     => 'wp_editor',
						'title'    => esc_html__( 'Tab Content', 'sifency-addons' ),
						'sanitize' => 'wp_kses_post',
					),
				),
			),
		),
	),
);
