import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { DatasetExternalAutocompleteCriteria } from '../../query/dataset/daatset-external-autocomplete-criteria';
import { RequestItem } from '../../query/request-item';
import { DatasetProfileService } from '../dataset-profile/dataset-profile.service';

@Injectable()
export class DatasetExternalAutocompleteService {

	private actionUrl: string;

	constructor(
		private httpClient: HttpClient,
		private datasetProfileService: DatasetProfileService) {
		this.actionUrl = environment.Server + 'datasetwizard/';
	}

	getDatasetProfileById(datasetProfileID) {
		return this.datasetProfileService.getDatasetProfileById(datasetProfileID);
	}

	queryAutocomplete(lookUpItem: RequestItem<DatasetExternalAutocompleteCriteria>): Observable<any> {
		return this.httpClient.post(environment.Server + 'search/autocomplete', lookUpItem);
	}

}
