<?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 Version20260622185948 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 claim_items (id INT AUTO_INCREMENT NOT NULL, invoice_item_id INT NOT NULL, claimed_rials INT NOT NULL, approved_rials INT DEFAULT NULL, claim_id INT NOT NULL, INDEX IDX_DD53020B7096A49F (claim_id), INDEX idx_claim_item_invoice_item (invoice_item_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE claims (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, entity_type VARCHAR(10) NOT NULL, entity_id INT NOT NULL, insurance_id INT NOT NULL, insurance_kind VARCHAR(15) NOT NULL, total_claimed_rials INT NOT NULL, total_approved_rials INT DEFAULT NULL, total_paid_rials INT DEFAULT NULL, status VARCHAR(15) NOT NULL, reject_reason LONGTEXT DEFAULT NULL, submitted_at INT DEFAULT NULL, settled_at INT DEFAULT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, UNIQUE INDEX UNIQ_BEA313BED17F50A6 (uuid), INDEX idx_claim_tenant (entity_type, entity_id), INDEX idx_claim_insurance_status (insurance_id, status), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE claim_items ADD CONSTRAINT FK_DD53020B7096A49F FOREIGN KEY (claim_id) REFERENCES claims (id) ON DELETE CASCADE');
    }

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