<?php
/**
 * Course page controls LifterLMS Module
 *
 * @package LifterLMS Booster
 */

namespace Neve_Pro\Modules\LifterLMS_Booster\Customizer;

use Neve\Customizer\Base_Customizer;
use Neve\Customizer\Types\Control;
use Neve\Customizer\Types\Section;

/**
 * Class Course_Membership
 *
 * @package Neve_Pro\Modules\LifterLMS_Booster\Customizer
 */
class Course_Membership extends Base_Customizer {

	/**
	 * Customizer section slug.
	 *
	 * @var string
	 */
	private $section = 'neve_lifterlms';

	/**
	 * Add customizer controls
	 */
	public function add_controls() {
		$this->add_course_membership_section();
		$this->add_course_layout_controls();
		$this->add_membership_layout_controls();
		$this->add_colors();
	}

	/**
	 * Add Course/Membership section.
	 */
	private function add_course_membership_section() {
		$this->add_section(
			new Section(
				$this->section,
				[
					'priority' => 85,
					'title'    => esc_html__( 'LifterLMS', 'neve-pro-addon' ),
					'panel'    => 'neve_layout',
				]
			)
		);
	}

	/**
	 * Add course customizer controls.
	 */
	private function add_course_layout_controls() {

		$this->add_control(
			new Control(
				'neve_course_page_ui_heading',
				[
					'sanitize_callback' => 'sanitize_text_field',
					'transport'         => $this->selective_refresh,
				],
				[
					'label'            => esc_html__( 'Courses Shop', 'neve-pro-addon' ),
					'section'          => $this->section,
					'priority'         => 10,
					'class'            => 'course-page-layout',
					'accordion'        => true,
					'controls_to_wrap' => 4,
					'expanded'         => true,
				],
				'Neve\Customizer\Controls\Heading'
			)
		);

		$this->add_control(
			new Control(
				'neve_course_card_layout',
				[
					'default'           => 'grid',
					'sanitize_callback' => [ $this, 'sanitize_card_layout' ],
				],
				[
					'label'    => esc_html__( 'Card Layout', 'neve-pro-addon' ),
					'section'  => $this->section,
					'priority' => 10,
					'choices'  => [
						'grid' => [
							'name' => __( 'Grid', 'neve-pro-addon' ),
							'url'  => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS8AAADYCAAAAACfVToRAAAEtElEQVR42u3cIXPjOhSG4f3/9KOGgoFmhmZlspvUabITsp5LjMyMzgWSHadNE7fJve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FF1544YUXwQsvvPDC6+b4HC+8bkyzmvUhfCa5cC+gfZo3KPCKyWP7qrXj2avrx1bW2ADDK+ZpOh7qzVbjZ3fsF8YmF15mFg55ijCYnsa2cyHpUEiu83nvfkRH/sd4jccVhVRMhxyZ5J3kzefmpQyvKWU8DiulwlxcrJzkV9GL5+NJDt63I5F57/s4RzsvqcgdXh8NMzfEz8NKKqYHQeYHvN6ky0MJEUbceGLUxYoia/F6u+ariKNoKOb3WL3zkrIer1lFsZLcWJO2mZR38/3Q4BbcA07Iq8uOg2sswCzcBxjM52Y5XrMM2awebXW8nJTFeqLP8Dq7HZI7boekMtYTrF+nyWZeneZ3DfPpM8/HY2ZErj3xsiY0K8q/r6FDvxCvh/T6S4MXXnjhhRdeBC+88MILL7wIXnjhhdcj51987R/KzzMKWAAAAABJRU5ErkJggg==',
						],
						'list' => [
							'name' => __( 'List', 'neve-pro-addon' ),
							'url'  => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS8AAADYCAAAAACfVToRAAAE0UlEQVR42u3csVPqTBTG4fv/t2+bckvKdCnT2W2iGASH5ma+JlW6VOcrdkOCIKBBwJvfW+GMOvLM7ubsctY/Rr6SPxDghRdeeOFF8MILL7zwwovghRdeeOFF8MILL7zwwovghRdeeOGFF8ELL7zwwovghRdeeOGFF8ELL7zwwovg9RNe/73fLXjhhRdeeOGFF1544YUXXnjhhRdeeOGFF1544YUXXnjhhRdeeOGFF1544YUXXnjh9Sheb1OymZnXpiqLSSnf5uS1eS4mp5qR1xW4imL1bS+nmHR7/n16Kb2z1+oaXEU53UvKp3vll/yWSV7Lq3idGGCXe8n/Aq/rcJ1Ywc57pWZmVSItfo1XufpuNbG8kpd5SZ1577smVW7Weknybfi2aiG56riXd5Ly7S29Xr5djr5dy6uS1JqkSlJudT9JewdJSqTUTFJtZq2k1qx1u+Uvfpdm4RXGV0BR3oblzEtqguU2qB14OSkz2yZSNSevuH5JUt6ZZXFi5VJm5uKzID30qiRnZvYkZTOZj+P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1544UXwmpz/AdpnH8pqwZaBAAAAAElFTkSuQmCC',
						],
					],
				],
				'\Neve\Customizer\Controls\React\Radio_Image'
			)
		);

		$this->add_control(
			new Control(
				'neve_courses_per_row',
				[
					'sanitize_callback' => 'neve_sanitize_range_value',
					'default'           => wp_json_encode(
						[
							'desktop' => 3,
							'tablet'  => 2,
							'mobile'  => 1,
						]
					),
				],
				[
					'label'           => esc_html__( 'Courses per row', 'neve-pro-addon' ),
					'section'         => $this->section,
					'input_attrs'     => [
						'step'       => 1,
						'min'        => 1,
						'max'        => 6,
						'defaultVal' => [
							'mobile'  => 1,
							'tablet'  => 2,
							'desktop' => 3,
						],
					],
					'priority'        => 15,
					'active_callback' => function () {
						return get_theme_mod( 'neve_course_card_layout', 'grid' ) !== 'list';
					},
				],
				'Neve\Customizer\Controls\React\Responsive_Range'
			)
		);

		$this->add_control(
			new Control(
				'neve_course_pagination_type',
				[
					'default'           => 'number',
					'sanitize_callback' => [ $this, 'sanitize_pagination_type' ],
				],
				[
					'label'    => esc_html__( 'Pagination', 'neve-pro-addon' ),
					'section'  => $this->section,
					'priority' => 20,
					'type'     => 'select',
					'choices'  => [
						'number'   => esc_html__( 'Number', 'neve-pro-addon' ),
						'infinite' => esc_html__( 'Infinite Scroll', 'neve-pro-addon' ),
					],
				]
			)
		);

		$this->add_control(
			new Control(
				'neve_course_box_shadow_intensity',
				[
					'sanitize_callback' => 'absint',
					'default'           => 0,
				],
				[
					'label'       => esc_html__( 'Card Box shadow (px)', 'neve-pro-addon' ),
					'section'     => $this->section,
					'type'        => 'neve_range_control',
					'input_attrs' => [
						'min'        => 0,
						'max'        => 30,
						'defaultVal' => 0,
					],
					'priority'    => 30,
				],
				'Neve\Customizer\Controls\React\Range'
			)
		);
	}

	/**
	 * Add membership customizer controls.
	 */
	private function add_membership_layout_controls() {

		$this->add_control(
			new Control(
				'neve_membership_page_ui_heading',
				[
					'sanitize_callback' => 'sanitize_text_field',
					'transport'         => $this->selective_refresh,
				],
				[
					'label'            => esc_html__( 'Memberships Shop', 'neve-pro-addon' ),
					'section'          => $this->section,
					'priority'         => 100,
					'class'            => 'membership-page-layout',
					'accordion'        => true,
					'controls_to_wrap' => 4,
					'expanded'         => false,
				],
				'Neve\Customizer\Controls\Heading'
			)
		);

		$this->add_control(
			new Control(
				'neve_membership_card_layout',
				[
					'default'           => 'grid',
					'sanitize_callback' => [ $this, 'sanitize_card_layout' ],
				],
				[
					'label'    => esc_html__( 'Card Layout', 'neve-pro-addon' ),
					'section'  => $this->section,
					'priority' => 105,
					'choices'  => [
						'grid' => [
							'name' => __( 'Grid', 'neve-pro-addon' ),
							'url'  => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS8AAADYCAAAAACfVToRAAAEtElEQVR42u3cIXPjOhSG4f3/9KOGgoFmhmZlspvUabITsp5LjMyMzgWSHadNE7fJve1G74fSmbTgGUk+OpL7y8hn8gsCvPDCCy+8CF544YUXXngRvPDCCy+8yP/g9c/vbwteeOGFF1544YUXXnjhhRdeeOGFF1544YUXXnjhhRdeeOGFF1544YUXXnjhhRdeeP0Ur9dbsk/Ma9/U1U2pX1Py2j9XN6dJyOsOXFW1TcZrew+uqk7Ga3MXrwsD7MG87sN1YQV7SK96+9VqYpOk1/rL5egrXnjhhddP8drjtdxrv6mrqm72eC3y2sWd9/MeryVeU6Nig9cCr9leco/Xda/N5f3NS1Xv8Jp5rS96barqDFjKXi+X+g1h8L0DY/06v36Nc/UtWNLPx6nX+vJxm+wNWNJeYy9/c6mreAqWeH3fPFfVenu5CXsCxn77es96DobXghb/DAyvJSciRzC8Fh0gTWB47ep6e/28bQRL3mtXz8v7j48n6z1exxbY9vpp7itex45hALt4+I3XjKuqttfuCuA156qq7ZWrFXj9bj5zZQIvvPDCCy+8EvHarj+RHV7cz8ELL7zwwguv+fsK66+mTsyr5v2OT3nd6f2hXSpeu7twrdN5/7G5A1e9S+h95OY/5XrA9913m5sW/efL1/Ufz4v/p4AXXnjhhRdeeOGFF1544YUXXnjhhRdeeOGFF1544YUXXnjhhRdeeOGFF1544YUXXkl6dX++LX+l1yMGL7zwwgsvvAheeOGFF1543T9OMfnh+pe9lOM1przdq1zyVx7FSx6vJV65mVmTSSu8FnuZlzSY937ocpVmvZck34evNSvJNee9vJNUHhLzaiT1JqmRVFo7TtLRQZIyKTeT1JpZL6k36920/MVvKaHxFVBU9mE585K6YHkIau+8nFSYHTKpSckrrl+SVA5mRZxYpVSYufgsyN97NZIzM3uSigSfj4p8WZyIraShD6NsXO9PvArpKdF6ojQzSc1xrsUP7TjHmvdeLvxCel6hvj9dm/D6eL0PiRan83E4Ox87Sb3lcT723vuEvWbrfW62iuv9avTyUwHi43rv01nvz3l17+oJP9UTK8n11jlJvQ2xngi/WP6IDfk3eNnhXL0axlcTfghewW18XPh06tU3Xmf3Q733jZkdVpL8MD4Twn6onareh/Z6xOCFF1544YUXwQsvvPDC6+b4HC+8bkyzmvUhfCa5cC+gfZo3KPCKyWP7qrXj2avrx1bW2ADDK+ZpOh7qzVbjZ3fsF8YmF15mFg55ijCYnsa2cyHpUEiu83nvfkRH/sd4jccVhVRMhxyZ5J3kzefmpQyvKWU8DiulwlxcrJzkV9GL5+NJDt63I5F57/s4RzsvqcgdXh8NMzfEz8NKKqYHQeYHvN6ky0MJEUbceGLUxYoia/F6u+ariKNoKOb3WL3zkrIer1lFsZLcWJO2mZR38/3Q4BbcA07Iq8uOg2sswCzcBxjM52Y5XrMM2awebXW8nJTFeqLP8Dq7HZI7boekMtYTrF+nyWZeneZ3DfPpM8/HY2ZErj3xsiY0K8q/r6FDvxCvh/T6S4MXXnjhhRdeBC+88MILL7wIXnjhhdcj51987R/KzzMKWAAAAABJRU5ErkJggg==',
						],
						'list' => [
							'name' => __( 'List', 'neve-pro-addon' ),
							'url'  => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAS8AAADYCAAAAACfVToRAAAE0UlEQVR42u3csVPqTBTG4fv/t2+bckvKdCnT2W2iGASH5ma+JlW6VOcrdkOCI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PW3dZx+DNvNZX4Tqx/p1Z0WM7ZSZluybMRPJO8uZT81LySF5f2zOe+XDt6155bNfNpcxcXKyc5BfR69Gej9cAO8V1xmvrfd0Tmfe+jXO08ZKy1D2g1/t6OWnRfz7drn/RG8gl18XX3ULKdg+CxHeP5vWzueDPb9JQQoQR13e0NrGiSGq8Pq75yuIo6rLxPVvvvKSkxWtUUSwkt41f1ImUNoNkap274J7yjLyaZBhcfQFm4b5CZz41S/EapUtG9Wit4fJUEuuJNsFrlGE7JDdsh6Q81hOsX/tJRl6Nxnch091rno9DRkSu3vOyKhxW5D9woPOv/j+rh9wP4fXPeP1U8MILL7zwwgsvvPDCCy+88MILL7zwwgsvvPDCCy+88MILrwlezd+75Vd6EbzwwgsvvPAieOGFF154EbzwwgsvvPAieOGFF1544UXwwgsvvPAieOGFF1544UXwwgsvvPAieOGFF1544UXwmpz/AdpnH8pqwZaBAAAAAElFTkSuQmCC',
						],
					],
				],
				'\Neve\Customizer\Controls\React\Radio_Image'
			)
		);

		$this->add_control(
			new Control(
				'neve_memberships_per_row',
				[
					'sanitize_callback' => 'neve_sanitize_range_value',
					'default'           => wp_json_encode(
						[
							'desktop' => 3,
							'tablet'  => 2,
							'mobile'  => 1,
						]
					),
				],
				[
					'label'           => esc_html__( 'Memberships per row', 'neve-pro-addon' ),
					'section'         => $this->section,
					'input_attrs'     => [
						'step'       => 1,
						'min'        => 1,
						'max'        => 6,
						'defaultVal' => [
							'mobile'  => 1,
							'tablet'  => 2,
							'desktop' => 3,
						],
					],
					'priority'        => 110,
					'active_callback' => function () {
						return get_theme_mod( 'neve_membership_card_layout', 'grid' ) !== 'list';
					},
				],
				'Neve\Customizer\Controls\React\Responsive_Range'
			)
		);

		$this->add_control(
			new Control(
				'neve_membership_pagination_type',
				[
					'default'           => 'number',
					'sanitize_callback' => [ $this, 'sanitize_pagination_type' ],
				],
				[
					'label'    => esc_html__( 'Pagination', 'neve-pro-addon' ),
					'section'  => $this->section,
					'priority' => 115,
					'type'     => 'select',
					'choices'  => [
						'number'   => esc_html__( 'Number', 'neve-pro-addon' ),
						'infinite' => esc_html__( 'Infinite Scroll', 'neve-pro-addon' ),
					],
				]
			)
		);

		$this->add_control(
			new Control(
				'neve_membership_box_shadow_intensity',
				[
					'sanitize_callback' => 'absint',
					'default'           => 0,
				],
				[
					'label'       => esc_html__( 'Card Box shadow (px)', 'neve-pro-addon' ),
					'section'     => $this->section,
					'type'        => 'neve_range_control',
					'step'        => 1,
					'input_attrs' => [
						'min'        => 0,
						'max'        => 30,
						'defaultVal' => 0,
					],
					'priority'    => 125,
				],
				'Neve\Customizer\Controls\React\Range'
			)
		);
	}

	/**
	 * Add colors for LifterLMS.
	 */
	private function add_colors() {

		$this->add_control(
			new Control(
				'neve_lifter_colors_ui_heading',
				[
					'sanitize_callback' => 'sanitize_text_field',
					'transport'         => $this->selective_refresh,
				],
				[
					'label'            => esc_html__( 'Colors', 'neve-pro-addon' ),
					'section'          => $this->section,
					'priority'         => 200,
					'class'            => 'lifter-colors',
					'accordion'        => true,
					'controls_to_wrap' => 1,
					'expanded'         => false,
				],
				'Neve\Customizer\Controls\Heading'
			)
		);

		$setting_args = [
			'sanitize_callback' => 'neve_sanitize_colors',
			'default'           => 'var(--nv-primary-accent)',
		];
		$control_args = [
			'label'                 => 'Primary Color',
			'section'               => $this->section,
			'priority'              => 205,
			'live_refresh_selector' => true,
			'live_refresh_css_prop' => [
				'cssVar' => [
					'vars'     => '--llmsprimarycolor',
					'selector' => 'body',
				],
			],
		];

		$setting_args['transport']             = $this->selective_refresh;
		$control_args['live_refresh_selector'] = true;
		$control_args['live_refresh_css_prop'] = [
			'cssVar' => [
				'vars'     => '--llmsprimarycolor',
				'selector' => 'body',
			],
		];

		$this->add_control(
			new Control(
				'neve_lifter_primary_color',
				$setting_args,
				$control_args,
				'\Neve\Customizer\Controls\React\Color'
			)
		);

	}

	/**
	 * Sanitize the pagination type
	 *
	 * @param string $value value from the control.
	 *
	 * @return string
	 */
	public function sanitize_pagination_type( $value ) {
		$allowed_values = [ 'number', 'infinite' ];
		if ( ! in_array( $value, $allowed_values, true ) ) {
			return 'number';
		}

		return esc_html( $value );
	}

	/**
	 * Sanitize card layout value.
	 *
	 * @param string $value Value from the control.
	 *
	 * @return string
	 */
	public function sanitize_card_layout( $value ) {
		$allowed_values = [ 'list', 'grid' ];
		if ( ! in_array( $value, $allowed_values, true ) ) {
			return 'grid';
		}

		return esc_html( $value );
	}
}
