<?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('work_settings', function (Blueprint $table) {
            $table->id();
            $table->foreignId('tenant_id')->unique()->comment('테넌트 ID');
            $table->string('work_type', 20)->default('fixed')->comment('근무유형: fixed/flexible/custom');
            $table->integer('standard_hours')->default(40)->comment('주당 소정근로시간');
            $table->integer('overtime_hours')->default(12)->comment('주당 연장근로시간');
            $table->integer('overtime_limit')->default(52)->comment('연장근로한도');
            $table->json('work_days')->nullable()->comment('근무요일 ["mon","tue","wed","thu","fri"]');
            $table->time('start_time')->default('09:00:00')->comment('출근시간');
            $table->time('end_time')->default('18:00:00')->comment('퇴근시간');
            $table->integer('break_minutes')->default(60)->comment('휴게시간(분)');
            $table->time('break_start')->nullable()->default('12:00:00')->comment('휴게시작');
            $table->time('break_end')->nullable()->default('13:00:00')->comment('휴게종료');
            $table->timestamps();

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

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