<?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 Version20260715075904 extends AbstractMigration
{
    public function getDescription(): string
    {
        return 'Create bank_accounts and pos_devices tables (clinic payment methods)';
    }

    public function up(Schema $schema): void
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->addSql('CREATE TABLE bank_accounts (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, bank_name VARCHAR(100) NOT NULL, card_number VARCHAR(32) DEFAULT NULL, account_number VARCHAR(64) NOT NULL, shaba_number VARCHAR(34) DEFAULT NULL, is_active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_FB88842BD17F50A6 (uuid), INDEX idx_bank_accounts_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('CREATE TABLE pos_devices (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, bank_name VARCHAR(100) NOT NULL, serial_number VARCHAR(64) DEFAULT NULL, terminal_number VARCHAR(64) NOT NULL, account_number VARCHAR(64) DEFAULT NULL, is_active TINYINT NOT NULL, created_at INT NOT NULL, updated_at INT NOT NULL, user_id INT NOT NULL, UNIQUE INDEX UNIQ_7C0A337CD17F50A6 (uuid), INDEX idx_pos_devices_user (user_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
        $this->addSql('ALTER TABLE bank_accounts ADD CONSTRAINT FK_FB88842BA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
        $this->addSql('ALTER TABLE pos_devices ADD CONSTRAINT FK_7C0A337CA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE RESTRICT');
    }

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