<?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 Version20260614181134 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 clinic_staff (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, entity_type VARCHAR(10) NOT NULL, entity_id INT NOT NULL, full_name VARCHAR(200) NOT NULL, phone VARCHAR(20) DEFAULT NULL, job_title VARCHAR(100) DEFAULT NULL, address LONGTEXT DEFAULT NULL, national_code VARCHAR(10) DEFAULT NULL, active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX UNIQ_CBEA5AA1D17F50A6 (uuid), INDEX idx_staff_entity_active (entity_type, entity_id, active), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE doctor_addresses DROP FOREIGN KEY `FK_doctor_addr_clinic`');
        $this->addSql('ALTER TABLE doctor_addresses CHANGE type type VARCHAR(10) NOT NULL');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('DROP TABLE clinic_staff');
        $this->addSql('ALTER TABLE doctor_addresses CHANGE type type VARCHAR(10) DEFAULT \'personal\' NOT NULL');
        $this->addSql('ALTER TABLE doctor_addresses ADD CONSTRAINT `FK_doctor_addr_clinic` FOREIGN KEY (clinic_id) REFERENCES clinics (id) ON DELETE CASCADE');
    }
}
