<?php

declare(strict_types=1);

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

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

    /**
     *
     */
    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');
        });
    }

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