<?php

// Create a section.
CSF::createSection(
	$prefix,
	[
		'title' => __('Forum Topics', 'forumax'),
		'id' => 'topics_fields',
		'icon' => 'dashicons dashicons-menu-alt3',
		'fields' => [
			[
				'title' => esc_html__('Title Prefix', 'forumax'),
				'subtitle' => esc_html__('Set the prefix text that appears before topic titles (e.g., "Q:").', 'forumax'),
				'id' => 'topic_title_prefix',
				'type' => 'text',
				'default' => esc_html__('Q:', 'forumax')
			],
			[
				'id' => 'is_solved_topics',
				'type' => 'switcher',
				'default' => true,
				'title' => __('Solved Topics', 'forumax'),
				'subtitle' => __('Allow users and moderators to mark topics as solved.', 'forumax'),
			],
			[
				'id' => 'auto_close_stale_topics',
				'type' => 'switcher',
				'title' => __('Auto-Close Stale Topics', 'forumax'),
				'subtitle' => __('Automatically close old topics that haven\'t received any recent replies.', 'forumax'),
				'default' => false,
			],
			[
				'id' => 'auto_close_days',
				'type' => 'number',
				'title' => __('Close After (days)', 'forumax'),
				'subtitle' => __('Set the number of days of inactivity before a topic is automatically closed.', 'forumax'),
				'default' => 90,
				'dependency' => ['auto_close_stale_topics', '==', 'true'],
			],
			[
				'id' => 'is_auto_approval_topics',
				'type' => 'switcher',
				'default' => false,
				'title' => __('Auto Approval', 'forumax'),
				'subtitle' => __('Automatically approve new topics so they are published without moderation.', 'forumax'),
				'class' => 'st-pro-notice',
			],
			[
				'id' => 'topic_pending_notice',
				'type' => 'text',
				'title' => __('Pending Notice', 'forumax'),
				'subtitle' => __('Set the message displayed to users when their newly created topic is pending moderation.', 'forumax'),
				'default' => __('Your topic is awaiting for moderation.', 'forumax'),
				'dependency' => ['is_auto_approval_topics', '==', false],
				'class' => 'st-pro-notice',
			],
			[
				'id' => 'anonymous_topic',
				'type' => 'switcher',
				'title' => __('Anonymous Topic', 'forumax'),
				'subtitle' => __('Allow visitors to create topics anonymously without creating an account.', 'forumax'),
				'class' => 'st-pro-notice',
			],
			[
				'id' => 'anonymous_topic_label',
				'type' => 'text',
				'title' => __('Anonymous Label', 'forumax'),
				'subtitle' => __('Set the label for the checkbox that lets a user post anonymously.', 'forumax'),
				'default' => __('Post Anonymously', 'forumax'),
				'dependency' => ['anonymous_topic', '==', 'true',],
				'class' => 'st-pro-notice',
			],

			[
				'type' => 'subheading',
				'title' => __('Reaction', 'forumax'),
			],

			[
				'id' => 'topics_react_voting',
				'type' => 'switcher',
				'title' => __('React Reactions', 'forumax'),
				'subtitle' => __('Allow users to leave emoji reactions on topics.', 'forumax'),
				'class' => 'st-promax-notice',
				'default' => false
			],
			[
				'id' => 'topics_react_label',
				'type' => 'text',
				'title' => __('React Button Text', 'forumax'),
				'subtitle' => __('Set the text for the button that opens the emoji reaction picker.', 'forumax'),
				'default' => __('React', 'forumax'),
				'class' => 'st-promax-notice',
				'dependency' => ['topics_react_voting', '==', 'true',]
			],

			[
				'id' => 'reactions',
				'type' => 'group',
				'title' => __('Emoji Reactions', 'forumax'),
				'subtitle' => __('Add, remove, or modify the emoji reactions available for users.', 'forumax'),
				'class' => 'st-promax-notice',
				'fields' => [
					[
						'id' => 'icon',
						'type' => 'text',
						'title' => __('Icon (Emoji)', 'forumax'),
					],
					[
						'id' => 'label',
						'type' => 'text',
						'title' => __('Label', 'forumax'),
					],
				],
				'default' => [
					['icon' => '👍', 'label' => 'Like'],
					['icon' => '👎', 'label' => 'Dislike'],
					['icon' => '❤️', 'label' => 'Love'],
					['icon' => '😂', 'label' => 'Haha'],
					['icon' => '😮', 'label' => 'Wow'],
					['icon' => '😢', 'label' => 'Sad'],
					['icon' => '😡', 'label' => 'Angry'],
				],
				'dependency' => ['topics_react_voting', '==', 'true',],
				'button_title' => __('Add Reaction', 'forumax'),
				'button_remove' => true,
				'add_title' => __('Add New Reaction', 'forumax'),
				'remove_title' => __('Remove Reaction', 'forumax'),
				'accordion_title_auto' => true,
				'accordion_title_number' => true,
				'accordion_title_prefix' => __('Reaction:', 'forumax'),
			],
			[
				'type' => 'subheading',
				'title' => __('Same Topic Voting', 'forumax'),
			],
			[
				'id' => 'same_topic_voting',
				'type' => 'switcher',
				'title' => __('Enable / Disable', 'forumax'),
				'class' => 'st-pro-notice',
			],
			[
				'id' => 'same_topic_settings',
				'type' => 'tabbed',
				'title' => __('Settings', 'forumax'),
				'subtitle' => __('Customize the text and colors for the "I have the same question" voting button.', 'forumax'),
				'dependency' => ['same_topic_voting', '==', 'true',],
				'tabs' => array(
					array(
						'title' => __('Button', 'forumax'),
						'fields' => array(
							[
								'id' => 'same_topic_voting_label',
								'type' => 'text',
								'title' => __('Label', 'forumax'),
								'default' => __('I have the same question', 'forumax'),
								'class' => 'st-pro-notice'
							],
							[
								'id' => 'same_topic_color',
								'type' => 'link_color',
								'title' => __('Color', 'forumax'),
								'output' => '.bbpc-same-topic-btn',
								'output_mode' => 'color',
								'output_important' => true,
								'class' => 'st-pro-notice'
							],
							[
								'id' => 'same_topic_bg_color_normal',
								'type' => 'background',
								'title' => __('Background', 'forumax'),
								'background_image' => false,
								'background_attachment' => false,
								'background_position' => false,
								'background_repeat' => false,
								'background_size' => false,
								'output' => '.bbpc-same-topic-btn',
								'output_mode' => 'background',
								'output_important' => true,
								'class' => 'st-pro-notice'
							],
							[
								'id' => 'same_topic_bg_color_hover',
								'type' => 'background',
								'title' => __('Hover Background', 'forumax'),
								'background_image' => false,
								'background_attachment' => false,
								'background_position' => false,
								'background_repeat' => false,
								'background_size' => false,
								'output' => '.bbpc-same-topic-btn:hover',
								'output_mode' => 'background',
								'output_important' => true,
								'class' => 'st-pro-notice'
							]
						)
					),
					array(
						'title' => __('Success', 'forumax'),
						'fields' => array(
							[
								'id' => 'same_topic_voting_success',
								'type' => 'text',
								'title' => __('Text', 'forumax'),
								'default' => __('Updated vote successfully', 'forumax'),
								'class' => 'st-pro-notice'
							],
							[
								'id' => 'same_topic_success_color',
								'type' => 'link_color',
								'title' => __('Color', 'forumax'),
								'default' => array(
									'color' => '#4a4a4a',
									'hover' => '#4a4a4a',
								),
								'output' => '.same-topic-voting-notice',
								'output_mode' => 'color',
								'output_important' => true,
								'class' => 'st-pro-notice'
							],
							[
								'id' => 'same_topic_bg_success_color',
								'type' => 'background',
								'title' => __('Background', 'forumax'),
								'background_image' => false,
								'background_attachment' => false,
								'background_position' => false,
								'background_repeat' => false,
								'background_size' => false,
								'default' => [
									'background-color' => '#f9f9f9'
								],
								'output' => '.same-topic-voting-notice',
								'output_mode' => 'background',
								'output_important' => true,
								'class' => 'st-pro-notice'
							],
							[
								'id' => 'same_topic_bg_success_color_hover',
								'type' => 'background',
								'title' => __('Hover Background', 'forumax'),
								'background_image' => false,
								'background_attachment' => false,
								'background_position' => false,
								'background_repeat' => false,
								'background_size' => false,
								'default' => [
									'background-color' => '#f9f9f9'
								],
								'output' => '.same-topic-voting-notice:hover',
								'output_mode' => 'background',
								'output_important' => true,
								'class' => 'st-pro-notice'
							]
						)
					)
				)
			],
			[
				'type' => 'heading',
				'title' => esc_html__('Sharing Topics', 'forumax'),
			],
			[
				'id' => 'is_social_links',
				'type' => 'switcher',
				'title' => esc_html__('Share Button', 'forumax'),
				'subtitle' => esc_html__('Enable the share button on topics so users can easily share them to social media.', 'forumax'),
				'text_on' => esc_html__('Enabled', 'forumax'),
				'text_off' => esc_html__('Disabled', 'forumax'),
				'text_width' => 92,
				'default' => true
			],
			[
				'id' => 'share_btn_label',
				'type' => 'text',
				'title' => esc_html__('Share Button Label', 'forumax'),
				'subtitle' => esc_html__('Set the text for the button that opens the topic sharing menu.', 'forumax'),
				'default' => esc_html__('Share this Topic', 'forumax'),
				'dependency' => array(
					array('is_copy_link', '==', '1'),
					array('is_social_links', '==', '1'),
				)
			],
			[
				'id' => 'is_copy_link',
				'type' => 'switcher',
				'title' => esc_html__('Copy Link Button', 'forumax'),
				'subtitle' => esc_html__('Show a button allowing users to easily copy the topic link to their clipboard.', 'forumax'),
				'dependency' => array('is_social_links', '==', '1'),
				'text_width' => 72,
				'default' => true,
			],
			[
				'id' => 'copy_link_label',
				'type' => 'text',
				'title' => esc_html__('Copy Link Label', 'forumax'),
				'subtitle' => esc_html__('Set the text for the button that copies the topic link.', 'forumax'),
				'default' => esc_html__('Or copy link', 'forumax'),
				'dependency' => array(
					array('is_copy_link', '==', '1'),
					array('is_social_links', '==', '1'),
				)
			],
			[
				'id' => 'copy_link_text_success',
				'type' => 'text',
				'title' => esc_html__('Success Message', 'forumax'),
				'subtitle' => esc_html__('Set the success message that appears when the link is copied to the clipboard.', 'forumax'),
				'default' => esc_html__('URL copied to clipboard', 'forumax'),
				'dependency' => array(
					array('is_copy_link', '==', '1'),
					array('is_social_links', '==', '1'),
				)
			],
			[
				'type' => 'heading',
				'title' => __('Real-Time Alert', 'forumax'),
			],
			[
				'id' => 'real_time_alerts_enabled',
				'type' => 'switcher',
				'title' => __('Real-Time Chat Notice', 'forumax'),
				'subtitle' => __('Enable a live notification bubble when new replies or topics are posted in real-time.', 'forumax'),
				'default' => false,
				'class' => 'st-promax-notice',
			],
			[
				'id' => 'real_time_alerts_label',
				'type' => 'text',
				'title' => __('Alert Label', 'forumax'),
				'subtitle' => __('Set the text for the live alert button. Use %d to display the number of new topics.', 'forumax'),
				'default' => __('See %d new topics', 'forumax'),
				'dependency' => ['real_time_alerts_enabled', '==', 'true'],
				'class' => 'st-promax-notice',
			],
			[
				'id' => 'real_time_alerts_interval',
				'type' => 'number',
				'title' => __('Polling Interval (seconds)', 'forumax'),
				'subtitle' => __('Set how often (in seconds) the system checks for new real-time topics.', 'forumax'),
				'default' => 30,
				'min' => 5,
				'max' => 300,
				'dependency' => ['real_time_alerts_enabled', '==', 'true'],
				'class' => 'st-promax-notice',
			],
			[
				'id' => 'topic_subscription',
				'title' => esc_html__('Subscription', 'forumax'),
				'subtitle' => esc_html__('Manage how topic subscriptions act and appear for logged out visitors.', 'forumax'),
				'type' => 'subheading'
			],		
			[
				'title' => esc_html__('Enable / Disable', 'forumax'),
				'id' => 'is_topic_subscription',
				'type' => 'switcher',
				'subtitle' => esc_html__('Show a subscribe button to logged out users, prompting them to log in.', 'forumax'),
				'text_on' => esc_html__('Show', 'forumax'),
				'text_off' => esc_html__('Hide', 'forumax'),
				'default' => '1',
				'text_width' => 80,
			],
			[
				'title' => esc_html__('Subscribe Button', 'forumax'),
				'id' => 'logout_subscription_btn',
				'type' => 'text',
				'subtitle' => esc_html__('Set the text for the subscribe button displayed to logged out users.', 'forumax'),
				'default' => esc_html__('Subscribe', 'forumax'),
				'dependency' => array( 'is_topic_subscription', '==', '1' )
			],
			[
				'title' => esc_html__('Title', 'forumax'),
				'id' => 'subscription_modal_title',
				'type' => 'text',
				'subtitle' => esc_html__('Set the title for the modal popup that prompts users to log in to subscribe.', 'forumax'),
				'default' => esc_html__('Login to the community', 'forumax'),
				'dependency' => array( 'is_topic_subscription', '==', '1' )
			],
			[
				'title' => esc_html__('Subtitle', 'forumax'),
				'id' => 'subscription_modal_subtitle',
				'type' => 'text',
				'subtitle' => esc_html__('Set the descriptive text for the login prompt modal popup.', 'forumax'),
				'default' => esc_html__('You must be logged in to subscribe to this topic.', 'forumax'),
				'dependency' => array( 'is_topic_subscription', '==', '1' )
			],			
			[
				'title' => esc_html__('Login Button', 'forumax'),
				'id' => 'logout_login_btn',
				'type' => 'text',
				'subtitle' => esc_html__('Set the text for the login action button inside the modal.', 'forumax'),
				'default' => esc_html__('Login', 'forumax'),
				'dependency' => array( 'is_topic_subscription', '==', '1' )
			],
			[
				'title' => esc_html__('Login Type', 'forumax'),
				'id' => 'login_url_type',
				'type' => 'select',
				'subtitle' => esc_html__('Choose whether to redirect users to the default WordPress login or a custom page.', 'forumax'),
				'default' => 'default',
				'options' => array(
					'default' => esc_html__('Default Login', 'forumax'),
					'custom' => esc_html__('Custom Page', 'forumax'),
				),
				'dependency' => array( 'is_topic_subscription', '==', '1' )
			],
			[
				'title' => esc_html__('Select Page', 'forumax'),
				'id' => 'login_page',
				'type' => 'select',
				'subtitle' => esc_html__('Select the custom WordPress page to use for login redirection.', 'forumax'),
				'options' => 'pages',
				'dependency' => array(
					array( 'login_url_type', '==', 'custom' ),
					array( 'is_topic_subscription', '==', '1' ),
				)
			]
		]
	]
);
