<?php

namespace PloverCRM\Core\Api\V2;

use PloverCRM\Core\Api\AbstractEndpoint;
use PloverCRM\Core\Services\FrontendBootstrapBuilder;
use WP_REST_Request;

/**
 * Bootstrap endpoint for the standalone app host contract.
 */
class BootstrapEndpoint extends AbstractEndpoint
{
    public function getRoute(): string
    {
        return '/bootstrap';
    }

    public function getMethod()
    {
        return 'GET';
    }

    public function handle(WP_REST_Request $request)
    {
        return $this->success(FrontendBootstrapBuilder::build($this->container));
    }
}
