<?php

namespace Tops\AmazonSellingPartnerAPI\Api;

use Tops\AmazonSellingPartnerAPI\Helpers\SellingPartnerApiRequest;
use Tops\AmazonSellingPartnerAPI\Configuration;

class BaseApi
{
    use SellingPartnerApiRequest;

    protected $config;

    public function __construct($data)
    {
        $config = new Configuration();
        //access token of Selling Partner
        $config->setAccessToken($data['access_token']);
        $config->setApiKey('accessKey', $data['access_key']);
        $config->setApiKey('secretKey', $data['secret_key']);
        $config->setApiKey('region', $data['region']);
        $config->setHost($data['host']);
        if(isset($data['put_type'])){
            $config->setPutType($data['put_type']);
        }

        if(isset($data['session_token'])){
            $config->setSessionToken($data['session_token']);
        }

        $this->config = $config;
    }
}
