<?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()
    {
        Schema::create('time_intervals', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('manage_state_xid');
            $table->foreign('manage_state_xid')->references('id')->on('manage_states')->onDelete('cascade');
            $table->integer('time_hours');
            $table->integer('quantity');
            $table->enum('time_interval', ['day', 'week', 'month'])->default('day');
            $table->boolean('is_active')->default(1)->comment('1=Active, 0=Expired');
            $table->softDeletes();
            $table->integer('created_by')->nullable();
            $table->integer('modified_by')->nullable();
            $table->timestamps();
        });
    }


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