<?php

namespace ProudNerds\Block;

use ProudNerds\Trait\Initializable;

/**
 * Functionality relating block editor styles can be added and altered here.
 */
class Styles
{
    use Initializable;

    private function __construct()
    {
        add_action('wp_enqueue_scripts', [$this, 'removeWpBlockLibraryCss'], 10, 0);
        add_action('wp_footer', [$this, 'removeCoreBlockSupports'], 10, 0);
        add_action('wp_print_styles', [$this, 'wpsDeregisterStyles'], 100, 0);
    }

    /**
     * Remove core block supports.
     *
     * @return void
     */
    public function removeCoreBlockSupports(): void
    {
        wp_dequeue_style('core-block-supports');
        wp_dequeue_style('core-block-supports-duotone');
    }

    /**
     * Remove wp block library css.
     *
     * @return void
     */
    public function removeWpBlockLibraryCss(): void
    {
        wp_dequeue_style('wp-block-library-theme');
        wp_dequeue_style('wc-block-style');
        wp_dequeue_style('global-styles');
    }

    /**
     * Deregister styles.
     *
     * @return void
     */
    public function wpsDeregisterStyles(): void
    {
        wp_dequeue_style('wp-block-library');
    }
}
