<?php
/**
 * Field content tab controls
 * @var string $prefix
 * @var string $widget_id
 * @var Repeater $field
 */

use Elementor\Controls_Manager;
use Elementor\Repeater;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

$field->add_control(
	$prefix . 'mode',
	[
		'label'       => esc_html__( 'Mode', 'advanced-fields-for-elementor-forms' ),
		'type'        => Controls_Manager::SELECT,
		'control_tab' => Controls_Manager::TAB_CONTENT,
		'default'     => 'visual-text',
		'options'     => [
			'visual-text' => esc_html__( 'Visual & Text', 'advanced-fields-for-elementor-forms' ),
			'visual'      => esc_html__( 'Visual', 'advanced-fields-for-elementor-forms' ),
			'text'        => esc_html__( 'Text', 'advanced-fields-for-elementor-forms' ),
		],
		'label_block' => false,
	]
);

$field->add_control(
	$prefix . 'active_mode',
	[
		'label'       => esc_html__( 'Active Mode', 'advanced-fields-for-elementor-forms' ),
		'type'        => Controls_Manager::SELECT,
		'control_tab' => Controls_Manager::TAB_CONTENT,
		'default'     => 'visual',
		'options'     => [
			'visual' => esc_html__( 'Visual', 'advanced-fields-for-elementor-forms' ),
			'text'   => esc_html__( 'Text', 'advanced-fields-for-elementor-forms' ),
		],
		'label_block' => false,
		'condition'   => [
			$prefix . 'mode' => 'visual-text',
		],
	]
);

$field->add_control(
	$prefix . 'height',
	[
		'label'       => esc_html__( 'Height', 'advanced-fields-for-elementor-forms' ),
		'type'        => Controls_Manager::NUMBER,
		'control_tab' => Controls_Manager::TAB_CONTENT,
		'min'         => 100,
		'step'        => 1,
		'default'     => 200,
		'label_block' => false,
		'condition'   => [
			$prefix . 'mode!' => 'text',
		],
	]
);

$field->add_control(
	$prefix . 'placeholder',
	[
		'label'       => esc_html__( 'Placeholder', 'advanced-fields-for-elementor-forms' ),
		'description' => esc_html__( 'Placeholder text will only be visible in text mode', 'advanced-fields-for-elementor-forms' ),
		'type'        => Controls_Manager::TEXT,
		'control_tab' => Controls_Manager::TAB_CONTENT,
		'default'     => esc_attr__( 'Message', 'advanced-fields-for-elementor-forms' ),
		'label_block' => false,
		'dynamic'     => [
			'active' => true,
		],
		'ai'          => [
			'active' => true,
		],
		'condition'   => [
			$prefix . 'mode' => [ 'text', 'visual-text' ],
		],
	]
);

$field->add_control(
	$prefix . 'rows',
	[
		'label'       => esc_html__( 'Rows', 'advanced-fields-for-elementor-forms' ),
		'type'        => Controls_Manager::NUMBER,
		'control_tab' => Controls_Manager::TAB_CONTENT,
		'default'     => 4,
		'label_block' => false,
		'condition'   => [
			$prefix . 'mode' => 'text',
		],
	]
);
