import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { HttpClient } from '@angular/common/http';
import { OutlineConfig } from './outline';

@Injectable({
  providedIn: 'root'
})
export class OutlineconfigurationService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }

  Post(outline: OutlineConfig[]): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/OutlineConfigurationApi/add', outline, { observe: 'response' });
  }
  Put(outline: OutlineConfig[]): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/OutlineConfigurationApi/Update',
      outline, { observe: 'response' });
  }
  getOutlineByoutlineconfigId(outlineconfigid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/OutlineConfigurationApi/getOutlineByoutlineconfigId/' + outlineconfigid);
  }
  GetTracks(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/TrackApi');
  }
  GetPlugins(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/PluginsApi');
  }
  Delete(checklist: any) {
    return this.httpClient.post(this.baseUrl + 'api/OutlineConfigurationApi/activeordeactive', checklist, {  observe: 'response' });
  }

  UpdateOutlineStageMapping(outline: OutlineConfig[]): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/OutlineStageMappingApi/UpdateOutlineStageMapping', outline, { observe: 'response' });
  }
  GetByoutlineconfigid(outline: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/OutlineStageMappingApi/Getbyoutlineconfigid', outline, { observe: 'response' });
  }
  HeaderMapping(outlineDetail: any) {
    return this.httpClient.post(this.baseUrl + 'api/OutlineConfigurationApi/headermapping', outlineDetail, {  observe: 'response' });
  }
  getOutlineDetailByoutlineconfigId(outlineconfigid: number): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/OutlineConfigurationApi/getOutlineDetailByoutlineconfigId/' + outlineconfigid);
  }
}
