/* 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 { ResponseArgsOfIEnumerableOfCountryDTO } from '../models/response-args-of-ienumerable-of-country-dto';
@Injectable({
  providedIn: 'root',
})
class StoreCheckoutCountryService extends __BaseService {
  static readonly StoreCheckoutCountryGetCountriesByCheckoutPath = '/store/checkout/{checkoutId}/countries';
  static readonly StoreCheckoutCountryGetCountriesPath = '/store/countries';

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

  /**
   * @param params The `StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesByCheckoutParams` containing the following parameters:
   *
   * - `checkoutId`:
   *
   * - `locale`:
   */
  StoreCheckoutCountryGetCountriesByCheckoutResponse(params: StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesByCheckoutParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfCountryDTO>> {
    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))}/countries`,
      __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<ResponseArgsOfIEnumerableOfCountryDTO>;
      })
    );
  }
  /**
   * @param params The `StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesByCheckoutParams` containing the following parameters:
   *
   * - `checkoutId`:
   *
   * - `locale`:
   */
  StoreCheckoutCountryGetCountriesByCheckout(params: StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesByCheckoutParams): __Observable<ResponseArgsOfIEnumerableOfCountryDTO> {
    return this.StoreCheckoutCountryGetCountriesByCheckoutResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfCountryDTO)
    );
  }

  /**
   * @param params The `StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   *
   * - `locale`:
   */
  StoreCheckoutCountryGetCountriesResponse(params: StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesParams): __Observable<__StrictHttpResponse<ResponseArgsOfIEnumerableOfCountryDTO>> {
    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());
    let req = new HttpRequest<any>(
      'GET',
      this.rootUrl + `/store/countries`,
      __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<ResponseArgsOfIEnumerableOfCountryDTO>;
      })
    );
  }
  /**
   * @param params The `StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesParams` containing the following parameters:
   *
   * - `take`:
   *
   * - `skip`:
   *
   * - `locale`:
   */
  StoreCheckoutCountryGetCountries(params: StoreCheckoutCountryService.StoreCheckoutCountryGetCountriesParams): __Observable<ResponseArgsOfIEnumerableOfCountryDTO> {
    return this.StoreCheckoutCountryGetCountriesResponse(params).pipe(
      __map(_r => _r.body as ResponseArgsOfIEnumerableOfCountryDTO)
    );
  }
}

module StoreCheckoutCountryService {

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

  /**
   * Parameters for StoreCheckoutCountryGetCountries
   */
  export interface StoreCheckoutCountryGetCountriesParams {
    take?: null | number;
    skip?: null | number;
    locale?: null | string;
  }
}

export { StoreCheckoutCountryService }
