<?php

namespace EasyLinkAutomations\Hooks;

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Thin static wrapper around WordPress hook functions.
 */
final class Hooks
{
    public static function addAction(string $hook, callable|array $callback, int $priority = 10, int $acceptedArgs = 1): void
    {
        add_action($hook, $callback, $priority, $acceptedArgs);
    }

    public static function addFilter(string $hook, callable|array $callback, int $priority = 10, int $acceptedArgs = 1): void
    {
        add_filter($hook, $callback, $priority, $acceptedArgs);
    }

    public static function doAction(string $hook, mixed ...$args): void
    {
        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- Callers pass prefixed hook names via Config::withPrefix().
        do_action($hook, ...$args);
    }

    public static function applyFilter(string $hook, mixed $value, mixed ...$args): mixed
    {
        // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound -- Callers pass prefixed hook names via Config::withPrefix().
        return apply_filters($hook, $value, ...$args);
    }

    public static function removeAction(string $hook, callable|array $callback, int $priority = 10): bool
    {
        return remove_action($hook, $callback, $priority);
    }

    public static function removeFilter(string $hook, callable|array $callback, int $priority = 10): bool
    {
        return remove_filter($hook, $callback, $priority);
    }
}
