<?php

declare(strict_types=1);

namespace CpCreation\VitiCore\Bridge\Doctrine\Migrations;

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

final class Version20260528190000 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Ajoute la configuration Meta Conversions API.';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('ALTER TABLE shop_shop_config ADD COLUMN IF NOT EXISTS meta_conversions_access_token TEXT DEFAULT NULL');
        $this->addSql('ALTER TABLE shop_shop_config ADD COLUMN IF NOT EXISTS meta_test_event_code VARCHAR(128) DEFAULT NULL');
        $this->addSql('ALTER TABLE shop_shop_config ADD COLUMN IF NOT EXISTS enable_meta_browser_event_tracking BOOLEAN DEFAULT false NOT NULL');
        $this->addSql('ALTER TABLE shop_shop_config ADD COLUMN IF NOT EXISTS enable_meta_conversions_api_tracking BOOLEAN DEFAULT false NOT NULL');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('ALTER TABLE shop_shop_config DROP COLUMN IF EXISTS meta_conversions_access_token');
        $this->addSql('ALTER TABLE shop_shop_config DROP COLUMN IF EXISTS meta_test_event_code');
        $this->addSql('ALTER TABLE shop_shop_config DROP COLUMN IF EXISTS enable_meta_browser_event_tracking');
        $this->addSql('ALTER TABLE shop_shop_config DROP COLUMN IF EXISTS enable_meta_conversions_api_tracking');
    }
}
