<?php

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

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

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