<?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('online_payments', function (Blueprint $table) {
            $table->string('refunded_amount')->nullable();
            $table->string('booking_number')->nullable()->index();
            $table->string('amount')->nullable();
            $table->string('depositedAmount')->nullable();
            $table->string('orderNumber')->nullable()->index();
            $table->string('description')->nullable();

            $table->string('orderId')->nullable()->index();
            $table->string('cardholderName')->nullable()->index();
            $table->string('pan')->nullable()->index();

            $table->string('expiration')->nullable();
            $table->string('formUrl')->nullable();
            $table->string('successUrl')->nullable();
            $table->string('errorUrl')->nullable();

            $table->string('paymentStatus')->nullable()->index();
            $table->string('callbackStatus')->nullable();
            $table->string('username')->nullable()->index();
            $table->string('approvalCode')->nullable();

            $table->unsignedBigInteger('online_paymantable_id')->index()->nullable();
            $table->string('online_paymantable_type')->index()->nullable();

            $table->string('api_client')->nullable()->index();
            $table->json('api_response')->nullable();
            $table->timestamps();
        });
    }

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