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

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

// $this is the GGM_Commerce_Widget_Order_Confirmation instance.

// Preview Section - for editor preview with sample data
$this->start_controls_section(
	'section_preview',
	[
		'label' => __( 'Editor Preview', 'ggm-commerce' ),
	]
);

$this->add_control(
	'preview_mode',
	[
		'label'       => __( 'Show Sample Data', 'ggm-commerce' ),
		'type'        => \Elementor\Controls_Manager::SWITCHER,
		'label_on'    => __( 'Yes', 'ggm-commerce' ),
		'label_off'   => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'     => 'yes',
		'description' => __( 'When enabled, displays sample order data in the editor so you can preview your styling. This only affects the editor - the live page will show actual order data.', 'ggm-commerce' ),
	]
);

$this->add_control(
	'preview_info',
	[
		'type'      => \Elementor\Controls_Manager::RAW_HTML,
		'raw'       => '<div style="background: #e8f4fd; padding: 10px; border-radius: 4px; font-size: 12px;"><strong>Note:</strong> Sample data is shown in the editor to help you preview your design. On the live page, this widget displays actual order information from the URL parameters.</div>',
		'condition' => [
			'preview_mode' => 'yes',
		],
	]
);

$this->end_controls_section();

// Content Section
$this->start_controls_section(
	'section_content',
	[
		'label' => __( 'Content', 'ggm-commerce' ),
	]
);

$this->add_control(
	'show_success_icon',
	[
		'label'        => __( 'Show Success Icon', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'success_title',
	[
		'label'       => __( 'Success Title', 'ggm-commerce' ),
		'type'        => \Elementor\Controls_Manager::TEXT,
		'default'     => __( 'Thank you for your order!', 'ggm-commerce' ),
		'label_block' => true,
	]
);

$this->add_control(
	'success_message',
	[
		'label'   => __( 'Success Message', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::TEXTAREA,
		'default' => __( 'Your order has been received and is being processed. You will receive an email confirmation shortly.', 'ggm-commerce' ),
	]
);

$this->add_control(
	'show_order_number',
	[
		'label'        => __( 'Show Order Number', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_order_date',
	[
		'label'        => __( 'Show Order Date', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_order_items',
	[
		'label'        => __( 'Show Order Items', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_order_items_title',
	[
		'label'        => __( 'Show Order Items Title', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
		'condition'    => [
			'show_order_items' => 'yes',
		],
	]
);

$this->add_control(
	'order_items_title',
	[
		'label'     => __( 'Order Items Title', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => __( 'Order Items', 'ggm-commerce' ),
		'condition' => [
			'show_order_items'       => 'yes',
			'show_order_items_title' => 'yes',
		],
	]
);

$this->add_control(
	'show_totals',
	[
		'label'        => __( 'Show Order Totals', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_totals_title',
	[
		'label'        => __( 'Show Order Summary Title', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
		'condition'    => [
			'show_totals' => 'yes',
		],
	]
);

$this->add_control(
	'totals_title',
	[
		'label'     => __( 'Order Summary Title', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => __( 'Order Summary', 'ggm-commerce' ),
		'condition' => [
			'show_totals'       => 'yes',
			'show_totals_title' => 'yes',
		],
	]
);

$this->add_control(
	'show_billing_address',
	[
		'label'        => __( 'Show Billing Address', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_billing_address_title',
	[
		'label'        => __( 'Show Billing Address Title', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
		'condition'    => [
			'show_billing_address' => 'yes',
		],
	]
);

$this->add_control(
	'billing_address_title',
	[
		'label'     => __( 'Billing Address Title', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => __( 'Billing Address', 'ggm-commerce' ),
		'condition' => [
			'show_billing_address'       => 'yes',
			'show_billing_address_title' => 'yes',
		],
	]
);

$this->add_control(
	'show_shipping_address',
	[
		'label'        => __( 'Show Shipping Address', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_shipping_address_title',
	[
		'label'        => __( 'Show Shipping Address Title', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
		'condition'    => [
			'show_shipping_address' => 'yes',
		],
	]
);

$this->add_control(
	'shipping_address_title',
	[
		'label'     => __( 'Shipping Address Title', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => __( 'Shipping Address', 'ggm-commerce' ),
		'condition' => [
			'show_shipping_address'       => 'yes',
			'show_shipping_address_title' => 'yes',
		],
	]
);

$this->add_control(
	'show_payment_method',
	[
		'label'        => __( 'Show Payment Method', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'show_continue_shopping',
	[
		'label'        => __( 'Show Continue Shopping Button', 'ggm-commerce' ),
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => __( 'Yes', 'ggm-commerce' ),
		'label_off'    => __( 'No', 'ggm-commerce' ),
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'continue_shopping_text',
	[
		'label'     => __( 'Continue Shopping Text', 'ggm-commerce' ),
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => __( 'Continue Shopping', 'ggm-commerce' ),
		'condition' => [
			'show_continue_shopping' => 'yes',
		],
	]
);

$this->add_control(
	'no_order_message',
	[
		'label'   => __( 'No Order Message', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::TEXTAREA,
		'default' => __( 'No order found. Please make sure you have a valid order confirmation link.', 'ggm-commerce' ),
	]
);

$this->end_controls_section();
