<?php

declare(strict_types=1);

namespace apexl\Io\modules\validation;

use apexl\Config\ConfigurationInterface;
use apexl\Io\includes\HookManager;
use apexl\Io\includes\Module;
use apexl\Io\modules\validation\Hooks\AddCustomPhpValidatorRules;
use apexl\Io\modules\validation\Hooks\AddMiddleware;
use apexl\Io\services\InstallChecker;
use app\vendor\apexl\io\src\Io\interfaces\ProvidesHooksInterface;

final class validationModule extends Module implements
    ProvidesHooksInterface
{

    public final const string HOOK__CUSTOM_PHP_VALIDATOR_RULES = 'validation.custom_validation_rules';

    public function __construct(
        InstallChecker $installChecker,
        ConfigurationInterface $config,
        private readonly HookManager $hookManager
    ) {
        parent::__construct($installChecker, $config);
    }

    public function initialise(): void
    {
        parent::initialise();

        $this->hookManager->processHook(self::HOOK__CUSTOM_PHP_VALIDATOR_RULES);
    }

    public function hooks(): array
    {
        return [
            AddMiddleware::class,
            AddCustomPhpValidatorRules::class,
        ];
    }
}
