<?php

include_once dirname(__FILE__) . '/class-customizer.php';

/*====================================================
/* REGISTER THEME MOD
/*====================================================*/
function rt_register_customizer_type() {
    \Kirki::add_config('retheme_customizer', [
        'capability' => 'edit_theme_options',
        'option_type' => 'theme_mod',
    ]);
}
add_action('admin_init', 'rt_register_customizer_type');

/*====================================================
/* REMOVE FRONTPAGE SECTION 
/*====================================================*/
function rt_customizer_remove_sections($wp_customize) {
    $wp_customize->remove_section('static_front_page');
}
add_action('customize_register', 'rt_customizer_remove_sections');

/*====================================================
/* REGISTER CONTROL SECTION
/*====================================================*/
function rt_customizer_include_part() {
    if (rt_is_premium()) {
        include dirname(__FILE__) . "/front-page.php";
        include dirname(__FILE__) . "/general.php";
        include dirname(__FILE__) . "/brand.php";
        include dirname(__FILE__) . "/header.php";
        include dirname(__FILE__) . "/footer.php";
        include dirname(__FILE__) . "/post.php";
        include dirname(__FILE__) . "/trip.php";
        include dirname(__FILE__) . "/connect.php";
        include dirname(__FILE__) . "/tweak.php";
    }
}
add_action('init', 'rt_customizer_include_part');

/*====================================================
/* REGISTER CUSTOMIZER CONTROL SCRIPTS
/*====================================================*/
function rt_customizer_control_scripts() {
    wp_enqueue_style('retheme-customizer-panel', get_template_directory_uri() . '/core/customizer/assets/css/customizer-panel.css', false, '3.0.0');
}
add_action('customize_controls_enqueue_scripts', 'rt_customizer_control_scripts', 999);

/*====================================================
/* REGISTER CUSTOMIZER PREVIEW SCRIPTS
/*====================================================*/
function rt_customizer_preview_scripts() {
    wp_enqueue_style('retheme-customizer-preview', get_template_directory_uri() . '/core/customizer/assets/css/customizer-preview.css', false, '3.0.0');
}
add_action('customize_preview_init', 'rt_customizer_preview_scripts');
