<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Seka\Portal\Modul\Statistiky\Entities\Import\Enums\StavEnum;

/**
 * Class CreateModulStatistikyHistoriaImportovTable
 */
return new class extends Migration {
    /**
     *
     */
    public const TABLE_NAME = 'modul_statistiky_historia_importov';

    /**
     * @return void
     */
    public function up(): void
    {
        Schema::create(self::TABLE_NAME, function (Blueprint $table) {
            $table->id();
            $table->string('subor_nazov')->nullable();
            $table->string('subor_povodne_umiestnenie')->nullable();
            $table->string('subor_presunuty_do')->nullable();
            $table->bigInteger('subor_velkost')->nullable();
            $table->string('stav')->default(StavEnum::SPUSTENY);
            $table->dateTime('datum_cas_akcie');
            $table->longText('sprava')->nullable();

            $table->timestamps();

            $table->index('stav');
            $table->index('subor_nazov');
            $table->index('datum_cas_akcie');
        });
    }

    /**
     * @return void
     */
    public function down(): void
    {
        Schema::dropIfExists(self::TABLE_NAME);
    }
};
