<?php

declare(strict_types=1);

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

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

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

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