<?php

namespace App\Modules\HR\Attendance\Repositories;

use App\Modules\HR\Attendance\Models\AttendancePolicy;

class AttendancePolicyRepository
{
    public function forTenant(int $tenantId): ?AttendancePolicy
    {
        return AttendancePolicy::query()->where('tenant_id', $tenantId)->first();
    }

    public function save(int $tenantId, array $data): AttendancePolicy
    {
        return AttendancePolicy::query()->updateOrCreate(
            ['tenant_id' => $tenantId],
            $data,
        );
    }
}
