<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

/**
 * Per-service-category coverage overrides a tenant sets on its own insurance contract.
 * Rows exist only where the tenant overrode the central admin default.
 */
final class Version20260725120831 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Add tenant_insurance_category_coverage (contract-level coverage percent per service category)';
    }

    public function up(Schema $schema): void
    {
        $this->addSql('CREATE TABLE tenant_insurance_category_coverage (id INT AUTO_INCREMENT NOT NULL, tenant_insurance_id INT NOT NULL, service_category VARCHAR(30) NOT NULL, coverage_percent NUMERIC(5, 2) NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX uniq_tenant_insurance_category (tenant_insurance_id, service_category), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
    }

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