<?php

/**
 * PriceListsApiTest
 * PHP version 7.4
 *
 * @category Class
 * @package  FattureInCloud
 * @author   Fatture In Cloud API team
 * @link     https://fattureincloud.it
 */

/**
 * Fatture in Cloud API v2 - API Reference
 *
 * Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 500.000 businesses in Italy.   The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol.
 *
 * The version of the OpenAPI document: 2.1.5
 * Contact: info@fattureincloud.it
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.12.0
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Please update the test case below to test the endpoint.
 */

namespace FattureInCloud\Test\Api;

use \FattureInCloud\Configuration;
use \FattureInCloud\ApiException;
use \FattureInCloud\ObjectSerializer;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;

/**
 * PriceListsApiTest Class Doc Comment
 *
 * @category Class
 * @package  FattureInCloud
 * @author   Fatture In Cloud API team
 * @link     https://fattureincloud.it
 */
class PriceListsApiTest extends TestCase
{
    /**
     * Setup before running any test cases
     */
    public static function setUpBeforeClass(): void
    {
    }

    /**
     * Setup before running each test case
     */
    public function setUp(): void
    {
    }

    /**
     * Clean up after running each test case
     */
    public function tearDown(): void
    {
    }

    /**
     * Clean up after running all test cases
     */
    public static function tearDownAfterClass(): void
    {
    }

    /**
     * Test case for getPriceListItems
     *
     * Get PriceList Items List.
     *
     */
    public function testGetPriceListItems()
    {
        $stream = '{"data": {"1": {"price": 3.5},"2": {"price": 5}}}';
        $mock = new MockHandler([new Response(
            200,
            ['Content-Type' => 'application/json'],
            $stream
        )]);

        $handler = HandlerStack::create($mock);
        $apiInstance = new \FattureInCloud\Api\PriceListsApi(
            new \GuzzleHttp\Client(['handler' => $handler])
        );
        $company_id = 2;
        $get_price_lists_items_request = 'json';
        $result = $apiInstance->getPriceListItems($company_id, $get_price_lists_items_request);
        $obj = ObjectSerializer::deserialize($stream, '\FattureInCloud\Model\GetPriceListItemsResponse');

        TestCase::assertEquals($obj, $result);
    }

    /**
     * Test case for getPriceLists
     *
     * Get PriceLists.
     *
     */
    public function testGetPriceLists()
    {
        $stream = '{"data": [{"id": "10","name": "listino","prices_type": "net","is_default": true,"valid_from": "2025-01-01","valid_to": "2025-12-01","type": "sell"},{"id": "11","name": "listino-test","prices_type": "gross","is_default": true,"valid_from": "2025-01-01","valid_to": "2025-01-01","type": "purchase"}]}';
        $mock = new MockHandler([new Response(
            200,
            ['Content-Type' => 'application/json'],
            $stream
        )]);

        $handler = HandlerStack::create($mock);
        $apiInstance = new \FattureInCloud\Api\PriceListsApi(
            new \GuzzleHttp\Client(['handler' => $handler])
        );
        $company_id = 2;
        $get_price_lists_request = 'json';
        $result = $apiInstance->getPriceLists($company_id, $get_price_lists_request);
        $obj = ObjectSerializer::deserialize($stream, '\FattureInCloud\Model\ListPriceListsResponse');

        TestCase::assertEquals($obj, $result);
    }
}
