<?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('absensis', function (Blueprint $table) {
    $table->id();
    $table->foreignId('karyawan_id')->constrained('karyawans');
    $table->date('tanggal');

    $table->time('jam_masuk')->nullable();
    $table->time('jam_pulang')->nullable();

    $table->string('foto_masuk')->nullable();
    $table->string('foto_pulang')->nullable();

    $table->decimal('latitude_masuk', 10, 7)->nullable();
    $table->decimal('longitude_masuk', 10, 7)->nullable();
    $table->decimal('latitude_pulang', 10, 7)->nullable();
    $table->decimal('longitude_pulang', 10, 7)->nullable();

    $table->enum('status_masuk', ['dalam_radius', 'luar_radius'])->nullable();
    $table->enum('status_pulang', ['dalam_radius', 'luar_radius'])->nullable();

    $table->integer('terlambat_menit')->nullable();
    $table->enum('status_waktu', ['tepat_waktu', 'terlambat'])->nullable();

    $table->timestamps();
});

    }

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