<?php

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

if (!class_exists('Reon')) {


    class Reon {
        
        private static $instance;

        public static function get_instance(): self {

            if ( !self::$instance ) {

                self::$instance = new self();
            }

            return self::$instance;
        }

        public static function init() {
            
            global $reon_version;

            if ( !defined( 'REON_VERSION' ) ) {

                define( 'REON_VERSION', $reon_version );
            }
            
            if ( !defined( 'REON_ASSETS' ) ) {

                define( 'REON_ASSETS', plugins_url('assets/', __FILE__) );
            }

            require_once dirname( __FILE__ ) . '/core/class.reon.core.php';
            require_once dirname( __FILE__ ) . '/inc/controls/controls.php';
            require_once dirname( __FILE__ ) . '/inc/fields/fields.php';

            require_once dirname( __FILE__ ) . '/inc/optionpage/option-page.php';
            require_once dirname( __FILE__ ) . '/inc/metabox/metaboxes.php';

            Reon_Core::init();

        }

        public static function set_option_page($args = array()) {
            Reon_Option_Page::set_page($args);
        }

        public static function set_option_section($option_name = '', $args = array()) {
            Reon_Option_Page::set_section($option_name, $args);
        }

        public static function set_wc_option_page($args = array()) {
            Reon_Option_Page_WC::set_page($args);
        }

        public static function set_wc_option_section($option_name = '', $args = array()) {
            Reon_Option_Page_WC::set_section($option_name, $args);
        }

        public static function set_meta_box($args = array()) {
            Reon_Meta_Box::set_metabox($args);
        }

        public static function set_wc_product_meta_box($args = array()) {
            Reon_Meta_Box_WC::set_metabox($args);
        }

        public static function set_wc_product_type_option($args = array()) {
            Reon_Meta_Box_WC::set_product_type_option($args);
        }

    }

    Reon::init();
}