<?php
/**
 * Product Comparison Widget — Content Controls (TAB_CONTENT)
 *
 * Included via require inside register_controls(), so $this is in scope.
 *
 * @package GGM_Commerce
 */

// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// === CONTENT TAB ===

// Content Section
$this->start_controls_section(
	'section_content',
	array(
		'label' => 'Content',
		'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
	)
);

$this->add_control(
	'title',
	array(
		'label'   => 'Section Title',
		'type'    => \Elementor\Controls_Manager::TEXT,
		'default' => 'Product Comparison',
	)
);

$this->add_control(
	'show_title',
	array(
		'label'        => 'Show Title',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'empty_message',
	array(
		'label'   => 'Empty Message',
		'type'    => \Elementor\Controls_Manager::TEXTAREA,
		'default' => 'No products selected for comparison. Browse our products and click the Compare button to add items!',
	)
);

$this->add_control(
	'show_add_products_cta',
	array(
		'label'        => 'Show "Add Products" CTA',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'add_products_url',
	array(
		'label'       => 'Shop Page URL',
		'type'        => \Elementor\Controls_Manager::URL,
		'placeholder' => home_url( '/shop/' ),
		'default'     => array(
			'url' => '',
		),
		'condition'   => array(
			'show_add_products_cta' => 'yes',
		),
	)
);

$this->add_control(
	'add_products_text',
	array(
		'label'     => 'Add Products Button Text',
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => 'Browse Products',
		'condition' => array(
			'show_add_products_cta' => 'yes',
		),
	)
);

$this->end_controls_section();

// Comparison Fields Section
$this->start_controls_section(
	'section_fields',
	array(
		'label' => 'Comparison Fields',
		'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
	)
);

$this->add_control(
	'fields_heading',
	array(
		'label' => 'Toggle which fields to display in the comparison table',
		'type'  => \Elementor\Controls_Manager::HEADING,
	)
);

// Standard fields
$this->add_control(
	'show_image',
	array(
		'label'        => 'Product Image',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_name',
	array(
		'label'        => 'Product Name',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_price',
	array(
		'label'        => 'Price',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_stock',
	array(
		'label'        => 'Stock Status',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_sku',
	array(
		'label'        => 'SKU',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_description',
	array(
		'label'        => 'Short Description',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_categories',
	array(
		'label'        => 'Categories',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_tags',
	array(
		'label'        => 'Tags',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'no',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_rating',
	array(
		'label'        => 'Rating',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_weight',
	array(
		'label'        => 'Weight',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'no',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_dimensions',
	array(
		'label'        => 'Dimensions',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'no',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

$this->add_control(
	'show_add_to_cart',
	array(
		'label'        => 'Add to Cart Button',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
	)
);

// Premium fields - will only show if respective premium components are activated
$this->add_control(
	'premium_fields_divider',
	array(
		'type' => \Elementor\Controls_Manager::DIVIDER,
	)
);

$this->add_control(
	'premium_fields_heading',
	array(
		'label' => 'Premium Fields (requires respective component activation)',
		'type'  => \Elementor\Controls_Manager::HEADING,
	)
);

$this->add_control(
	'show_custom_attributes',
	array(
		'label'        => 'Custom Attributes',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
		'description'  => 'Requires Custom Attributes component activation',
	)
);

$this->add_control(
	'show_attribute_icon',
	array(
		'label'        => 'Show Attribute Icons',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
		'condition'    => array(
			'show_custom_attributes' => 'yes',
		),
	)
);

$this->add_control(
	'show_attribute_unit',
	array(
		'label'        => 'Show Attribute Units',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
		'description'  => 'Show unit of measure after attribute values (e.g., "100 kg")',
		'condition'    => array(
			'show_custom_attributes' => 'yes',
		),
	)
);

$this->add_control(
	'show_barcode',
	array(
		'label'        => 'Barcode',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'no',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
		'description'  => 'Requires Barcode component activation',
	)
);

$this->add_control(
	'show_kit_contents',
	array(
		'label'        => 'Kit Contents',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => 'Show',
		'label_off'    => 'Hide',
		'return_value' => 'yes',
		'description'  => 'Show kit/build components. Requires Product Kits component activation',
	)
);

$this->end_controls_section();
