<?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 Version20260609132708 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 doctor_addresses (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) DEFAULT NULL, address LONGTEXT DEFAULT NULL, telephone VARCHAR(50) DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, doctor_id INT NOT NULL, UNIQUE INDEX UNIQ_A0D814FDD17F50A6 (uuid), INDEX idx_doctor_addresses_doctor (doctor_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE doctors (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, gender VARCHAR(10) DEFAULT NULL, medical_system_code VARCHAR(25) DEFAULT NULL, mobile_number VARCHAR(15) DEFAULT NULL, activity_time INT DEFAULT NULL, degree VARCHAR(30) DEFAULT NULL, info LONGTEXT DEFAULT NULL, images JSON DEFAULT NULL, doctor_rate DOUBLE PRECISION NOT NULL, doctor_rate_percentage DOUBLE PRECISION NOT NULL, active_doctor_appointment TINYINT NOT NULL, representation_id INT DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_B67687BED17F50A6 (uuid), INDEX idx_doctors_active (active_doctor_appointment), UNIQUE INDEX idx_doctors_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE doctor_specialties (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_C638E04B87F4FB17 (doctor_id), INDEX IDX_C638E04B12469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE doctor_expertise (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_ED88BE6087F4FB17 (doctor_id), INDEX IDX_ED88BE6012469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE doctor_states (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_955E47C087F4FB17 (doctor_id), INDEX IDX_955E47C012469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE doctor_cities (doctor_id INT NOT NULL, category_id INT NOT NULL, INDEX IDX_7DC181E687F4FB17 (doctor_id), INDEX IDX_7DC181E612469DE2 (category_id), PRIMARY KEY (doctor_id, category_id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE doctor_addresses ADD CONSTRAINT FK_A0D814FD87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE doctors ADD CONSTRAINT FK_B67687BEA76ED395 FOREIGN KEY (user_id) REFERENCES users (id)');
        $this->addSql('ALTER TABLE doctor_specialties ADD CONSTRAINT FK_C638E04B87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
        $this->addSql('ALTER TABLE doctor_specialties ADD CONSTRAINT FK_C638E04B12469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
        $this->addSql('ALTER TABLE doctor_expertise ADD CONSTRAINT FK_ED88BE6087F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
        $this->addSql('ALTER TABLE doctor_expertise ADD CONSTRAINT FK_ED88BE6012469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
        $this->addSql('ALTER TABLE doctor_states ADD CONSTRAINT FK_955E47C087F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
        $this->addSql('ALTER TABLE doctor_states ADD CONSTRAINT FK_955E47C012469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
        $this->addSql('ALTER TABLE doctor_cities ADD CONSTRAINT FK_7DC181E687F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id)');
        $this->addSql('ALTER TABLE doctor_cities ADD CONSTRAINT FK_7DC181E612469DE2 FOREIGN KEY (category_id) REFERENCES categories (id)');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE doctor_addresses DROP FOREIGN KEY FK_A0D814FD87F4FB17');
        $this->addSql('ALTER TABLE doctors DROP FOREIGN KEY FK_B67687BEA76ED395');
        $this->addSql('ALTER TABLE doctor_specialties DROP FOREIGN KEY FK_C638E04B87F4FB17');
        $this->addSql('ALTER TABLE doctor_specialties DROP FOREIGN KEY FK_C638E04B12469DE2');
        $this->addSql('ALTER TABLE doctor_expertise DROP FOREIGN KEY FK_ED88BE6087F4FB17');
        $this->addSql('ALTER TABLE doctor_expertise DROP FOREIGN KEY FK_ED88BE6012469DE2');
        $this->addSql('ALTER TABLE doctor_states DROP FOREIGN KEY FK_955E47C087F4FB17');
        $this->addSql('ALTER TABLE doctor_states DROP FOREIGN KEY FK_955E47C012469DE2');
        $this->addSql('ALTER TABLE doctor_cities DROP FOREIGN KEY FK_7DC181E687F4FB17');
        $this->addSql('ALTER TABLE doctor_cities DROP FOREIGN KEY FK_7DC181E612469DE2');
        $this->addSql('DROP TABLE doctor_addresses');
        $this->addSql('DROP TABLE doctors');
        $this->addSql('DROP TABLE doctor_specialties');
        $this->addSql('DROP TABLE doctor_expertise');
        $this->addSql('DROP TABLE doctor_states');
        $this->addSql('DROP TABLE doctor_cities');
    }
}
