<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('payments', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('invoice_id')->nullable()->index();
            $table->unsignedBigInteger('payment_method_id')->nullable()->index();
            $table->string('transaction_id')->nullable()->index();
            $table->string('invoice_number')->nullable()->index();
            $table->string('invoiced_total_net')->nullable();
            $table->string('amount')->nullable();
            $table->string('admin_fee')->nullable();
            $table->string('method')->nullable();
            $table->string('status')->nullable();
            $table->string('note')->nullable();
            $table->string('payment_gateway_ref_id')->nullable()->index();
            $table->text('payment_gateway_request_data')->nullable();
            $table->timestamps();
            $table->softDeletes();
            $table->unsignedBigInteger('created_by')->nullable()->index();
            $table->unsignedBigInteger('updated_by')->nullable()->index();
            $table->unsignedBigInteger('deleted_by')->nullable()->index();
        });
    }

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