/* tslint:disable */
import { Injectable } from '@angular/core';
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
import { BaseService as __BaseService } from '../base-service';
import { OmsConfiguration as __Configuration } from '../oms-configuration';
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
import { Observable as __Observable } from 'rxjs';
import { map as __map, filter as __filter } from 'rxjs/operators';

import { ResponseArgsOfIEnumerableOfReceiptListItemDTO } from '../models/response-args-of-ienumerable-of-receipt-list-item-dto';
import { ListResponseArgsOfReceiptListItemDTO } from '../models/list-response-args-of-receipt-list-item-dto';
import { QueryTokenDTO } from '../models/query-token-dto';
import { ResponseArgsOfReceiptDTO } from '../models/response-args-of-receipt-dto';
import { ResponseArgsOfIEnumerableOfReceiptDTO } from '../models/response-args-of-ienumerable-of-receipt-dto';
import { ResponseArgsOfIEnumerableOfValueTupleOfLongAndReceiptTypeAndEntityDTOContainerOfReceiptDTO } from '../models/response-args-of-ienumerable-of-value-tuple-of-long-and-receipt-type-and-entity-dtocontainer-of-receipt-dto';
import { ReceiptOrderItemSubsetReferenceValues } from '../models/receipt-order-item-subset-reference-values';
@Injectable({
  providedIn: 'root',
})
class ReceiptService extends __BaseService {
  static readonly ReceiptReceiptsByOrderIdPath = '/receipt/order/{orderId}';
  static readonly ReceiptQueryReceiptsPath = '/receipt/s';
  static readonly ReceiptCreateShippingNotePath = '/receipt/shippingnote/fromorder';
  static readonly ReceiptCreateShippingNote2Path = '/receipt/shippingnote/fromitems';
  static readonly ReceiptGetReceiptsByOrderItemSubsetPath = '/order/orderitem/orderitemsubset/receipts';

  constructor(
    config: __Configuration,
    http: HttpClient
  ) {
    super(config, http);
  }

  /**
   * @param params The `ReceiptService.ReceiptReceiptsByOrderIdParams` containing the following parameters:
   *
   * - `orderId`:
   *
   * - `receiptType`:
   */
  ReceiptReceiptsByOrderIdResponse(params: ReceiptService.ReceiptReceiptsByOrderIdParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfReceiptListItemDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;

    if (params.receiptType != null) __params = __params.set('receiptType', params.receiptType.toString());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/receipt/order/${encodeURIComponent(params.orderId)}`,
      __body,
      {
        headers: __headers,
        params: __params,
        responseType: 'json'
      });

    return this.http.request<any>(req).pipe(
      __filter(_r => _r instanceof HttpResponse),
      __map((_r) => {
        return _r as __StrictHttpResponse<ResponseArgsOfIEnumerableOfReceiptListItemDTO>;
      })
    );
  }
  /**
   * @param params The `ReceiptService.ReceiptReceiptsByOrderIdParams` containing the following parameters:
   *
   * - `orderId`:
   *
   * - `receiptType`:
   */
  ReceiptReceiptsByOrderId(params: ReceiptService.ReceiptReceiptsByOrderIdParams): __Observable<ResponseArgsOfIEnumerableOfReceiptListItemDTO> {
    return this.ReceiptReceiptsByOrderIdResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfReceiptListItemDTO)
    );
  }

  /**
   * @param params The `ReceiptService.ReceiptQueryReceiptsParams` containing the following parameters:
   *
   * - `queryToken`:
   *
   * - `locale`:
   */
  ReceiptQueryReceiptsResponse(params: ReceiptService.ReceiptQueryReceiptsParams): __Observable<__StrictHttpResponse<ListResponseArgsOfReceiptListItemDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    __body = params.queryToken;
    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/receipt/s`,
      __body,
      {
        headers: __headers,
        params: __params,
        responseType: 'json'
      });

    return this.http.request<any>(req).pipe(
      __filter(_r => _r instanceof HttpResponse),
      __map((_r) => {
        return _r as __StrictHttpResponse<ListResponseArgsOfReceiptListItemDTO>;
      })
    );
  }
  /**
   * @param params The `ReceiptService.ReceiptQueryReceiptsParams` containing the following parameters:
   *
   * - `queryToken`:
   *
   * - `locale`:
   */
  ReceiptQueryReceipts(params: ReceiptService.ReceiptQueryReceiptsParams): __Observable<ListResponseArgsOfReceiptListItemDTO> {
    return this.ReceiptQueryReceiptsResponse(params).pipe(
      __map(_r => _r.body as ListResponseArgsOfReceiptListItemDTO)
    );
  }

  /**
   * @param params The `ReceiptService.ReceiptCreateShippingNoteParams` containing the following parameters:
   *
   * - `orderId`:
   *
   * - `locale`:
   *
   * - `eagerLoading`:
   */
  ReceiptCreateShippingNoteResponse(params: ReceiptService.ReceiptCreateShippingNoteParams): __Observable<__StrictHttpResponse<ResponseArgsOfReceiptDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    __body = params.orderId;
    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    if (params.eagerLoading != null) __params = __params.set('eagerLoading', params.eagerLoading.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/receipt/shippingnote/fromorder`,
      __body,
      {
        headers: __headers,
        params: __params,
        responseType: 'json'
      });

    return this.http.request<any>(req).pipe(
      __filter(_r => _r instanceof HttpResponse),
      __map((_r) => {
        return _r as __StrictHttpResponse<ResponseArgsOfReceiptDTO>;
      })
    );
  }
  /**
   * @param params The `ReceiptService.ReceiptCreateShippingNoteParams` containing the following parameters:
   *
   * - `orderId`:
   *
   * - `locale`:
   *
   * - `eagerLoading`:
   */
  ReceiptCreateShippingNote(params: ReceiptService.ReceiptCreateShippingNoteParams): __Observable<ResponseArgsOfReceiptDTO> {
    return this.ReceiptCreateShippingNoteResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfReceiptDTO)
    );
  }

  /**
   * @param params The `ReceiptService.ReceiptCreateShippingNote2Params` containing the following parameters:
   *
   * - `orderItemStatusIds`:
   *
   * - `locale`:
   *
   * - `eagerLoading`:
   */
  ReceiptCreateShippingNote2Response(params: ReceiptService.ReceiptCreateShippingNote2Params): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfReceiptDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    __body = params.orderItemStatusIds;
    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    if (params.eagerLoading != null) __params = __params.set('eagerLoading', params.eagerLoading.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/receipt/shippingnote/fromitems`,
      __body,
      {
        headers: __headers,
        params: __params,
        responseType: 'json'
      });

    return this.http.request<any>(req).pipe(
      __filter(_r => _r instanceof HttpResponse),
      __map((_r) => {
        return _r as __StrictHttpResponse<ResponseArgsOfIEnumerableOfReceiptDTO>;
      })
    );
  }
  /**
   * @param params The `ReceiptService.ReceiptCreateShippingNote2Params` containing the following parameters:
   *
   * - `orderItemStatusIds`:
   *
   * - `locale`:
   *
   * - `eagerLoading`:
   */
  ReceiptCreateShippingNote2(params: ReceiptService.ReceiptCreateShippingNote2Params): __Observable<ResponseArgsOfIEnumerableOfReceiptDTO> {
    return this.ReceiptCreateShippingNote2Response(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfReceiptDTO)
    );
  }

  /**
   * @param params The `ReceiptService.ReceiptGetReceiptsByOrderItemSubsetParams` containing the following parameters:
   *
   * - `payload`:
   *
   * - `locale`:
   */
  ReceiptGetReceiptsByOrderItemSubsetResponse(params: ReceiptService.ReceiptGetReceiptsByOrderItemSubsetParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfValueTupleOfLongAndReceiptTypeAndEntityDTOContainerOfReceiptDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    __body = params.payload;
    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/order/orderitem/orderitemsubset/receipts`,
      __body,
      {
        headers: __headers,
        params: __params,
        responseType: 'json'
      });

    return this.http.request<any>(req).pipe(
      __filter(_r => _r instanceof HttpResponse),
      __map((_r) => {
        return _r as __StrictHttpResponse<ResponseArgsOfIEnumerableOfValueTupleOfLongAndReceiptTypeAndEntityDTOContainerOfReceiptDTO>;
      })
    );
  }
  /**
   * @param params The `ReceiptService.ReceiptGetReceiptsByOrderItemSubsetParams` containing the following parameters:
   *
   * - `payload`:
   *
   * - `locale`:
   */
  ReceiptGetReceiptsByOrderItemSubset(params: ReceiptService.ReceiptGetReceiptsByOrderItemSubsetParams): __Observable<ResponseArgsOfIEnumerableOfValueTupleOfLongAndReceiptTypeAndEntityDTOContainerOfReceiptDTO> {
    return this.ReceiptGetReceiptsByOrderItemSubsetResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfValueTupleOfLongAndReceiptTypeAndEntityDTOContainerOfReceiptDTO)
    );
  }
}

module ReceiptService {

  /**
   * Parameters for ReceiptReceiptsByOrderId
   */
  export interface ReceiptReceiptsByOrderIdParams {
    orderId: number;
    receiptType?: 0 | 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512;
  }

  /**
   * Parameters for ReceiptQueryReceipts
   */
  export interface ReceiptQueryReceiptsParams {
    queryToken: QueryTokenDTO;
    locale?: null | string;
  }

  /**
   * Parameters for ReceiptCreateShippingNote
   */
  export interface ReceiptCreateShippingNoteParams {
    orderId: number;
    locale?: null | string;
    eagerLoading?: number;
  }

  /**
   * Parameters for ReceiptCreateShippingNote2
   */
  export interface ReceiptCreateShippingNote2Params {
    orderItemStatusIds: Array<number>;
    locale?: null | string;
    eagerLoading?: number;
  }

  /**
   * Parameters for ReceiptGetReceiptsByOrderItemSubset
   */
  export interface ReceiptGetReceiptsByOrderItemSubsetParams {
    payload: ReceiptOrderItemSubsetReferenceValues;
    locale?: null | string;
  }
}

export { ReceiptService }
