<?php
/**
 * Wishlist Widget - Content Controls
 *
 * @package GGM_Commerce
 */

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

// $this is the GGM_Commerce_Widget_Wishlist instance.

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

$this->add_control(
	'wishlist_mode',
	array(
		'label'   => __( 'Display Mode', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::SELECT,
		'default' => 'default',
		'options' => array(
			'default'  => __( 'Default Wishlist', 'ggm-commerce' ),
			'specific' => __( 'Specific Wishlist', 'ggm-commerce' ),
			'all'      => __( 'All Wishlists (Tabbed)', 'ggm-commerce' ),
			'dropdown' => __( 'Dropdown Selector', 'ggm-commerce' ),
		),
		'description' => __( 'Logged-in users can have multiple wishlists. Guest users only see their default wishlist.', 'ggm-commerce' ),
	)
);

$this->add_control(
	'wishlist_id',
	array(
		'label'       => __( 'Select Wishlist', 'ggm-commerce' ),
		'type'        => \Elementor\Controls_Manager::TEXT,
		'default'     => '',
		'description' => __( 'Enter a wishlist ID to display, or leave empty to auto-detect from the current user. You can find wishlist IDs in the database.', 'ggm-commerce' ),
		'condition'   => array(
			'wishlist_mode' => 'specific',
		),
	)
);

$this->add_control(
	'show_management',
	array(
		'label'        => __( 'Show Management Controls', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => __( 'Show', 'ggm-commerce' ),
		'label_off'    => __( 'Hide', 'ggm-commerce' ),
		'return_value' => 'yes',
		'description'  => __( 'Allow users to create, rename, and delete wishlists.', 'ggm-commerce' ),
		'condition'    => array(
			'wishlist_mode' => array( 'all', 'dropdown' ),
		),
	)
);

$this->add_control(
	'show_move_copy',
	array(
		'label'        => __( 'Show Move/Copy Options', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => __( 'Show', 'ggm-commerce' ),
		'label_off'    => __( 'Hide', 'ggm-commerce' ),
		'return_value' => 'yes',
		'description'  => __( 'Allow users to move or copy items between wishlists.', 'ggm-commerce' ),
		'condition'    => array(
			'wishlist_mode' => array( 'all', 'dropdown' ),
		),
	)
);

$this->add_control(
	'show_sharing',
	array(
		'label'        => __( 'Show Share Button', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => __( 'Show', 'ggm-commerce' ),
		'label_off'    => __( 'Hide', 'ggm-commerce' ),
		'return_value' => 'yes',
		'description'  => __( 'Allow users to share wishlists (requires sharing to be enabled in admin settings).', 'ggm-commerce' ),
	)
);

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

$this->add_control(
	'title_source',
	array(
		'label'   => __( 'Title Source', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::SELECT,
		'default' => 'wishlist_name',
		'options' => array(
			'wishlist_name' => __( 'Wishlist Name', 'ggm-commerce' ),
			'custom'        => __( 'Custom Text', 'ggm-commerce' ),
		),
		'condition' => array(
			'show_title' => 'yes',
		),
	)
);

$this->add_control(
	'title',
	array(
		'label'     => __( 'Custom Title', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => __( 'My Wishlist', 'ggm-commerce' ),
		'condition' => array(
			'show_title'   => 'yes',
			'title_source' => 'custom',
		),
	)
);

$this->add_control(
	'empty_message',
	array(
		'label'   => __( 'Empty Wishlist Message', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::TEXTAREA,
		'default' => __( 'Your wishlist is empty. Browse our products and add items to your wishlist!', 'ggm-commerce' ),
	)
);

$this->add_control(
	'show_remove_button',
	array(
		'label'        => __( 'Show Remove Button', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => __( 'Show', 'ggm-commerce' ),
		'label_off'    => __( 'Hide', 'ggm-commerce' ),
		'return_value' => 'yes',
	)
);

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

$this->add_control(
	'show_clear_all',
	array(
		'label'        => __( 'Show Clear All Button', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'default'      => 'yes',
		'label_on'     => __( 'Show', 'ggm-commerce' ),
		'label_off'    => __( 'Hide', 'ggm-commerce' ),
		'return_value' => 'yes',
	)
);

$this->end_controls_section();
