<?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('payment_methods', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('slug')->unique();
            $table->string('image')->nullable();
            $table->enum('type', ['auto', 'manual'])->default('auto');
            $table->string('min')->default(-1)->comment('-1=no limit');
            $table->string('max')->default(-1)->comment('-1=no limit');
            $table->string('percent_charge')->default(0);
            $table->string('fixed_charge')->default(0);
            $table->longText('pay_instructions')->nullable()->comment("it's use for manual payment method");
            $table->longText('supported_currencies')->nullable()->comment('json encoded array');
            $table->longText('meta')->nullable()->comment('json encoded array'); // it's use for auto payment method which is stored such as public key and private key
            $table->enum('status', ['active', 'inactive'])->default('active');
            $table->boolean('is_test')->default(true);
            $table->timestamps();
        });
    }

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