<?php
namespace Api\Controllers\V1;

use Api\Core\Request;
use Api\Core\Response;
use ElixForms\ElixFormsClient;

class ExampleController
{
    private ElixFormsClient $elixFormsClient;

    public function __construct(ElixFormsClient $elixFormsClient)
    {
        $this->elixFormsClient = $elixFormsClient;
    }

    public function test(Request $req, Response $res)
    {
        $response = $this->elixFormsClient->request('GET', '/status');

        return $res->json([
            'external_api_response' => $response['json'] ?? $response['body'],
            'status' => $response['status']
        ]);
    }
}
