<?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('Pelaporan', function (Blueprint $table) {
            $table->id('PelaporanId');
            $table->unsignedInteger('PeriodePelaporanId');
            $table->foreign('PeriodePelaporanId')->references('PeriodePelaporanId')->on('PeriodePelaporan')->onDelete('cascade');
            $table->year('Tahun');
            $table->unsignedInteger('PerusahaanId');
            $table->foreign('PerusahaanId')->references('PerusahaanId')->on('Perusahaan')->onDelete('cascade');
            $table->float('SKL');
            $table->float('SPL');
            $table->float('SKL_IL');
            $table->float('SKL_AL');
            $table->float('SKL_LB3');
            $table->float('SKL_SB');
            $table->float('SKL_BS');
            $table->float('SKL_STB');
            $table->float('SKL_LP');
            $table->float('SKL_KDM');
            $table->float('SPL_AL');
            $table->float('SPL_LB3');
            $table->float('SPL_SB');
            $table->float('SPL_BS');
            $table->float('SPL_STB');
            $table->float('SPL_LP');
            $table->float('SPL_KDM');
            $table->string('IsChecked', 100)->nullable();

            $table->timestamps();

            $table->index('PeriodePelaporanId', 'IndexPeriodePelaporanId');
            $table->index('Tahun', 'IndexTahun');
            $table->index('PerusahaanId', 'IndexPerusahaanId');
        });
    }

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