<?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('attendance_settings', function (Blueprint $table) {
            $table->id();
            $table->foreignId('tenant_id')->unique()->comment('테넌트 ID');
            $table->boolean('use_gps')->default(false)->comment('GPS 출퇴근 사용 여부');
            $table->integer('allowed_radius')->default(100)->comment('허용 반경(m)');
            $table->string('hq_address', 255)->nullable()->comment('본사 주소');
            $table->decimal('hq_latitude', 10, 8)->nullable()->comment('본사 위도');
            $table->decimal('hq_longitude', 11, 8)->nullable()->comment('본사 경도');
            $table->timestamps();

            $table->index('tenant_id');
        });
    }

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