<?php

namespace Booktics\Validation;

use Booktics\Validation\Rules\Required_Rule;
use Booktics\Validation\Rules\Rule;
use Booktics\Validation\Rules\Unique_Rule;

/**
 * Rule map class
 */
class Rule_Map {
    /**
     * Store rule map
     *
     * @var array
     */
    protected static $map = array(
        'required' => Required_Rule::class,
        'unique'   => Unique_Rule::class,
    );

    /**
     * Resolve rules
     *
     * @param string $rule
     * @param array $options
     *
     * @return  Rule
     */
    public static function resolve_rule_map( string $rule, array $options ): Rule {
        return new static::$map[ $rule ]( ...$options );
    }
}
