<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20260521094948 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Remet les couleurs classiques sur les statuts du workflow Standard (derive data prod).';
    }

    public function up(Schema $schema): void
    {
        $map = [
            'todo'        => '#222783',
            'in_progress' => '#4A90D9',
            'blocked'     => '#C62828',
            'review'      => '#FF8F00',
            'done'        => '#26A69A',
        ];
        foreach ($map as $category => $hex) {
            $this->addSql(
                "UPDATE task_status SET color = '".$hex."' WHERE category = '".$category."' AND workflow_id = (SELECT id FROM workflow WHERE name = 'Standard' ORDER BY id ASC LIMIT 1)"
            );
        }
    }

    public function down(Schema $schema): void
    {
        $this->throwIrreversibleMigration('Correction de couleurs non reversible.');
    }
}
