<?php

namespace App\Modules\HR\Attendance\Models;

use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class BiometricLog extends Model
{
    use BelongsToTenant;

    protected $fillable = [
        'tenant_id',
        'employee_fingerprint_id',
        'device_id',
        'punch_time',
        'raw_payload',
        'processed_at',
    ];

    protected function casts(): array
    {
        return [
            'punch_time' => 'datetime',
            'raw_payload' => 'array',
            'processed_at' => 'datetime',
        ];
    }

    public function device(): BelongsTo
    {
        return $this->belongsTo(BiometricDevice::class, 'device_id');
    }
}
