<?php

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

return new class extends Migration
{
    public function up()
    {
        Schema::create('metode_pembayaran', function (Blueprint $table) {
            $table->id();
            $table->string('nama', 100);
            $table->string('kode', 50)->unique();
            $table->boolean('is_active')->default(true);
            $table->integer('urutan')->default(0);
            $table->timestamps();
        });

        // Insert data seed sesuai permintaan
        DB::table('metode_pembayaran')->insert([
            ['nama' => 'Tunai / Cash', 'kode' => 'CASH', 'urutan' => 1, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'Transfer Bank Manual', 'kode' => 'TRANSFER_MANUAL', 'urutan' => 2, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'Beasiswa / Internal', 'kode' => 'BEASISWA', 'urutan' => 3, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'VA BNI', 'kode' => 'VA_BNI', 'urutan' => 4, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'VA Mandiri', 'kode' => 'VA_MANDIRI', 'urutan' => 5, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'VA BRI', 'kode' => 'VA_BRI', 'urutan' => 6, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'VA BCA', 'kode' => 'VA_BCA', 'urutan' => 7, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'QRIS (Gopay/OVO/Dana/LinkAja)', 'kode' => 'QRIS', 'urutan' => 8, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
            ['nama' => 'ShopeePay', 'kode' => 'SHOPEEPAY', 'urutan' => 9, 'is_active' => true, 'created_at' => now(), 'updated_at' => now()],
        ]);
    }

    public function down()
    {
        Schema::dropIfExists('metode_pembayaran');
    }
};
