<?php

namespace App\Domains\Bootstrap\Controllers;

use App\Domains\Bootstrap\Requests\TenantBootstrapRequest;
use App\Domains\Bootstrap\Services\TenantBootstrapService;
use App\Domains\Tenant\Resources\TenantResource;
use App\Http\Controllers\Controller;

class TenantBootstrapController extends Controller
{
    public function __construct(protected TenantBootstrapService $bootstrapService) {}

    public function __invoke(TenantBootstrapRequest $request): TenantResource
    {
        return TenantResource::make(
            $this->bootstrapService->get(
                (string) $request->validated('dominio'),
                (string) $request->validated('path'),
            )
        );
    }
}
