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

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

// $this is the GGM_Commerce_Widget_Review_Form instance.

// Content Section
$this->start_controls_section(
	'content_section',
	[
		'label' => 'Form Settings',
		'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
	]
);

$this->add_control(
	'form_title',
	[
		'label'       => __( 'Form Title', 'ggm-commerce' ),
		'type'        => \Elementor\Controls_Manager::TEXT,
		'default'     => 'Write a Review',
		'placeholder' => __( 'Enter form title', 'ggm-commerce' ),
	]
);

$this->add_control(
	'title_html_tag',
	[
		'label'   => __( 'Title HTML Tag', 'ggm-commerce' ),
		'type'    => \Elementor\Controls_Manager::SELECT,
		'default' => 'h3',
		'options' => [
			'h1'   => 'H1',
			'h2'   => 'H2',
			'h3'   => 'H3',
			'h4'   => 'H4',
			'h5'   => 'H5',
			'h6'   => 'H6',
			'div'  => 'div',
			'span' => 'span',
			'p'    => 'p',
		],
	]
);

$this->add_control(
	'show_title_field',
	[
		'label'        => 'Show Review Title Field',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => 'Yes',
		'label_off'    => 'No',
		'return_value' => 'yes',
		'default'      => 'yes',
	]
);

$this->add_control(
	'require_login',
	[
		'label'        => 'Require Login',
		'type'         => \Elementor\Controls_Manager::SWITCHER,
		'label_on'     => 'Yes',
		'label_off'    => 'No',
		'return_value' => 'yes',
		'default'      => '',
		'description'  => 'If enabled, only logged-in users can submit reviews',
	]
);

$this->add_control(
	'login_message',
	[
		'label'     => 'Login Required Message',
		'type'      => \Elementor\Controls_Manager::TEXTAREA,
		'default'   => 'Please log in to write a review.',
		'condition' => [
			'require_login' => 'yes',
		],
	]
);

$this->add_control(
	'success_message',
	[
		'label'   => 'Success Message',
		'type'    => \Elementor\Controls_Manager::TEXTAREA,
		'default' => 'Thank you for your review! It will be published after moderation.',
	]
);

$this->add_control(
	'submit_button_text',
	[
		'label'   => 'Submit Button Text',
		'type'    => \Elementor\Controls_Manager::TEXT,
		'default' => 'Submit Review',
	]
);

$this->end_controls_section();

// Labels Section
$this->start_controls_section(
	'labels_section',
	[
		'label' => 'Field Labels',
		'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
	]
);

$this->add_control(
	'rating_label',
	[
		'label'   => 'Rating Label',
		'type'    => \Elementor\Controls_Manager::TEXT,
		'default' => 'Your Rating',
	]
);

$this->add_control(
	'title_label',
	[
		'label'     => 'Title Label',
		'type'      => \Elementor\Controls_Manager::TEXT,
		'default'   => 'Review Title',
		'condition' => [
			'show_title_field' => 'yes',
		],
	]
);

$this->add_control(
	'content_label',
	[
		'label'   => 'Review Content Label',
		'type'    => \Elementor\Controls_Manager::TEXT,
		'default' => 'Your Review',
	]
);

$this->add_control(
	'name_label',
	[
		'label'   => 'Name Label',
		'type'    => \Elementor\Controls_Manager::TEXT,
		'default' => 'Your Name',
	]
);

$this->add_control(
	'email_label',
	[
		'label'   => 'Email Label',
		'type'    => \Elementor\Controls_Manager::TEXT,
		'default' => 'Your Email',
	]
);

$this->end_controls_section();
