<?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_posting_details', function (Blueprint $table) {
            $table->unsignedBigInteger('header_id')->index();
            $table->string('reference_no',50)->index();
            $table->string('employee_id')->index();
            $table->unsignedBigInteger('company_id')->index();
            $table->unsignedBigInteger('dealership_id')->index();
            $table->unsignedBigInteger('department_id')->index()->nullable();
            $table->decimal('days_absent',5,2)->default(0);
            $table->unsignedSmallInteger('minutes_late')->default(0);
            $table->unsignedSmallInteger('minutes_undertime')->default(0);
            $table->text('overtime_totals')->nullable();
            $table->text('holiday_totals')->nullable();
            $table->text('night_diff_totals')->nullable();
            $table->text('leave_totals')->nullable();
            $table->timestamps();
        });
    }

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