<?php

namespace Myvetshop\Module\Clinique\Generated\Jane;

class Client extends \Myvetshop\Module\Clinique\Generated\Jane\Runtime\Client\Client
{
    /**
     * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
     *
     * @return \Myvetshop\Module\Clinique\Generated\Jane\Model\ClinicsGetResponse200Item[]|\Psr\Http\Message\ResponseInterface|null
     *
     * @throws \Myvetshop\Module\Clinique\Generated\Jane\Exception\GetClinicsBadRequestException
     * @throws \Myvetshop\Module\Clinique\Generated\Jane\Exception\GetClinicsForbiddenException
     */
    public function getClinics(string $fetch = self::FETCH_OBJECT)
    {
        return $this->executeEndpoint(new \Myvetshop\Module\Clinique\Generated\Jane\Endpoint\GetClinics(), $fetch);
    }

    /**
     * List orders
     *
     * @param array $queryParameters {
     *
     *     @var string $datemin Min date to filter orders
     *     @var string $datemax Max date to filter orders
     * }
     *
     * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
     *
     * @return \Myvetshop\Module\Clinique\Generated\Jane\Model\OrdersGetResponse200Item[]|\Psr\Http\Message\ResponseInterface|null
     *
     * @throws \Myvetshop\Module\Clinique\Generated\Jane\Exception\GetOrdersBadRequestException
     * @throws \Myvetshop\Module\Clinique\Generated\Jane\Exception\GetOrdersForbiddenException
     */
    public function getOrders(array $queryParameters = [], string $fetch = self::FETCH_OBJECT)
    {
        return $this->executeEndpoint(new \Myvetshop\Module\Clinique\Generated\Jane\Endpoint\GetOrders($queryParameters), $fetch);
    }

    /**
     * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
     *
     * @return \Myvetshop\Module\Clinique\Generated\Jane\Model\ProductCategoriesGetResponse200Item[]|\Psr\Http\Message\ResponseInterface|null
     *
     * @throws \Myvetshop\Module\Clinique\Generated\Jane\Exception\GetProductCategoriesForbiddenException
     */
    public function getProductCategories(string $fetch = self::FETCH_OBJECT)
    {
        return $this->executeEndpoint(new \Myvetshop\Module\Clinique\Generated\Jane\Endpoint\GetProductCategories(), $fetch);
    }

    /**
     * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE)
     *
     * @return \Myvetshop\Module\Clinique\Generated\Jane\Model\ProductManufacturersGetResponse200Item[]|\Psr\Http\Message\ResponseInterface|null
     *
     * @throws \Myvetshop\Module\Clinique\Generated\Jane\Exception\GetProductManufacturersForbiddenException
     */
    public function getProductManufacturers(string $fetch = self::FETCH_OBJECT)
    {
        return $this->executeEndpoint(new \Myvetshop\Module\Clinique\Generated\Jane\Endpoint\GetProductManufacturers(), $fetch);
    }

    public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = [])
    {
        if (null === $httpClient) {
            $httpClient = \Http\Discovery\Psr18ClientDiscovery::find();
            $plugins = [];
            if (count($additionalPlugins) > 0) {
                $plugins = array_merge($plugins, $additionalPlugins);
            }
            $httpClient = new \Http\Client\Common\PluginClient($httpClient, $plugins);
        }
        $requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory();
        $streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory();
        $normalizers = [new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \Myvetshop\Module\Clinique\Generated\Jane\Normalizer\JaneObjectNormalizer()];
        if (count($additionalNormalizers) > 0) {
            $normalizers = array_merge($normalizers, $additionalNormalizers);
        }
        $serializer = new \Symfony\Component\Serializer\Serializer($normalizers, [new \Symfony\Component\Serializer\Encoder\JsonEncoder(new \Symfony\Component\Serializer\Encoder\JsonEncode(), new \Symfony\Component\Serializer\Encoder\JsonDecode(['json_decode_associative' => true]))]);

        return new static($httpClient, $requestFactory, $serializer, $streamFactory);
    }
}
