<?php

namespace App\Http\Controllers\v1\Tenancy\Visit;

use App\Http\Controllers\Controller;
use App\Models\Tenancy\Visit;
use Spatie\QueryBuilder\QueryBuilder;

class GetCurrentVisits extends Controller
{
    public function __invoke()
    {
        return $this->ok(
            QueryBuilder::for(Visit::with('clientProcedure', 'clientProcedure.procedure'))
                ->where('client_id', auth()->user()->detail->id)
                ->where('status', 'current')
                ->jsonPaginate()
        );
    }
}
