<?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 Version20260614182549 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 service_items (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(200) NOT NULL, price_rials INT NOT NULL, active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, section_id INT NOT NULL, staff_id INT DEFAULT NULL, UNIQUE INDEX UNIQ_486C04AAD17F50A6 (uuid), INDEX IDX_486C04AAD823E37A (section_id), INDEX IDX_486C04AAD4D57CD (staff_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE service_sections (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, entity_type VARCHAR(10) NOT NULL, entity_id INT NOT NULL, name VARCHAR(200) NOT NULL, active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX UNIQ_D2E018A5D17F50A6 (uuid), INDEX idx_service_section_entity (entity_type, entity_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE service_items ADD CONSTRAINT FK_486C04AAD823E37A FOREIGN KEY (section_id) REFERENCES service_sections (id) ON DELETE CASCADE');
        $this->addSql('ALTER TABLE service_items ADD CONSTRAINT FK_486C04AAD4D57CD FOREIGN KEY (staff_id) REFERENCES clinic_staff (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 service_items DROP FOREIGN KEY FK_486C04AAD823E37A');
        $this->addSql('ALTER TABLE service_items DROP FOREIGN KEY FK_486C04AAD4D57CD');
        $this->addSql('DROP TABLE service_items');
        $this->addSql('DROP TABLE service_sections');
    }
}
