/* tslint:disable */
/* eslint-disable */
/**
 * Commander Spellbook API
 * API for Commander Spellbook, the combo database engine for Magic: The Gathering
 *
 * The version of the OpenAPI document: 4.2.2
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as runtime from '../runtime';
import type {
  DeckRequest,
  EstimateBracketResult,
} from '../models/index';
import {
    DeckRequestFromJSON,
    DeckRequestToJSON,
    EstimateBracketResultFromJSON,
    EstimateBracketResultToJSON,
} from '../models/index';

export interface EstimateBracketCreateRequest {
    deckRequest?: DeckRequest;
}

/**
 * 
 */
export class EstimateBracketApi extends runtime.BaseAPI {

    /**
     */
    async estimateBracketCreateRaw(requestParameters: EstimateBracketCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EstimateBracketResult>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("jwtAuth", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/estimate-bracket`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: DeckRequestToJSON(requestParameters['deckRequest']),
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => EstimateBracketResultFromJSON(jsonValue));
    }

    /**
     */
    async estimateBracketCreate(requestParameters: EstimateBracketCreateRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EstimateBracketResult> {
        const response = await this.estimateBracketCreateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async estimateBracketRetrieveRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EstimateBracketResult>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) {
            headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password);
        }
        if (this.configuration && this.configuration.accessToken) {
            const token = this.configuration.accessToken;
            const tokenString = await token("jwtAuth", []);

            if (tokenString) {
                headerParameters["Authorization"] = `Bearer ${tokenString}`;
            }
        }
        const response = await this.request({
            path: `/estimate-bracket`,
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => EstimateBracketResultFromJSON(jsonValue));
    }

    /**
     */
    async estimateBracketRetrieve(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EstimateBracketResult> {
        const response = await this.estimateBracketRetrieveRaw(initOverrides);
        return await response.value();
    }

}
