<?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('mercado_pago_data', function (Blueprint $table) {
            $table->id();
            // $table->string('brick_id')->nullable();
            // $table->string('status')->nullable();
            // $table->string('status_detail')->nullable();
            // $table->string('date_approved')->nullable();
            // // $table->string('firt_name_payer');
            // $table->string('payment_method_id')->nullable();
            // $table->string('payment_type_id')->nullable();
            // // $table->string('refunds');
            // $table->string('token')->nullable();
            // $table->string('issuer_id')->nullable();
            // $table->string('transaction_amount')->nullable();
            // $table->string('installments')->nullable();
            // $table->string('description')->nullable();
            // $table->string('external_reference')->nullable();

            $table->string('collection_id')->nullable();
            $table->string('collection_status')->nullable();
            $table->string('payment_id')->nullable();
            $table->string('status')->nullable();
            $table->string('external_reference')->nullable();
            $table->string('payment_type')->nullable();
            $table->string('merchant_order_id')->nullable();
            $table->string('preference_id')->nullable();
            $table->string('site_id')->nullable();
            $table->string('processing_mode')->nullable();
            $table->string('merchant_account_id')->nullable();
            
            $table->unsignedBigInteger('purchase_id'); 
            $table->foreign('purchase_id')->references('id')->on('purchases');
            $table->timestamps();
        });
    }

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