<?php

namespace ProudNerds\Plugin\LoginScreen;

class WpAdmin
{
    public string $relativeDir;
    public string $relativeUrl;

    public function __construct()
    {
        $this->relativeDir = str_replace(WP_CONTENT_DIR, '', __DIR__);
        $this->relativeUrl = content_url($this->relativeDir);

        add_action('admin_enqueue_scripts', [$this, 'wpAdmin'], 10);
    }

    /**
     * Enqueues the wp-admin stylesheet
     *
     * @return void
     */
    public function wpAdmin(): void
    {
        wp_enqueue_style(
            'pn-login-screen-admin',
            content_url($this->relativeDir . '/../assets/css/admin.css'),
            [],
            false,
            'all'
        );
    }

    /**
     * Use this method to initialize the package within WordPress
     *
     * @param string $vendorDir
     */
    public static function init(): static
    {
        return new static();
    }
}
