<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('quota_transactions', function (Blueprint $table) {
            $table->id();
            $table->string('invoice_code')->unique(); // Contoh: INV-QTA-12345
            $table->foreignId('user_id')->constrained('users')->cascadeOnDelete(); // Relasi ke Owner
            $table->string('package_name'); // Nama paket: Standar, Murmer, Juragan
            $table->unsignedBigInteger('price'); // Harga paket
            $table->integer('quota_added'); // Jumlah kuota yang didapat (1, 5, 10)
            $table->string('status')->default('pending'); // pending, lunas, batal
            $table->string('payment_proof')->nullable(); // Foto bukti transfer
            $table->timestamp('expired_at')->nullable(); // Batas waktu transfer 1x24 jam
            $table->timestamps();
        });
    }

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