<?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::table('attendances', function (Blueprint $table) {
            // Explicitly set types without auto-updating behaviors
            // MySQL often adds 'on update CURRENT_TIMESTAMP' to the first TIMESTAMP column automatically.
            // Using dateTime() or explicitly nullable timestamp() usually avoids this.
            $table->dateTime('clock_in')->change();
            $table->dateTime('clock_out')->nullable()->change();
            $table->dateTime('break_start')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('attendances', function (Blueprint $table) {
            $table->timestamp('clock_in')->useCurrent()->useCurrentOnUpdate()->change();
            $table->timestamp('clock_out')->nullable()->change();
            $table->timestamp('break_start')->nullable()->change();
        });
    }
};
