<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

final class Version20260507230003 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add device.rotation_mode + device.prioritize_never_shown — image-selection preferences exposed in the PWA settings sheet';
    }

    public function up(Schema $schema): void
    {
        // Default 'oldest_upload' preserves the legacy hard-coded behavior so
        // existing devices keep their current rotation order with no surprise.
        $this->addSql("ALTER TABLE device ADD rotation_mode VARCHAR(32) NOT NULL DEFAULT 'oldest_upload'");
        $this->addSql('ALTER TABLE device ADD prioritize_never_shown BOOLEAN NOT NULL DEFAULT FALSE');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('ALTER TABLE device DROP COLUMN rotation_mode');
        $this->addSql('ALTER TABLE device DROP COLUMN prioritize_never_shown');
    }
}
