<?php

declare(strict_types=1);

namespace Apexl\Io\Logger\Services\HandlerCreator;

use Apexl\Io\Logger\Dtos\HandlerConfig;
use Apexl\Io\Logger\Dtos\StreamConfig;
use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\HandlerInterface;

final readonly class ErrorLogHandlerCreator extends HandlerCreator
{
    public function create(
        string $streamName,
        HandlerConfig $handlerConfig,
        StreamConfig $streamConfig
    ): HandlerInterface {
        {
            return new ErrorLogHandler(
                ErrorLogHandler::OPERATING_SYSTEM,
                $this->level($handlerConfig, $streamConfig),
            );
        }
    }
}
