<?php

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

return new class extends Migration {
    public function up()
    {
        Schema::create('hr_time_log', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id');
            $table->enum('type', ['in', 'out'])->default('in');
            $table->timestamp('time')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->string('ip_address', 32)->nullable();
            $table->boolean('pending_change_request')->default(0);
            $table->boolean('new_record_request')->default(0);
            $table->unsignedBigInteger('holiday_id')->nullable();
            $table->unsignedBigInteger('created_by');
            $table->unsignedBigInteger('updated_by');
            $table->boolean('lunch')->nullable();
            $table->timestamps();
            $table->index('user_id');
            $table->index('time');
        });
    }

    public function down()
    {
        Schema::dropIfExists('hr_time_log');
    }
}; 