/* 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 { ListResponseArgsOfVATDTO } from '../models/list-response-args-of-vatdto';
import { ResponseArgsOfVATDTO } from '../models/response-args-of-vatdto';
@Injectable({
  providedIn: 'root',
})
class VATService extends __BaseService {
  static readonly VATGetVATsPath = '/order/vat';
  static readonly VATGetVATPath = '/order/vat/{vatId}';

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

  /**
   * Listet alle Mehrwertsteuer-Sätze
   * @param params The `VATService.VATGetVATsParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   */
  VATGetVATsResponse(params: VATService.VATGetVATsParams): __Observable<__StrictHttpResponse<ListResponseArgsOfVATDTO>> {
    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());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/order/vat`,
      __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<ListResponseArgsOfVATDTO>;
      })
    );
  }
  /**
   * Listet alle Mehrwertsteuer-Sätze
   * @param params The `VATService.VATGetVATsParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   */
  VATGetVATs(params: VATService.VATGetVATsParams): __Observable<ListResponseArgsOfVATDTO> {
    return this.VATGetVATsResponse(params).pipe(
      __map(_r => _r.body as ListResponseArgsOfVATDTO)
    );
  }

  /**
   * Mehrwertsteuer-Satz
   * @param vatId PK VAT
   */
  VATGetVATResponse(vatId: number): __Observable<__StrictHttpResponse<ResponseArgsOfVATDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;

    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/order/vat/${encodeURIComponent(String(vatId))}`,
      __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<ResponseArgsOfVATDTO>;
      })
    );
  }
  /**
   * Mehrwertsteuer-Satz
   * @param vatId PK VAT
   */
  VATGetVAT(vatId: number): __Observable<ResponseArgsOfVATDTO> {
    return this.VATGetVATResponse(vatId).pipe(
      __map(_r => _r.body as ResponseArgsOfVATDTO)
    );
  }
}

module VATService {

  /**
   * Parameters for VATGetVATs
   */
  export interface VATGetVATsParams {
    take?: null | number;
    skip?: null | number;
  }
}

export { VATService }
