<?php
declare(strict_types=1);

namespace App\Framework\Cache\Commands;

use App\Framework\Cache\Cache;
use App\Framework\Console\ConsoleCommand;
use App\Framework\Console\ConsoleInput;
use App\Framework\Console\ConsoleOutput;

final readonly class ClearCache
{
    public function __construct(
        private Cache $cache,
    ) {}

    #[ConsoleCommand("cache:clear", "Clears the cache")]
    public function __invoke(ConsoleInput $input, ConsoleOutput $output): void
    {
        $this->cache->clear();
        $output->writeSuccess("Cache cleared");
    }
}
