<?php

namespace App\Models\Hr;

use App\Models\User;
use App\Traits\BelongsToStore;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class AttendanceRecord extends Model
{
    use BelongsToStore;

    protected $fillable = [
        'store_id', 'user_id', 'attendance_date', 'clock_in', 'clock_out',
        'status', 'overtime_hours', 'remark',
    ];

    protected function casts(): array
    {
        return [
            'status' => 'integer',
            'overtime_hours' => 'decimal:1',
            'attendance_date' => 'date',
        ];
    }

    public function user(): BelongsTo
    {
        return $this->belongsTo(User::class);
    }
}
