<?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 Version20260610183655 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_doctor_invitations (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, mobile VARCHAR(20) NOT NULL, invited_name VARCHAR(255) DEFAULT NULL, invited_specialty VARCHAR(255) DEFAULT NULL, token VARCHAR(128) NOT NULL, token_used TINYINT NOT NULL, status VARCHAR(20) NOT NULL, invited_at INT NOT NULL, expires_at INT NOT NULL, responded_at INT DEFAULT NULL, clinic_id INT NOT NULL, invited_by_id INT NOT NULL, doctor_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_26DCCFEBD17F50A6 (uuid), UNIQUE INDEX UNIQ_26DCCFEB5F37A13B (token), INDEX IDX_26DCCFEBA7B4A7E3 (invited_by_id), INDEX IDX_26DCCFEB87F4FB17 (doctor_id), INDEX idx_cdi_token (token), INDEX idx_cdi_clinic (clinic_id), INDEX idx_cdi_mobile (mobile), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE clinic_doctor_invitations ADD CONSTRAINT FK_26DCCFEBCC22AD4 FOREIGN KEY (clinic_id) REFERENCES clinics (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE clinic_doctor_invitations ADD CONSTRAINT FK_26DCCFEBA7B4A7E3 FOREIGN KEY (invited_by_id) REFERENCES users (id)');
        $this->addSql('ALTER TABLE clinic_doctor_invitations ADD CONSTRAINT FK_26DCCFEB87F4FB17 FOREIGN KEY (doctor_id) REFERENCES doctors (id) ON DELETE SET NULL');
    }

    public function down(Schema $schema): void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE clinic_doctor_invitations DROP FOREIGN KEY FK_26DCCFEBCC22AD4');
        $this->addSql('ALTER TABLE clinic_doctor_invitations DROP FOREIGN KEY FK_26DCCFEBA7B4A7E3');
        $this->addSql('ALTER TABLE clinic_doctor_invitations DROP FOREIGN KEY FK_26DCCFEB87F4FB17');
        $this->addSql('DROP TABLE clinic_doctor_invitations');
    }
}
