<?php

declare(strict_types=1);

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

/**
 * Class CreateModulStatistikyStatistickeUdajePracoviskaTable
 */
final class CreateModulStatistikyStatistickeUdajePracoviskaTable extends Migration
{
    /**
     *
     */
    public const TABLE_NAME = 'modul_statistiky_statisticke_udaje_pracoviska';

    /**
     *
     */
    public function up(): void
    {
        Schema::create(self::TABLE_NAME, function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('pracovisko_id');
            $table->string('subjekt_druh');
            $table->string('subjekt_nazov')->nullable();
            $table->date('datum');
            $table->json('udaje')->nullable();

            $table->timestamps();

            $table->index('pracovisko_id');
            $table->index('subjekt_druh');
            $table->index('datum');
        });
    }

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