<?php
/**
 * POS Terminal Management API
 *
 * The version of the OpenAPI document: 1
 * 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\POSTerminalManagement\ObjectSerializer;

/**
 * This class is deprecated and NO LONGER updated
 *
 * <p>Support for the "classic" POS Terminal Management API has stopped. To automate assigning
 * terminals, you must use Management API: see
 * https://docs.adyen.com/point-of-sale/automating-terminal-management/assign-terminals-api/
 *
 * @deprecated Use Management API instead
 */
class POSTerminalManagementApi extends Service
{
    /**
     * @var array|string|string[]
     */
    private $baseURL;

    /**
     * POSTerminalManagementApi 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://postfmapi-test.adyen.com/postfmapi/terminal/v1");
    }

    /**
    * Assign terminals
    *
    * @deprecated since POS Terminal Management API v1. "Use [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview)."
    * @param \Adyen\Model\POSTerminalManagement\AssignTerminalsRequest $assignTerminalsRequest
    * @param array|null $requestOptions
    * @return \Adyen\Model\POSTerminalManagement\AssignTerminalsResponse
    * @throws AdyenException
    */
    public function assignTerminals(\Adyen\Model\POSTerminalManagement\AssignTerminalsRequest $assignTerminalsRequest, ?array $requestOptions = null): \Adyen\Model\POSTerminalManagement\AssignTerminalsResponse
    {
        $endpoint = $this->baseURL . "/assignTerminals";
        $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $assignTerminalsRequest->jsonSerialize(), $requestOptions);
        return ObjectSerializer::deserialize($response, \Adyen\Model\POSTerminalManagement\AssignTerminalsResponse::class);
    }

    /**
    * Get the account or store of a terminal
    *
    * @deprecated since POS Terminal Management API v1. "Use [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview)."
    * @param \Adyen\Model\POSTerminalManagement\FindTerminalRequest $findTerminalRequest
    * @param array|null $requestOptions
    * @return \Adyen\Model\POSTerminalManagement\FindTerminalResponse
    * @throws AdyenException
    */
    public function findTerminal(\Adyen\Model\POSTerminalManagement\FindTerminalRequest $findTerminalRequest, ?array $requestOptions = null): \Adyen\Model\POSTerminalManagement\FindTerminalResponse
    {
        $endpoint = $this->baseURL . "/findTerminal";
        $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $findTerminalRequest->jsonSerialize(), $requestOptions);
        return ObjectSerializer::deserialize($response, \Adyen\Model\POSTerminalManagement\FindTerminalResponse::class);
    }

    /**
    * Get the stores of an account
    *
    * @deprecated since POS Terminal Management API v1. "Use [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview)."
    * @param \Adyen\Model\POSTerminalManagement\GetStoresUnderAccountRequest $getStoresUnderAccountRequest
    * @param array|null $requestOptions
    * @return \Adyen\Model\POSTerminalManagement\GetStoresUnderAccountResponse
    * @throws AdyenException
    */
    public function getStoresUnderAccount(\Adyen\Model\POSTerminalManagement\GetStoresUnderAccountRequest $getStoresUnderAccountRequest, ?array $requestOptions = null): \Adyen\Model\POSTerminalManagement\GetStoresUnderAccountResponse
    {
        $endpoint = $this->baseURL . "/getStoresUnderAccount";
        $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $getStoresUnderAccountRequest->jsonSerialize(), $requestOptions);
        return ObjectSerializer::deserialize($response, \Adyen\Model\POSTerminalManagement\GetStoresUnderAccountResponse::class);
    }

    /**
    * Get the details of a terminal
    *
    * @deprecated since POS Terminal Management API v1. "Use [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview)."
    * @param \Adyen\Model\POSTerminalManagement\GetTerminalDetailsRequest $getTerminalDetailsRequest
    * @param array|null $requestOptions
    * @return \Adyen\Model\POSTerminalManagement\GetTerminalDetailsResponse
    * @throws AdyenException
    */
    public function getTerminalDetails(\Adyen\Model\POSTerminalManagement\GetTerminalDetailsRequest $getTerminalDetailsRequest, ?array $requestOptions = null): \Adyen\Model\POSTerminalManagement\GetTerminalDetailsResponse
    {
        $endpoint = $this->baseURL . "/getTerminalDetails";
        $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $getTerminalDetailsRequest->jsonSerialize(), $requestOptions);
        return ObjectSerializer::deserialize($response, \Adyen\Model\POSTerminalManagement\GetTerminalDetailsResponse::class);
    }

    /**
    * Get the list of terminals
    *
    * @deprecated since POS Terminal Management API v1. "Use [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview)."
    * @param \Adyen\Model\POSTerminalManagement\GetTerminalsUnderAccountRequest $getTerminalsUnderAccountRequest
    * @param array|null $requestOptions
    * @return \Adyen\Model\POSTerminalManagement\GetTerminalsUnderAccountResponse
    * @throws AdyenException
    */
    public function getTerminalsUnderAccount(\Adyen\Model\POSTerminalManagement\GetTerminalsUnderAccountRequest $getTerminalsUnderAccountRequest, ?array $requestOptions = null): \Adyen\Model\POSTerminalManagement\GetTerminalsUnderAccountResponse
    {
        $endpoint = $this->baseURL . "/getTerminalsUnderAccount";
        $response = $this->requestHttp($endpoint, strtolower('POST'), (array) $getTerminalsUnderAccountRequest->jsonSerialize(), $requestOptions);
        return ObjectSerializer::deserialize($response, \Adyen\Model\POSTerminalManagement\GetTerminalsUnderAccountResponse::class);
    }
}
