<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     * Add device information columns for check-in and check-out
     */
    public function up(): void
    {
        Schema::table('attendances', function (Blueprint $table) {
            // Device info saat check-in
            $table->string('check_in_device_model')->nullable()->after('check_in_notes');
            $table->string('check_in_device_brand')->nullable()->after('check_in_device_model');
            $table->string('check_in_os_version')->nullable()->after('check_in_device_brand');
            $table->string('check_in_app_version')->nullable()->after('check_in_os_version');

            // Device info saat check-out
            $table->string('check_out_device_model')->nullable()->after('check_out_notes');
            $table->string('check_out_device_brand')->nullable()->after('check_out_device_model');
            $table->string('check_out_os_version')->nullable()->after('check_out_device_brand');
            $table->string('check_out_app_version')->nullable()->after('check_out_os_version');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('attendances', function (Blueprint $table) {
            $table->dropColumn([
                'check_in_device_model',
                'check_in_device_brand',
                'check_in_os_version',
                'check_in_app_version',
                'check_out_device_model',
                'check_out_device_brand',
                'check_out_os_version',
                'check_out_app_version',
            ]);
        });
    }
};
