/* tslint:disable */
import { Injectable } from '@angular/core';
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
import { BaseService as __BaseService } from '../base-service';
import { CheckoutConfiguration as __Configuration } from '../checkout-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 { ResponseArgsOfIEnumerableOfBranchDTO } from '../models/response-args-of-ienumerable-of-branch-dto';
import { BranchQueryTokenDTO } from '../models/branch-query-token-dto';
@Injectable({
  providedIn: 'root',
})
class StoreCheckoutBranchService extends __BaseService {
  static readonly StoreCheckoutBranchGetBranchesByCheckoutPath = '/store/checkout/{checkoutId}/branches';
  static readonly StoreCheckoutBranchGetBranchesPath = '/store/branches';
  static readonly StoreCheckoutBranchQueryBranchesPath = '/store/branches/s';

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

  /**
   * @param params The `StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesByCheckoutParams` containing the following parameters:
   *
   * - `checkoutId`:
   *
   * - `locale`:
   */
  StoreCheckoutBranchGetBranchesByCheckoutResponse(params: StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesByCheckoutParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfBranchDTO>> {
    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 + `/store/checkout/${encodeURIComponent(String(params.checkoutId))}/branches`,
      __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<ResponseArgsOfIEnumerableOfBranchDTO>;
      })
    );
  }
  /**
   * @param params The `StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesByCheckoutParams` containing the following parameters:
   *
   * - `checkoutId`:
   *
   * - `locale`:
   */
  StoreCheckoutBranchGetBranchesByCheckout(params: StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesByCheckoutParams): __Observable<ResponseArgsOfIEnumerableOfBranchDTO> {
    return this.StoreCheckoutBranchGetBranchesByCheckoutResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfBranchDTO)
    );
  }

  /**
   * @param params The `StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   *
   * - `locale`:
   *
   * - `labelOnly`:
   */
  StoreCheckoutBranchGetBranchesResponse(params: StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfBranchDTO>> {
    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.locale != null) __params = __params.set('locale', params.locale.toString());
    if (params.labelOnly != null) __params = __params.set('labelOnly', params.labelOnly.toString());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/store/branches`,
      __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<ResponseArgsOfIEnumerableOfBranchDTO>;
      })
    );
  }
  /**
   * @param params The `StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   *
   * - `locale`:
   *
   * - `labelOnly`:
   */
  StoreCheckoutBranchGetBranches(params: StoreCheckoutBranchService.StoreCheckoutBranchGetBranchesParams): __Observable<ResponseArgsOfIEnumerableOfBranchDTO> {
    return this.StoreCheckoutBranchGetBranchesResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfBranchDTO)
    );
  }

  /**
   * @param params The `StoreCheckoutBranchService.StoreCheckoutBranchQueryBranchesParams` containing the following parameters:
   *
   * - `queryToken`:
   *
   * - `locale`:
   */
  StoreCheckoutBranchQueryBranchesResponse(params: StoreCheckoutBranchService.StoreCheckoutBranchQueryBranchesParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfBranchDTO>> {
    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 + `/store/branches/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<ResponseArgsOfIEnumerableOfBranchDTO>;
      })
    );
  }
  /**
   * @param params The `StoreCheckoutBranchService.StoreCheckoutBranchQueryBranchesParams` containing the following parameters:
   *
   * - `queryToken`:
   *
   * - `locale`:
   */
  StoreCheckoutBranchQueryBranches(params: StoreCheckoutBranchService.StoreCheckoutBranchQueryBranchesParams): __Observable<ResponseArgsOfIEnumerableOfBranchDTO> {
    return this.StoreCheckoutBranchQueryBranchesResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfBranchDTO)
    );
  }
}

module StoreCheckoutBranchService {

  /**
   * Parameters for StoreCheckoutBranchGetBranchesByCheckout
   */
  export interface StoreCheckoutBranchGetBranchesByCheckoutParams {
    checkoutId: number;
    locale?: null | string;
  }

  /**
   * Parameters for StoreCheckoutBranchGetBranches
   */
  export interface StoreCheckoutBranchGetBranchesParams {
    take?: null | number;
    skip?: null | number;
    locale?: null | string;
    labelOnly?: boolean;
  }

  /**
   * Parameters for StoreCheckoutBranchQueryBranches
   */
  export interface StoreCheckoutBranchQueryBranchesParams {
    queryToken: BranchQueryTokenDTO;
    locale?: null | string;
  }
}

export { StoreCheckoutBranchService }
