/* 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';
@Injectable({
  providedIn: 'root',
})
class ReceiptService extends __BaseService {
  static readonly ReceiptReceiptsByOrderIdPath = '/receipt/order/{orderId}';
  static readonly ReceiptListReceiptsPath = '/receipt/s';

  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/${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.ReceiptListReceiptsParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   *
   * - `quicksearch`:
   */
  ReceiptListReceiptsResponse(params: ReceiptService.ReceiptListReceiptsParams): __Observable<__StrictHttpResponse<ListResponseArgsOfReceiptListItemDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    if (params.take != null) __params = __params.set('take', params.take.toString());
    if (params.skip != null) __params = __params.set('skip', params.skip.toString());
    if (params.quicksearch != null) __params = __params.set('quicksearch', params.quicksearch.toString());
    let req = new HttpRequest<any>(
      'GET',
      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.ReceiptListReceiptsParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   *
   * - `quicksearch`:
   */
  ReceiptListReceipts(params: ReceiptService.ReceiptListReceiptsParams): __Observable<ListResponseArgsOfReceiptListItemDTO> {
    return this.ReceiptListReceiptsResponse(params).pipe(
      __map(_r => _r.body as ListResponseArgsOfReceiptListItemDTO)
    );
  }
}

module ReceiptService {

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

  /**
   * Parameters for ReceiptListReceipts
   */
  export interface ReceiptListReceiptsParams {
    take?: null | number;
    skip?: null | number;
    quicksearch?: null | string;
  }
}

export { ReceiptService }
