<?php
/**
 * Admin settings and configuration
 */

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

class WC_TPP_Admin {

    public function __construct() {
        add_filter('woocommerce_get_settings_pages', array($this, 'add_settings_page'));
        add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
    }

    /**
     * Add settings page to WooCommerce settings
     */
    public function add_settings_page($settings) {
        $settings[] = include WC_TPP_PLUGIN_DIR . 'includes/class-wc-tpp-settings.php';
        return $settings;
    }

    public function enqueue_admin_scripts($hook) {
        if ('woocommerce_page_wc-settings' === $hook || 'post.php' === $hook || 'post-new.php' === $hook) {
            wp_enqueue_style('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/css/admin.css', array(), WC_TPP_VERSION);
            wp_enqueue_script('wc-tpp-admin', WC_TPP_PLUGIN_URL . 'assets/js/admin.js', array('jquery'), WC_TPP_VERSION, true);
        }
    }
}

new WC_TPP_Admin();
