<?php

namespace Modules\Package\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\Response\ResponseService;
use Illuminate\Http\Request;

use Modules\Package\Resources\Api\PackageResource;
use Modules\Package\Services\PackageService;
class PackageController extends Controller
{

    public function __construct(
        private PackageService $packageService,
    ) {
    }
    /**
     * Get Packages.
     *
     * @param Request $request
     * @return void
     */
    public function index(Request $request): void
    {
        $credentials['api'] = true;
        $query = $this->packageService->get($credentials);

        $response = [
            "query" => $query,
            "request" => $request,
            "resourceClass" => PackageResource::class,
            "returnName" => "packages"
        ];
        ResponseService::fetchPainateDate($response);
    }



}
