<?php

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

if ( !class_exists( 'Reon' ) ) {
    return;
}

if ( !class_exists( 'Pricely_Admin_Product_Promotions_Panel' ) ) {

    class Pricely_Admin_Product_Promotions_Panel {

        public function __construct() {

            add_filter( 'pricely_admin_product-promotions_get-panels', array( $this, 'get_panel' ), 10 );
        }

        public function get_panel( $in_fields ) {

            $in_fields[] = array(
                'id' => 'setting_id',
                'type' => 'autoid',
                'autoid' => 'pricely',
            );

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

            return $in_fields;
        }

        private function get_fields( $in_fields ) {

            $in_fields[] = array(
                'id' => 'any_ids',
                'type' => 'columns-field',
                'columns' => 1,
                'merge_fields' => false,
                'fields' => array(
                    array(
                        'id' => 'admin_note',
                        'type' => 'textbox',
                        'column_size' => 1,
                        'column_title' => esc_html__( 'Admin Note', 'pricely-dynamic-pricing-cart-discounts' ),
                        'tooltip' => esc_html__( 'Adds a private note for reference purposes', 'pricely-dynamic-pricing-cart-discounts' ),
                        'default' => '',
                        'placeholder' => esc_html__( 'Type here...', 'pricely-dynamic-pricing-cart-discounts' ),
                        'width' => '100%',
                    ),
                ),
            );

            return apply_filters( 'pricely_admin_product-promotions_get-fields', $in_fields );
        }

    }

    new Pricely_Admin_Product_Promotions_Panel();
}
