<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class DailyAttendance extends Model
{
    use HasFactory;

    protected $table = 'daily_attendance';

    protected $fillable = [
        'employee_id', 'date', 'first_in', 'last_out', 'worked_minutes',
        'late', 'early_out', 'status',
    ];

    protected function casts(): array
    {
        return [
            'date' => 'date:Y-m-d',
            'first_in' => 'datetime',
            'last_out' => 'datetime',
            'late' => 'boolean',
            'early_out' => 'boolean',
        ];
    }

    public function employee()
    {
        return $this->belongsTo(Employee::class);
    }
}
