<?php

namespace App\Http\Controllers;

use App\Services\ProviderCalendarService;
use Illuminate\Http\JsonResponse;

class ProviderCalendarController extends Controller
{
    public function __construct(private readonly ProviderCalendarService $service) {}

    public function index(): JsonResponse
    {
        try {
            $dados = $this->service->getCalendar();

            return $this->successResponse(payload: $dados);
        } catch (\Exception $e) {
            return $this->errorResponse(message: __('messages.error_fetching_data'), code: 500, exception: $e);
        }
    }
}
