<?php

namespace App\Modules\HR\Attendance\Models;

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

class AttendanceImport extends Model
{
    use BelongsToTenant;

    protected $fillable = [
        'tenant_id', 'uploaded_by', 'original_name', 'status',
        'total_rows', 'valid_rows', 'error_rows', 'committed_at',
    ];

    protected function casts(): array
    {
        return ['committed_at' => 'datetime'];
    }

    public function rows(): HasMany
    {
        return $this->hasMany(AttendanceImportRow::class);
    }
}
