<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class Wiaas_Admin_CL {

	public static function init() {

		add_action('init', array(__CLASS__, 'init_admin_cl'));
	}

	public static function init_admin_cl() {

		$current_user = wp_get_current_user();

		$role = $current_user->roles[0];

		$is_cl = $role === 'commercial_lead';

		if ($is_cl) {
			require_once dirname( __FILE__ ) . '/admin-cl/class-wiaas-admin-cl-packages.php';

			require_once dirname( __FILE__ ) . '/admin-cl/class-wiaas-admin-cl-customers.php';

			require_once dirname( __FILE__ ) . '/admin-cl/class-wiaas-admin-cl-orders.php';

			require_once dirname( __FILE__ ) . '/admin-cl/wiaas-admin-cl-packages-ajax.php';

			add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );

		}
	}

	public static  function enqueue_scripts() {
		$plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) );

		wp_enqueue_script( 'wiaas_admin_cl_packages', $plugin_url . '/assets/js/wiaas-admin-cl-packages.js' );

		wp_enqueue_style( 'wiaas_admin_cl', $plugin_url . '/assets/css/wiaas-admin-cl.css' );
	}
}

Wiaas_Admin_CL::init();