<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

/**
 * Tenant-wide switch for the service kinds (outpatient/inpatient) an insurance covers.
 * No backfill: a missing row reads as enabled, so existing tenants keep both kinds.
 */
final class Version20260725131031 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add tenant_service_category_settings (per-tenant enabled insurance service kinds)';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('CREATE TABLE tenant_service_category_settings (id INT AUTO_INCREMENT NOT NULL, entity_type VARCHAR(10) NOT NULL, entity_id INT NOT NULL, service_category VARCHAR(30) NOT NULL, enabled TINYINT DEFAULT 1 NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX uniq_tenant_service_category_setting (entity_type, entity_id, service_category), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('DROP TABLE tenant_service_category_settings');
    }
}
