<?php

declare(strict_types=1);

namespace Fennec\Console;

/**
 * Sortie console avec un minimum de mise en forme (codes couleur ANSI).
 */
final class ConsoleOutput
{
    private const string COLOR_GREEN = "\033[32m";
    private const string COLOR_RED = "\033[31m";
    private const string COLOR_RESET = "\033[0m";

    public function success(string $message): void
    {
        $this->writeLine(self::COLOR_GREEN . $message . self::COLOR_RESET);
    }

    public function error(string $message): void
    {
        $this->writeLine(self::COLOR_RED . $message . self::COLOR_RESET);
    }

    public function info(string $message): void
    {
        $this->writeLine($message);
    }

    private function writeLine(string $message): void
    {
        echo $message . \PHP_EOL;
    }
}
