<?php
namespace PayCal\Core;

defined('ABSPATH') || exit;

class Assets {
  public static function enqueue($hook): void {
    // Load on our plugin pages
    if (strpos((string)$hook, 'paycal-') === false && strpos((string)$hook, 'PayCal') === false) return;

    wp_enqueue_style('paycal-admin', PAYCAL_URL . 'assets/admin.css', [], PAYCAL_VERSION);
    wp_enqueue_script('paycal-admin', PAYCAL_URL . 'assets/admin.js', ['jquery'], PAYCAL_VERSION, true);

    wp_localize_script('paycal-admin', 'PAYCAL', [
      'nonce' => wp_create_nonce('paycal_admin'),
    ]);
  }
}
