<?php

namespace App\Modules\AvailableRequests\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Resources\AvailableShopperRequestResource;
use App\Modules\AvailableRequests\Services\AvailableRequestService;


class AvailableRequestController extends Controller
{
    public function __construct(
        protected AvailableRequestService $service
    ) {}

    public function index()
    {
        $requests = $this->service->getAvailableRequests();

        return AvailableShopperRequestResource::collection($requests);
    }
    public function show($id)
    {
        $request = $this->service->showAvailableRequest($id);

        return new AvailableShopperRequestResource($request);
    }

    public function items($id)
    {
        return $this->service->getRequestItems($id);
    }
}