<?php
// don't load directly
defined( 'ABSPATH' ) || exit;

// General Settings
CSF::createSection( $prefix, array(
	'parent' => 'general',
	'title'  => __( 'Main Settings', 'cartnotify' ),
	'fields' => array(
		array(
			'id'         => 'cns-enable-notify',
			'type'       => 'switcher',
			'title'      => __( 'Enable Notification', 'cartnotify' ),
			'subtitle'   => __( 'Show cart notification after successful add-to-cart.', 'cartnotify' ),
			'text_on'    => __( 'Enabled', 'cartnotify' ),
			'text_off'   => __( 'Disabled', 'cartnotify' ),
			'text_width' => 100,
			'default'    => '1',
			'sanitize'   => array( '\Cart\notify\Settings\Repository', 'sanitize_switch' ),
		),
		array(
			'id'       => 'cns-success-message',
			'type'     => 'text',
			'title'    => __( 'Success Message', 'cartnotify' ),
			'subtitle' => __( 'Message shown after a product is added to the cart.', 'cartnotify' ),
			'default'  => __( 'The product has been successfully added to the cart.', 'cartnotify' ),
			'sanitize' => array( '\Cart\notify\Settings\Repository', 'sanitize_text' ),
		),
		array(
			'id'          => 'cns-notify-position',
			'type' => 'select',
			'title'       => __( 'Notification Position', 'cartnotify' ),
			'subtitle'    => __( 'Choose where the notification appears.', 'cartnotify' ),
			'placeholder' => __( 'Notification Position', 'cartnotify' ),
			'options' => array(
				'right-top'    => __( 'Right Top', 'cartnotify' ),
				'right-bottom' => __( 'Right Bottom', 'cartnotify' ),
				'left-top'     => __( 'Left Top', 'cartnotify' ),
				'left-bottom'  => __( 'Left Bottom', 'cartnotify' ),
			),
			'default'     => 'right-bottom',
			'sanitize'    => array( '\Cart\notify\Settings\Repository', 'sanitize_position' ),
		),
		array(
			'id'         => 'cns-notify-duration',
			'type'       => 'number',
			'title'      => __( 'Auto-hide Duration', 'cartnotify' ),
			'subtitle'   => __( 'Time before notification auto-closes.', 'cartnotify' ),
			'unit'       => __( 'ms', 'cartnotify' ),
			'default'    => 3000,
			'attributes' => array(
				'min'  => 1000,
				'max'  => 20000,
				'step' => 100,
			),
			'sanitize'   => array( '\Cart\notify\Settings\Repository', 'sanitize_duration' ),
		),
		array(
			'id'         => 'cns-show-image',
			'type'       => 'switcher',
			'title'      => __( 'Show Product Image', 'cartnotify' ),
			'subtitle'   => __( 'Display product thumbnail in the notification.', 'cartnotify' ),
			'text_on'    => __( 'Enabled', 'cartnotify' ),
			'text_off'   => __( 'Disabled', 'cartnotify' ),
			'text_width' => 100,
			'default'    => '1',
			'sanitize'   => array( '\Cart\notify\Settings\Repository', 'sanitize_switch' ),
		),
		array(
			'id'          => 'cns-mobile-visibility',
			'type'        => 'select',
			'title'       => __( 'Mobile Behavior', 'cartnotify' ),
			'subtitle'    => __( 'Control whether notifications are shown on small screens.', 'cartnotify' ),
			'placeholder' => __( 'Select mobile behavior', 'cartnotify' ),
			'options' => array(
				'show' => __( 'Show on mobile', 'cartnotify' ),
				'hide' => __( 'Hide on mobile', 'cartnotify' ),
			),
			'default'     => 'show',
			'sanitize'    => array( '\Cart\notify\Settings\Repository', 'sanitize_mobile_visibility' ),
		),
		array(
			'id'         => 'cns-cta-view-cart',
			'type'       => 'switcher',
			'title'      => __( 'Show "View Cart" Button', 'cartnotify' ),
			'text_on'    => __( 'Enabled', 'cartnotify' ),
			'text_off'   => __( 'Disabled', 'cartnotify' ),
			'text_width' => 100,
			'default'    => '1',
			'sanitize'   => array( '\Cart\notify\Settings\Repository', 'sanitize_switch' ),
		),
		array(
			'id'         => 'cns-cta-checkout',
			'type'       => 'switcher',
			'title'      => __( 'Show "Checkout" Button', 'cartnotify' ),
			'text_on'    => __( 'Enabled', 'cartnotify' ),
			'text_off'   => __( 'Disabled', 'cartnotify' ),
			'text_width' => 100,
			'default'    => '1',
			'sanitize'   => array( '\Cart\notify\Settings\Repository', 'sanitize_switch' ),
		),
		array(
			'id'         => 'cns-cta-continue',
			'type'       => 'switcher',
			'title'      => __( 'Show "Continue Shopping" Button', 'cartnotify' ),
			'text_on'    => __( 'Enabled', 'cartnotify' ),
			'text_off'   => __( 'Disabled', 'cartnotify' ),
			'text_width' => 100,
			'default'    => '0',
			'sanitize'   => array( '\Cart\notify\Settings\Repository', 'sanitize_switch' ),
		),
		),
	) );
