<?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('bucoks', function (Blueprint $table) {
            $table->id();
            $table->string('no')->nullable(); // Nomor urut
            $table->string('tanggal')->nullable(); // Tanggal
            $table->string('bulan')->nullable(); // Bulan
            $table->string('tahun')->nullable(); // Tahun
            $table->string('tanggal_penuh')->nullable(); // Tanggal lengkap
            $table->string('nomor_categ')->nullable(); // Nomor kategori
            $table->string('coa_summary')->nullable(); // COA Summary
            $table->string('nomor_coa')->nullable(); // Nomor COA
            $table->string('nama_coa')->nullable(); // Nama COA
            $table->string('nomor_tiket')->unique(); // Nomor tiket (unique)
            $table->string('deskripsi')->nullable(); // Deskripsi
            $table->string('nominal')->nullable(); // Nominal
            $table->string('penyelesaian')->nullable(); // Penyelesaian
            $table->string('umur_aging')->nullable(); // Umur aging
            $table->string('cost_center')->nullable(); // Cost center
            $table->string('nama_sub_direktorat')->nullable(); // Nama sub direktorat
            $table->string('nama_direktorat_cabang')->nullable(); // Nama direktorat cabang
            $table->string('tanggal_penyelesaian')->nullable(); // Tanggal penyelesaian
            $table->string('nominal_penyelesaian')->nullable(); // Nominal penyelesaian
            $table->string('nominal_berjalan')->nullable(); // Nominal berjalan
            $table->string('amortisasi_berjalan')->nullable(); // Amortisasi berjalan
            $table->string('sistem_berjalan')->nullable(); // Sistem berjalan
            $table->string('lainnya_berjalan')->nullable(); // Lainnya berjalan
            $table->string('nominal_gantung')->nullable(); // Nominal gantung
            $table->string('aset_gantung')->nullable(); // Aset gantung
            $table->string('keterangan_gantung')->nullable(); // Keterangan gantung
            $table->string('lainnya_satu')->nullable(); // Lainnya satu
            $table->string('lainnya_dua')->nullable(); // Lainnya dua

            // Standard Laravel fields
            $table->timestamps();
            $table->string('created_by')->nullable();
            $table->string('updated_by')->nullable();
            $table->string('deleted_by')->nullable();
            $table->softDeletes();

            // Indexes untuk performa
            $table->index(['nomor_tiket']);
            $table->index(['tanggal']);
            $table->index(['tahun']);
            $table->index(['nomor_coa']);
            $table->index(['cost_center']);
        });
    }

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