<?php
/**
 * POS Mobile API
 *
 * The version of the OpenAPI document: 68
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.1
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Adyen\Service;

use Adyen\AdyenException;
use Adyen\Client;
use Adyen\Service;
use Adyen\Model\PosMobile\ObjectSerializer;

class PosMobileApi extends Service
{
    /**
     * @var array|string|string[]
     */
    private $baseURL;

    /**
     * PosMobileApi constructor.
     *
     * @param \Adyen\Client $client
     * @throws AdyenException
     */
    public function __construct(Client $client)
    {
        parent::__construct($client);

        // Create the baseUrl based on live/test and optional live-url-prefix
        $this->baseURL = $this->createBaseUrl("https://checkout-test.adyen.com/checkout/possdk/v68");
    }

    /**
    * Create a communication session
    *
    * @param \Adyen\Model\PosMobile\CreateSessionRequest $createSessionRequest
    * @param array|null $requestOptions
    * @return \Adyen\Model\PosMobile\CreateSessionResponse
    * @throws AdyenException
    */
    public function createCommunicationSession(\Adyen\Model\PosMobile\CreateSessionRequest $createSessionRequest, array $requestOptions = null): \Adyen\Model\PosMobile\CreateSessionResponse
    {
        $endpoint = $this->baseURL . "/sessions";
        $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $createSessionRequest->jsonSerialize(), $requestOptions);
        return ObjectSerializer::deserialize($response, \Adyen\Model\PosMobile\CreateSessionResponse::class);
    }
}
