<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
final class Version20260609134112 extends AbstractMigration
{
    public function getDescription(): string
    {
        return '';
    }

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE TABLE date_overrides (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, date INT NOT NULL, active TINYINT NOT NULL, setting JSON DEFAULT NULL, reason VARCHAR(255) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_F49AE94ED17F50A6 (uuid), INDEX IDX_F49AE94E87F4FB17 (doctor_id), INDEX idx_date_overrides_doctor_date (doctor_id, date), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE holidays (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, start_date INT NOT NULL, end_date INT NOT NULL, active TINYINT NOT NULL, reason VARCHAR(255) DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_3A66A10CD17F50A6 (uuid), INDEX IDX_3A66A10C87F4FB17 (doctor_id), INDEX idx_holidays_doctor_range (doctor_id, start_date, end_date), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE weekly_schedules (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, setting JSON NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_69C327F2D17F50A6 (uuid), UNIQUE INDEX idx_weekly_schedules_doctor (doctor_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE date_overrides ADD CONSTRAINT FK_F49AE94E87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE holidays ADD CONSTRAINT FK_3A66A10C87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE weekly_schedules ADD CONSTRAINT FK_69C327F287F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE date_overrides DROP FOREIGN KEY FK_F49AE94E87F4FB17');
        $this->addSql('ALTER TABLE holidays DROP FOREIGN KEY FK_3A66A10C87F4FB17');
        $this->addSql('ALTER TABLE weekly_schedules DROP FOREIGN KEY FK_69C327F287F4FB17');
        $this->addSql('DROP TABLE date_overrides');
        $this->addSql('DROP TABLE holidays');
        $this->addSql('DROP TABLE weekly_schedules');
    }
}
