<?php

namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Resources\Projects\ProjectsResource;
use App\Http\Resources\Projects\SingleProjectsResource;
use App\Services\ProjectsService;

class ProjectsController extends Controller
{
    public function __construct(private ProjectsService $service)
    {

    }
    public function getOne($id)
    {
        $data = $this->service->getOne($id);
        $response = new SingleProjectsResource($data);
        return response()->json($response);
    }
    public function getAll()
    {
        $data = $this->service->getAll();
        $response = ProjectsResource::collection($data);
        return response()->json($response);
    }

}