<?php

namespace App\Modules\HR\Attendance\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class AttendanceImportRow extends Model
{
    protected $fillable = [
        'attendance_import_id', 'row_number', 'employee_code',
        'attendance_date', 'check_in', 'check_out', 'errors', 'is_valid',
    ];

    protected function casts(): array
    {
        return [
            'attendance_date' => 'date',
            'errors' => 'array',
            'is_valid' => 'boolean',
        ];
    }

    public function import(): BelongsTo
    {
        return $this->belongsTo(AttendanceImport::class, 'attendance_import_id');
    }
}
