/*
 * Michelin North America Order-to-Cash APIs
 * These APIs will help you to do business transactions with Michelin.  <br><br><b>Authentication details:</b><br> <br><u>Option A:</u> OAuth2 Client Credentials (recommended) <br><u>Option B:</u> API Key + Basic Authentication (not recommended) <br><br>To request your access, please contact your representative. <br><br>Our services are based on the EDIWHEEL standards. <br>You can find more information on the <a href=\"https://www.ediwheel.com/\" target=\"_blank\">EDIWHEEL website</a>. 
 *
 * The version of the OpenAPI document: 1.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.
 */


package com.michelin.adk.amn.o2c;

import com.michelin.adk.amn.ApiCallback;
import com.michelin.adk.amn.ApiClient;
import com.michelin.adk.amn.ApiException;
import com.michelin.adk.amn.ApiResponse;
import com.michelin.adk.amn.Configuration;
import com.michelin.adk.amn.Pair;
import com.michelin.adk.amn.ProgressRequestBody;
import com.michelin.adk.amn.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.michelin.adk.amn.o2c.model.EDIWheelC11StockInquiryRequest;
import com.michelin.adk.amn.o2c.model.EDIWheelC11StockInquiryResponse;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class InventoryApi {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public InventoryApi() {
        this(Configuration.getDefaultApiClient());
    }

    public InventoryApi(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    /**
     * Build call for stockAmnC11InquiryPost
     * @param edIWheelC11StockInquiryRequest  (required)
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Inquiry Quoted </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Not Found </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 415 </td><td> Unsupported Media Type </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Too Many Requests </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call stockAmnC11InquiryPostCall(EDIWheelC11StockInquiryRequest edIWheelC11StockInquiryRequest, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = edIWheelC11StockInquiryRequest;

        // create path and map variables
        String localVarPath = "/stock/amn/C1_1/inquiry";

        List<Pair> localVarQueryParams = new ArrayList<Pair>();
        List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
        Map<String, String> localVarHeaderParams = new HashMap<String, String>();
        Map<String, String> localVarCookieParams = new HashMap<String, String>();
        Map<String, Object> localVarFormParams = new HashMap<String, Object>();

        final String[] localVarAccepts = {
            "application/json",
            "*/*"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            "application/json"
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "oAuth2ClientCredentials", "apikey", "basicAuth" };
        return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call stockAmnC11InquiryPostValidateBeforeCall(EDIWheelC11StockInquiryRequest edIWheelC11StockInquiryRequest, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'edIWheelC11StockInquiryRequest' is set
        if (edIWheelC11StockInquiryRequest == null) {
            throw new ApiException("Missing the required parameter 'edIWheelC11StockInquiryRequest' when calling stockAmnC11InquiryPost(Async)");
        }

        return stockAmnC11InquiryPostCall(edIWheelC11StockInquiryRequest, _callback);

    }

    /**
     * Query inventory in real-time
     * Query inventory in real-time
     * @param edIWheelC11StockInquiryRequest  (required)
     * @return EDIWheelC11StockInquiryResponse
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Inquiry Quoted </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Not Found </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 415 </td><td> Unsupported Media Type </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Too Many Requests </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public EDIWheelC11StockInquiryResponse stockAmnC11InquiryPost(EDIWheelC11StockInquiryRequest edIWheelC11StockInquiryRequest) throws ApiException {
        ApiResponse<EDIWheelC11StockInquiryResponse> localVarResp = stockAmnC11InquiryPostWithHttpInfo(edIWheelC11StockInquiryRequest);
        return localVarResp.getData();
    }

    /**
     * Query inventory in real-time
     * Query inventory in real-time
     * @param edIWheelC11StockInquiryRequest  (required)
     * @return ApiResponse&lt;EDIWheelC11StockInquiryResponse&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Inquiry Quoted </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Not Found </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 415 </td><td> Unsupported Media Type </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Too Many Requests </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public ApiResponse<EDIWheelC11StockInquiryResponse> stockAmnC11InquiryPostWithHttpInfo(EDIWheelC11StockInquiryRequest edIWheelC11StockInquiryRequest) throws ApiException {
        okhttp3.Call localVarCall = stockAmnC11InquiryPostValidateBeforeCall(edIWheelC11StockInquiryRequest, null);
        Type localVarReturnType = new TypeToken<EDIWheelC11StockInquiryResponse>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    /**
     * Query inventory in real-time (asynchronously)
     * Query inventory in real-time
     * @param edIWheelC11StockInquiryRequest  (required)
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     * @http.response.details
     <table border="1">
       <caption>Response Details</caption>
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        <tr><td> 200 </td><td> Inquiry Quoted </td><td>  -  </td></tr>
        <tr><td> 400 </td><td> Invalid Request </td><td>  -  </td></tr>
        <tr><td> 401 </td><td> Unauthorized </td><td>  -  </td></tr>
        <tr><td> 403 </td><td> Forbidden </td><td>  -  </td></tr>
        <tr><td> 404 </td><td> Not Found </td><td>  -  </td></tr>
        <tr><td> 408 </td><td> Request Timeout </td><td>  -  </td></tr>
        <tr><td> 415 </td><td> Unsupported Media Type </td><td>  -  </td></tr>
        <tr><td> 429 </td><td> Too Many Requests </td><td>  -  </td></tr>
        <tr><td> 500 </td><td> Internal Server Error </td><td>  -  </td></tr>
     </table>
     */
    public okhttp3.Call stockAmnC11InquiryPostAsync(EDIWheelC11StockInquiryRequest edIWheelC11StockInquiryRequest, final ApiCallback<EDIWheelC11StockInquiryResponse> _callback) throws ApiException {

        okhttp3.Call localVarCall = stockAmnC11InquiryPostValidateBeforeCall(edIWheelC11StockInquiryRequest, _callback);
        Type localVarReturnType = new TypeToken<EDIWheelC11StockInquiryResponse>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }
}
