<?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(): void
    {
        Schema::create('timelog_edits', function (Blueprint $table) {
            $table->id();
            $table->date('payroll_date')->index();
            $table->unsignedMediumInteger('company_id')->index();
            $table->unsignedMediumInteger('dealership_id')->index();
            $table->unsignedMediumInteger('department_id')->index();
            $table->unsignedBigInteger('employee_id')->index();
            $table->date('date')->index();
            $table->time('time');
            $table->string('in_out');
            $table->string('created_by');
            $table->timestamps();
            $table->string('approver_id')->nullable()->index();
            $table->boolean('approved')->default(false)->index();
            $table->string('approved_by')->nullable();
            $table->datetime('approved_at')->nullable();
            $table->softDeletes();
        });
    }

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