import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

import { environment } from '../../../environments/environment';

@Injectable()
export class DetailService {
    private API_PATH: string = environment.apiUrl + '/search/' + environment.instanceName;

    constructor(private http: HttpClient) { }

    retrieveObject(datasetName: string, attributeCriterionId: number, objectSelected: string, attributesOutputList: number[]) {
        const query = datasetName + '?c=' + attributeCriterionId + '::eq::' + objectSelected + '&a=' + attributesOutputList.join(';');
        return this.http.get<any[]>(this.API_PATH + query);
    }
}