<?php

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

if ( !class_exists( 'Reon' ) ) {

    return;
}

if ( !class_exists( 'Pricely_Admin_Settings_Styles_CountDown_Inline_Settings' ) ) {

    require_once 'ui-countdown-inline/options.php';

    class Pricely_Admin_Settings_Styles_CountDown_Inline_Settings {

        private $ui_options_id = 'ui_countdown_inlines';

        public function __construct() {

            add_filter( 'pricely_admin_get-settings-countdown-styles-section-panels', array( $this, 'get_panel' ), 20 );
        }

        public function get_panel( $in_fields ) {

            $in_fields[] = array(
                'id' => 'any_id',
                'type' => 'panel',
                'last' => true,
                'white_panel' => false,
                'panel_size' => 'smaller',
                'width' => '100%',
                'merge_fields' => false,
                'css_class' => array( 'rn-round-small' ),
                'fields' => $this->get_fields( array() ),
            );

            return $in_fields;
        }

        private function get_fields( $in_fields ) {

            $in_fields[] = array(
                'id' => 'any_id',
                'type' => 'paneltitle',
                'full_width' => true,
                'center_head' => true,
                'title' => esc_html__( 'Countdown - Style 1 Designs', 'pricely-dynamic-pricing-cart-discounts' ),
                'desc' => esc_html__( 'Use these settings to create and manage countdown style 1 designs', 'pricely-dynamic-pricing-cart-discounts' ),
            );

            $in_fields[] = array(
                'id' => $this->ui_options_id,
                'filter_id' => 'pricely_ui_inline_countdown',
                'type' => 'repeater',
                'white_repeater' => true,
                'repeater_size' => 'smaller',
                'accordions' => true,
                'buttons_sep' => false,
                'delete_button' => true,
                'clone_button' => false,
                'width' => '100%',
                'css_class' => array( 'rn-round-small' ),
                'default' => $this->get_default_ui(),
                'static_template' => 'ui_default',
                'section_type_id' => 'option_type',
                'auto_expand' => array(
                    'new_section' => true,
                    'cloned_section' => false,
                ),
                'sortable' => array(
                    'enabled' => false,
                ),
                'template_adder' => array(
                    'position' => 'right',
                    'show_list' => false,
                    'button_text' => esc_html__( 'New Design', 'pricely-dynamic-pricing-cart-discounts' ),
                ),
            );

            return $in_fields;
        }

        private function get_default_ui() {

            return array(
                array(
                    'option_type' => 'ui_default',
                    'ui_id' => '2234343',
                ),
            );
        }

    }

    new Pricely_Admin_Settings_Styles_CountDown_Inline_Settings();
}