/* tslint:disable */
import { Injectable } from '@angular/core';
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
import { BaseService as __BaseService } from '../base-service';
import { CrmConfiguration as __Configuration } from '../crm-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 { ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO } from '../models/response-args-of-iquery-result-of-loyalty-booking-info-dto';
import { ResponseArgsOfLoyaltyBookingInfoDTO } from '../models/response-args-of-loyalty-booking-info-dto';
import { LoyaltyBookingValues } from '../models/loyalty-booking-values';
import { ResponseArgsOfIEnumerableOfKeyValueDTOOfStringAndInteger } from '../models/response-args-of-ienumerable-of-key-value-dtoof-string-and-integer';
import { ResponseArgsOfKeyValueDTOOfStringAndString } from '../models/response-args-of-key-value-dtoof-string-and-string';
import { ResponseArgsOfLoyaltyBonResponse } from '../models/response-args-of-loyalty-bon-response';
import { LoyaltyBonValues } from '../models/loyalty-bon-values';
import { ResponseArgsOfBoolean } from '../models/response-args-of-boolean';
import { ResponseArgsOfNullableBoolean } from '../models/response-args-of-nullable-boolean';
@Injectable({
  providedIn: 'root',
})
class LoyaltyCardService extends __BaseService {
  static readonly LoyaltyCardListBookingsPath = '/loyalty/{cardCode}/booking';
  static readonly LoyaltyCardAddBookingPath = '/loyalty/{cardCode}/booking';
  static readonly LoyaltyCardListCustomerBookingsPath = '/customer/{customerId}/loyalty/booking';
  static readonly LoyaltyCardBookingReasonPath = '/loyalty/booking/reason';
  static readonly LoyaltyCardCurrentBookingPartnerStorePath = '/loyalty/booking/partner/store/current';
  static readonly LoyaltyCardLoyaltyBonCheckPath = '/loyalty/{cardCode}/bon/check';
  static readonly LoyaltyCardLoyaltyBonAddPath = '/loyalty/{cardCode}/bon/add';
  static readonly LoyaltyCardLockCardPath = '/loyalty/{cardCode}/lock';
  static readonly LoyaltyCardUnlockCardPath = '/customer/{customerId}/loyalty/{cardCode}/unlock';

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

  /**
   * Bookings / Buchungen
   * @param params The `LoyaltyCardService.LoyaltyCardListBookingsParams` containing the following parameters:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardListBookingsResponse(params: LoyaltyCardService.LoyaltyCardListBookingsParams): __Observable<__StrictHttpResponse<ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;

    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/loyalty/${encodeURIComponent(String(params.cardCode))}/booking`,
      __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<ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO>;
      })
    );
  }
  /**
   * Bookings / Buchungen
   * @param params The `LoyaltyCardService.LoyaltyCardListBookingsParams` containing the following parameters:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardListBookings(params: LoyaltyCardService.LoyaltyCardListBookingsParams): __Observable<ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO> {
    return this.LoyaltyCardListBookingsResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO)
    );
  }

  /**
   * Add goodwill/manual booking / Kulanzbuchung hinzufügen
   * @param params The `LoyaltyCardService.LoyaltyCardAddBookingParams` containing the following parameters:
   *
   * - `cardCode`:
   *
   * - `booking`:
   *
   * - `locale`:
   */
  LoyaltyCardAddBookingResponse(params: LoyaltyCardService.LoyaltyCardAddBookingParams): __Observable<__StrictHttpResponse<ResponseArgsOfLoyaltyBookingInfoDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;

    __body = params.booking;
    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/loyalty/${encodeURIComponent(String(params.cardCode))}/booking`,
      __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<ResponseArgsOfLoyaltyBookingInfoDTO>;
      })
    );
  }
  /**
   * Add goodwill/manual booking / Kulanzbuchung hinzufügen
   * @param params The `LoyaltyCardService.LoyaltyCardAddBookingParams` containing the following parameters:
   *
   * - `cardCode`:
   *
   * - `booking`:
   *
   * - `locale`:
   */
  LoyaltyCardAddBooking(params: LoyaltyCardService.LoyaltyCardAddBookingParams): __Observable<ResponseArgsOfLoyaltyBookingInfoDTO> {
    return this.LoyaltyCardAddBookingResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfLoyaltyBookingInfoDTO)
    );
  }

  /**
   * Bookings / Buchungen
   * @param params The `LoyaltyCardService.LoyaltyCardListCustomerBookingsParams` containing the following parameters:
   *
   * - `customerId`:
   *
   * - `locale`:
   */
  LoyaltyCardListCustomerBookingsResponse(params: LoyaltyCardService.LoyaltyCardListCustomerBookingsParams): __Observable<__StrictHttpResponse<ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;

    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/customer/${encodeURIComponent(String(params.customerId))}/loyalty/booking`,
      __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<ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO>;
      })
    );
  }
  /**
   * Bookings / Buchungen
   * @param params The `LoyaltyCardService.LoyaltyCardListCustomerBookingsParams` containing the following parameters:
   *
   * - `customerId`:
   *
   * - `locale`:
   */
  LoyaltyCardListCustomerBookings(params: LoyaltyCardService.LoyaltyCardListCustomerBookingsParams): __Observable<ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO> {
    return this.LoyaltyCardListCustomerBookingsResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIQueryResultOfLoyaltyBookingInfoDTO)
    );
  }

  /**
   * Booking reason / Buchungsgründe
   */
  LoyaltyCardBookingReasonResponse(): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfKeyValueDTOOfStringAndInteger>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/loyalty/booking/reason`,
      __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<ResponseArgsOfIEnumerableOfKeyValueDTOOfStringAndInteger>;
      })
    );
  }
  /**
   * Booking reason / Buchungsgründe
   */
  LoyaltyCardBookingReason(): __Observable<ResponseArgsOfIEnumerableOfKeyValueDTOOfStringAndInteger> {
    return this.LoyaltyCardBookingReasonResponse().pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfKeyValueDTOOfStringAndInteger)
    );
  }

  /**
   * Current booking store / Aktuelle Buchungsfiliale
   */
  LoyaltyCardCurrentBookingPartnerStoreResponse(): __Observable<__StrictHttpResponse<ResponseArgsOfKeyValueDTOOfStringAndString>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/loyalty/booking/partner/store/current`,
      __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<ResponseArgsOfKeyValueDTOOfStringAndString>;
      })
    );
  }
  /**
   * Current booking store / Aktuelle Buchungsfiliale
   */
  LoyaltyCardCurrentBookingPartnerStore(): __Observable<ResponseArgsOfKeyValueDTOOfStringAndString> {
    return this.LoyaltyCardCurrentBookingPartnerStoreResponse().pipe(
      __map(_r => _r.body as ResponseArgsOfKeyValueDTOOfStringAndString)
    );
  }

  /**
   * Check Bon-Nr / Bon-Nr für Nachverpunktung überprüfen
   * @param params The `LoyaltyCardService.LoyaltyCardLoyaltyBonCheckParams` containing the following parameters:
   *
   * - `payload`:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardLoyaltyBonCheckResponse(params: LoyaltyCardService.LoyaltyCardLoyaltyBonCheckParams): __Observable<__StrictHttpResponse<ResponseArgsOfLoyaltyBonResponse>> {
    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 + `/loyalty/${encodeURIComponent(String(params.cardCode))}/bon/check`,
      __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<ResponseArgsOfLoyaltyBonResponse>;
      })
    );
  }
  /**
   * Check Bon-Nr / Bon-Nr für Nachverpunktung überprüfen
   * @param params The `LoyaltyCardService.LoyaltyCardLoyaltyBonCheckParams` containing the following parameters:
   *
   * - `payload`:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardLoyaltyBonCheck(params: LoyaltyCardService.LoyaltyCardLoyaltyBonCheckParams): __Observable<ResponseArgsOfLoyaltyBonResponse> {
    return this.LoyaltyCardLoyaltyBonCheckResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfLoyaltyBonResponse)
    );
  }

  /**
   * Add Bon / Bon Nachverpunkten
   * @param params The `LoyaltyCardService.LoyaltyCardLoyaltyBonAddParams` containing the following parameters:
   *
   * - `payload`:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardLoyaltyBonAddResponse(params: LoyaltyCardService.LoyaltyCardLoyaltyBonAddParams): __Observable<__StrictHttpResponse<ResponseArgsOfBoolean>> {
    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 + `/loyalty/${encodeURIComponent(String(params.cardCode))}/bon/add`,
      __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<ResponseArgsOfBoolean>;
      })
    );
  }
  /**
   * Add Bon / Bon Nachverpunkten
   * @param params The `LoyaltyCardService.LoyaltyCardLoyaltyBonAddParams` containing the following parameters:
   *
   * - `payload`:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardLoyaltyBonAdd(params: LoyaltyCardService.LoyaltyCardLoyaltyBonAddParams): __Observable<ResponseArgsOfBoolean> {
    return this.LoyaltyCardLoyaltyBonAddResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfBoolean)
    );
  }

  /**
   * Lock card
   * @param params The `LoyaltyCardService.LoyaltyCardLockCardParams` containing the following parameters:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardLockCardResponse(params: LoyaltyCardService.LoyaltyCardLockCardParams): __Observable<__StrictHttpResponse<ResponseArgsOfNullableBoolean>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;

    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/loyalty/${encodeURIComponent(String(params.cardCode))}/lock`,
      __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<ResponseArgsOfNullableBoolean>;
      })
    );
  }
  /**
   * Lock card
   * @param params The `LoyaltyCardService.LoyaltyCardLockCardParams` containing the following parameters:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardLockCard(params: LoyaltyCardService.LoyaltyCardLockCardParams): __Observable<ResponseArgsOfNullableBoolean> {
    return this.LoyaltyCardLockCardResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfNullableBoolean)
    );
  }

  /**
   * Unlock card
   * @param params The `LoyaltyCardService.LoyaltyCardUnlockCardParams` containing the following parameters:
   *
   * - `customerId`:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardUnlockCardResponse(params: LoyaltyCardService.LoyaltyCardUnlockCardParams): __Observable<__StrictHttpResponse<ResponseArgsOfNullableBoolean>> {
    let __params = this.newParams();
    let __headers = new HttpHeaders();
    let __body: any = null;


    if (params.locale != null) __params = __params.set('locale', params.locale.toString());
    let req = new HttpRequest<any>(
      'POST',
      this.rootUrl + `/customer/${encodeURIComponent(String(params.customerId))}/loyalty/${encodeURIComponent(String(params.cardCode))}/unlock`,
      __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<ResponseArgsOfNullableBoolean>;
      })
    );
  }
  /**
   * Unlock card
   * @param params The `LoyaltyCardService.LoyaltyCardUnlockCardParams` containing the following parameters:
   *
   * - `customerId`:
   *
   * - `cardCode`:
   *
   * - `locale`:
   */
  LoyaltyCardUnlockCard(params: LoyaltyCardService.LoyaltyCardUnlockCardParams): __Observable<ResponseArgsOfNullableBoolean> {
    return this.LoyaltyCardUnlockCardResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfNullableBoolean)
    );
  }
}

module LoyaltyCardService {

  /**
   * Parameters for LoyaltyCardListBookings
   */
  export interface LoyaltyCardListBookingsParams {
    cardCode: string;
    locale?: null | string;
  }

  /**
   * Parameters for LoyaltyCardAddBooking
   */
  export interface LoyaltyCardAddBookingParams {
    cardCode: string;
    booking: LoyaltyBookingValues;
    locale?: null | string;
  }

  /**
   * Parameters for LoyaltyCardListCustomerBookings
   */
  export interface LoyaltyCardListCustomerBookingsParams {
    customerId: number;
    locale?: null | string;
  }

  /**
   * Parameters for LoyaltyCardLoyaltyBonCheck
   */
  export interface LoyaltyCardLoyaltyBonCheckParams {
    payload: LoyaltyBonValues;
    cardCode: string;
    locale?: null | string;
  }

  /**
   * Parameters for LoyaltyCardLoyaltyBonAdd
   */
  export interface LoyaltyCardLoyaltyBonAddParams {
    payload: LoyaltyBonValues;
    cardCode: string;
    locale?: null | string;
  }

  /**
   * Parameters for LoyaltyCardLockCard
   */
  export interface LoyaltyCardLockCardParams {
    cardCode: string;
    locale?: null | string;
  }

  /**
   * Parameters for LoyaltyCardUnlockCard
   */
  export interface LoyaltyCardUnlockCardParams {
    customerId: number;
    cardCode: string;
    locale?: null | string;
  }
}

export { LoyaltyCardService }
