/* tslint:disable */
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */

import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';

import { LuogoRes } from '../../models/luogo-res';

export interface LuoghiControllerFindLuogoByAutocomplete$Params {
  /**
   * Search query for places, must be at least 3 characters long
   */
  q: string;

  /**
   * Filter by active status (0 = inactive, 1 = active)
   */
  flagAttivo?: number;

  /**
   * Filter stati esteri (0 = inactive, 1 = active)
   */
  statiEsteri?: number;
}

export function luoghiControllerFindLuogoByAutocomplete(
  http: HttpClient,
  rootUrl: string,
  params: LuoghiControllerFindLuogoByAutocomplete$Params,
  context?: HttpContext,
): Observable<StrictHttpResponse<Array<LuogoRes>>> {
  const rb = new RequestBuilder(
    rootUrl,
    luoghiControllerFindLuogoByAutocomplete.PATH,
    'get',
  );
  if (params) {
    rb.query('q', params.q, {});
    rb.query('flagAttivo', params.flagAttivo, {});
    rb.query('statiEsteri', params.statiEsteri, {});
  }

  return http
    .request(
      rb.build({ responseType: 'json', accept: 'application/json', context }),
    )
    .pipe(
      filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
      map((r: HttpResponse<any>) => {
        return r as StrictHttpResponse<Array<LuogoRes>>;
      }),
    );
}

luoghiControllerFindLuogoByAutocomplete.PATH = '/public/luoghi/cerca';
