<?php declare(strict_types=1);

namespace App\Captcha;

use App\Captcha\Contracts\Type as TypeContract;
use App\Captcha\Dto\Symbols;

abstract class Type implements TypeContract
{
    public function __construct(
        private readonly array $config
    ) { }

    abstract public function getSymbols(): Symbols;

    final public function getConfig(): array
    {
        return $this->config;
    }

    final public function getConfigValue(string | int $name, mixed $default = null): mixed
    {
        $config = $this->getConfig();
        return $config[$name] ?? $default;
    }
}
