/* tslint:disable */
/* eslint-disable */
/**
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document:
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import {
  DUMMY_BASE_URL,
  assertParamExists,
  setApiKeyToObject,
  setBasicAuthToObject,
  setBearerAuthToObject,
  setOAuthToObject,
  setSearchParams,
  serializeDataIfNeeded,
  toPathString,
  createRequestFunction
} from '../common';
// @ts-ignore
import {
  BASE_PATH,
  COLLECTION_FORMATS,
  type RequestArgs,
  BaseAPI,
  RequiredError,
  operationServerMap
} from '../base';
// @ts-ignore
import type { KamiApiCamelOilV1GetPrefetchOrderLogsRes } from '../models';
// @ts-ignore
import type { KamiApiCamelOilV1ListPrefetchOrderRes } from '../models';
/**
 * JDV2PrefetchApi - axios parameter creator
 */
export const JDV2PrefetchApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     *
     * @summary 获取预拉取订单日志
     * @param {string} startTime 开始时间
     * @param {string} endTime 结束时间
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdV2PrefetchLogsGet: async (
      startTime: string,
      endTime: string,
      options: RawAxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'startTime' is not null or undefined
      assertParamExists('apiJdV2PrefetchLogsGet', 'startTime', startTime);
      // verify required parameter 'endTime' is not null or undefined
      assertParamExists('apiJdV2PrefetchLogsGet', 'endTime', endTime);
      const localVarPath = `/api/jd-v2/prefetch/logs`;
      // use dummy base URL string because the URL constructor only accepts absolute URLs.
      const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
      let baseOptions;
      if (configuration) {
        baseOptions = configuration.baseOptions;
      }

      const localVarRequestOptions = {
        method: 'GET',
        ...baseOptions,
        ...options
      };
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      if (startTime !== undefined) {
        localVarQueryParameter['startTime'] = startTime;
      }

      if (endTime !== undefined) {
        localVarQueryParameter['endTime'] = endTime;
      }

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions =
        baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions
      };
    },
    /**
     *
     * @summary 获取预拉取订单列表
     * @param {number} current 页数
     * @param {ApiJdV2PrefetchOrdersGetPageSizeEnum} pageSize 页码
     * @param {number} [accountId] 账号ID
     * @param {string} [accountName] 账号名称
     * @param {number} [amount] 订单金额
     * @param {string} [platformOrderNo] 平台订单号
     * @param {ApiJdV2PrefetchOrdersGetStatusEnum} [status] 状态：1待匹配 2已匹配 3已过期 4已失效
     * @param {Array<string>} [dateRange] 时间范围
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdV2PrefetchOrdersGet: async (
      current: number,
      pageSize: ApiJdV2PrefetchOrdersGetPageSizeEnum,
      accountId?: number,
      accountName?: string,
      amount?: number,
      platformOrderNo?: string,
      status?: ApiJdV2PrefetchOrdersGetStatusEnum,
      dateRange?: Array<string>,
      options: RawAxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'current' is not null or undefined
      assertParamExists('apiJdV2PrefetchOrdersGet', 'current', current);
      // verify required parameter 'pageSize' is not null or undefined
      assertParamExists('apiJdV2PrefetchOrdersGet', 'pageSize', pageSize);
      const localVarPath = `/api/jd-v2/prefetch/orders`;
      // use dummy base URL string because the URL constructor only accepts absolute URLs.
      const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
      let baseOptions;
      if (configuration) {
        baseOptions = configuration.baseOptions;
      }

      const localVarRequestOptions = {
        method: 'GET',
        ...baseOptions,
        ...options
      };
      const localVarHeaderParameter = {} as any;
      const localVarQueryParameter = {} as any;

      if (current !== undefined) {
        localVarQueryParameter['current'] = current;
      }

      if (pageSize !== undefined) {
        localVarQueryParameter['pageSize'] = pageSize;
      }

      if (accountId !== undefined) {
        localVarQueryParameter['accountId'] = accountId;
      }

      if (accountName !== undefined) {
        localVarQueryParameter['accountName'] = accountName;
      }

      if (amount !== undefined) {
        localVarQueryParameter['amount'] = amount;
      }

      if (platformOrderNo !== undefined) {
        localVarQueryParameter['platformOrderNo'] = platformOrderNo;
      }

      if (status !== undefined) {
        localVarQueryParameter['status'] = status;
      }

      if (dateRange) {
        localVarQueryParameter['dateRange'] = dateRange;
      }

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions =
        baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions
      };
    }
  };
};

/**
 * JDV2PrefetchApi - functional programming interface
 */
export const JDV2PrefetchApiFp = function (configuration?: Configuration) {
  const localVarAxiosParamCreator =
    JDV2PrefetchApiAxiosParamCreator(configuration);
  return {
    /**
     *
     * @summary 获取预拉取订单日志
     * @param {string} startTime 开始时间
     * @param {string} endTime 结束时间
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async apiJdV2PrefetchLogsGet(
      startTime: string,
      endTime: string,
      options?: RawAxiosRequestConfig
    ): Promise<
      (
        axios?: AxiosInstance,
        basePath?: string
      ) => AxiosPromise<KamiApiCamelOilV1GetPrefetchOrderLogsRes>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.apiJdV2PrefetchLogsGet(
          startTime,
          endTime,
          options
        );
      const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
      const localVarOperationServerBasePath =
        operationServerMap['JDV2PrefetchApi.apiJdV2PrefetchLogsGet']?.[
          localVarOperationServerIndex
        ]?.url;
      return (axios, basePath) =>
        createRequestFunction(
          localVarAxiosArgs,
          globalAxios,
          BASE_PATH,
          configuration
        )(axios, localVarOperationServerBasePath || basePath);
    },
    /**
     *
     * @summary 获取预拉取订单列表
     * @param {number} current 页数
     * @param {ApiJdV2PrefetchOrdersGetPageSizeEnum} pageSize 页码
     * @param {number} [accountId] 账号ID
     * @param {string} [accountName] 账号名称
     * @param {number} [amount] 订单金额
     * @param {string} [platformOrderNo] 平台订单号
     * @param {ApiJdV2PrefetchOrdersGetStatusEnum} [status] 状态：1待匹配 2已匹配 3已过期 4已失效
     * @param {Array<string>} [dateRange] 时间范围
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async apiJdV2PrefetchOrdersGet(
      current: number,
      pageSize: ApiJdV2PrefetchOrdersGetPageSizeEnum,
      accountId?: number,
      accountName?: string,
      amount?: number,
      platformOrderNo?: string,
      status?: ApiJdV2PrefetchOrdersGetStatusEnum,
      dateRange?: Array<string>,
      options?: RawAxiosRequestConfig
    ): Promise<
      (
        axios?: AxiosInstance,
        basePath?: string
      ) => AxiosPromise<KamiApiCamelOilV1ListPrefetchOrderRes>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.apiJdV2PrefetchOrdersGet(
          current,
          pageSize,
          accountId,
          accountName,
          amount,
          platformOrderNo,
          status,
          dateRange,
          options
        );
      const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
      const localVarOperationServerBasePath =
        operationServerMap['JDV2PrefetchApi.apiJdV2PrefetchOrdersGet']?.[
          localVarOperationServerIndex
        ]?.url;
      return (axios, basePath) =>
        createRequestFunction(
          localVarAxiosArgs,
          globalAxios,
          BASE_PATH,
          configuration
        )(axios, localVarOperationServerBasePath || basePath);
    }
  };
};

/**
 * JDV2PrefetchApi - factory interface
 */
export const JDV2PrefetchApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = JDV2PrefetchApiFp(configuration);
  return {
    /**
     *
     * @summary 获取预拉取订单日志
     * @param {JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdV2PrefetchLogsGet(
      requestParameters: JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest,
      options?: RawAxiosRequestConfig
    ): AxiosPromise<KamiApiCamelOilV1GetPrefetchOrderLogsRes> {
      return localVarFp
        .apiJdV2PrefetchLogsGet(
          requestParameters.startTime,
          requestParameters.endTime,
          options
        )
        .then(request => request(axios, basePath));
    },
    /**
     *
     * @summary 获取预拉取订单列表
     * @param {JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdV2PrefetchOrdersGet(
      requestParameters: JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest,
      options?: RawAxiosRequestConfig
    ): AxiosPromise<KamiApiCamelOilV1ListPrefetchOrderRes> {
      return localVarFp
        .apiJdV2PrefetchOrdersGet(
          requestParameters.current,
          requestParameters.pageSize,
          requestParameters.accountId,
          requestParameters.accountName,
          requestParameters.amount,
          requestParameters.platformOrderNo,
          requestParameters.status,
          requestParameters.dateRange,
          options
        )
        .then(request => request(axios, basePath));
    }
  };
};

/**
 * JDV2PrefetchApi - interface
 */
export interface JDV2PrefetchApiInterface {
  /**
   *
   * @summary 获取预拉取订单日志
   * @param {JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  apiJdV2PrefetchLogsGet(
    requestParameters: JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest,
    options?: RawAxiosRequestConfig
  ): AxiosPromise<KamiApiCamelOilV1GetPrefetchOrderLogsRes>;

  /**
   *
   * @summary 获取预拉取订单列表
   * @param {JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  apiJdV2PrefetchOrdersGet(
    requestParameters: JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest,
    options?: RawAxiosRequestConfig
  ): AxiosPromise<KamiApiCamelOilV1ListPrefetchOrderRes>;
}

/**
 * Request parameters for apiJdV2PrefetchLogsGet operation in JDV2PrefetchApi.
 */
export interface JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest {
  /**
   * 开始时间
   */
  readonly startTime: string;

  /**
   * 结束时间
   */
  readonly endTime: string;
}

/**
 * Request parameters for apiJdV2PrefetchOrdersGet operation in JDV2PrefetchApi.
 */
export interface JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest {
  /**
   * 页数
   */
  readonly current: number;

  /**
   * 页码
   */
  readonly pageSize: ApiJdV2PrefetchOrdersGetPageSizeEnum;

  /**
   * 账号ID
   */
  readonly accountId?: number;

  /**
   * 账号名称
   */
  readonly accountName?: string;

  /**
   * 订单金额
   */
  readonly amount?: number;

  /**
   * 平台订单号
   */
  readonly platformOrderNo?: string;

  /**
   * 状态：1待匹配 2已匹配 3已过期 4已失效
   */
  readonly status?: ApiJdV2PrefetchOrdersGetStatusEnum;

  /**
   * 时间范围
   */
  readonly dateRange?: Array<string>;
}

/**
 * JDV2PrefetchApi - object-oriented interface
 */
export class JDV2PrefetchApi
  extends BaseAPI
  implements JDV2PrefetchApiInterface
{
  /**
   *
   * @summary 获取预拉取订单日志
   * @param {JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  public apiJdV2PrefetchLogsGet(
    requestParameters: JDV2PrefetchApiApiJdV2PrefetchLogsGetRequest,
    options?: RawAxiosRequestConfig
  ) {
    return JDV2PrefetchApiFp(this.configuration)
      .apiJdV2PrefetchLogsGet(
        requestParameters.startTime,
        requestParameters.endTime,
        options
      )
      .then(request => request(this.axios, this.basePath));
  }

  /**
   *
   * @summary 获取预拉取订单列表
   * @param {JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  public apiJdV2PrefetchOrdersGet(
    requestParameters: JDV2PrefetchApiApiJdV2PrefetchOrdersGetRequest,
    options?: RawAxiosRequestConfig
  ) {
    return JDV2PrefetchApiFp(this.configuration)
      .apiJdV2PrefetchOrdersGet(
        requestParameters.current,
        requestParameters.pageSize,
        requestParameters.accountId,
        requestParameters.accountName,
        requestParameters.amount,
        requestParameters.platformOrderNo,
        requestParameters.status,
        requestParameters.dateRange,
        options
      )
      .then(request => request(this.axios, this.basePath));
  }
}

export enum ApiJdV2PrefetchOrdersGetPageSizeEnum {
  NUMBER_5 = 5,
  NUMBER_10 = 10,
  NUMBER_15 = 15,
  NUMBER_20 = 20,
  NUMBER_50 = 50,
  NUMBER_100 = 100
}
export enum ApiJdV2PrefetchOrdersGetStatusEnum {
  NUMBER_3 = 3,
  NUMBER_4 = 4,
  NUMBER_2 = 2,
  NUMBER_1 = 1
}
