<?php

namespace BWDK\Admin;

class Assets
{
    public function register(): void
    {
        add_action('admin_enqueue_scripts', [$this, 'enqueue']);
    }

    public function enqueue(): void
    {
        $screen = get_current_screen();

        wp_enqueue_style(
            'bwdk-order-list-column',
            BWDK_ADMIN_CSS . 'bwdk-order-list-column.css',
            [],
            '1.0.0'
        );
        wp_enqueue_script(
            'bwdk-admin-script',
            BWDK_ADMIN_JS . 'bwdk.js',
            ['jquery'],
            '1.0.0',
            true
        );

        wp_localize_script('bwdk-admin-script', 'bwdk_admin_ajax', [
            'ajax_url' => admin_url('admin-ajax.php'),
            'nonce' => wp_create_nonce('bwdk_admin_ajax'),
        ]);




        if (! $screen || strpos($screen->id, 'bwdk') === false) {
            return;
        }


        wp_enqueue_style(
            'style-rtl',
            BWDK_ADMIN_CSS . 'style.bundle.rtl.css',
            [],
            '3.17.10'
        );


        wp_enqueue_style(
            'bwdk-admin-style',
            BWDK_ADMIN_CSS . 'bwdk.css',
            [],
            '1.0.0'
        );


        wp_enqueue_media();


        wp_enqueue_script(
            'uikit',
            BWDK_ADMIN_JS . 'uikit.min.js',
            [],
            '3.17.10',
            true
        );

        wp_enqueue_script(
            'uikit-icons',
            BWDK_ADMIN_JS . 'uikit-icons.min.js',
            ['uikit'],
            '3.17.10',
            true
        );


    }
}
