<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('provider_payment_methods', function (Blueprint $table) {
            $table->id();
            $table->foreignId('provider_id')->constrained('providers')->onDelete('cascade');
            $table->enum('account_type', ['pix', 'bank_account']);
            $table->string('pix_key')->nullable();
            $table->enum('bank_account_type', ['checking', 'savings'])->nullable();
            $table->string('agency')->nullable();
            $table->string('account')->nullable();
            $table->string('digit')->nullable();
            $table->timestamps();
            $table->softDeletes();

            $table->index('provider_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('provider_payment_methods');
    }
};
