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

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

  Get(outline: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/OutlineApi/GetAllByUserid', outline, {  observe: 'response' });
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/OutlineApi/GetActiveOutline');
  }
  Post(outline: Outline): Observable<any> {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/OutlineApi/add', outline, { headers: header, observe: 'response' });
  }
  Delete(outline: Outline) {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/OutlineApi/activeordeactive', outline, { headers: header, observe: 'response' });
  }
  Put(outline: Outline): Observable<any> {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/OutlineApi/Update', outline, { headers: header, observe: 'response' });
  }
  SaveAsOutline(outline: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/OutlineApi/SaveAsOutline/' , outline);
  }
  /*GetById(outline: any): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/OutlineApi/GetById', outline, { observe: 'response' });
  }*/
  getByID(outline: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/OutlineApi/GetById', outline, {  observe: 'response' });
  }
  getAllByIdForStatusCheck(outline: any): Observable<any> {
    return this.httpClient.post(this.baseUrl + 'api/OutlineApi/GetAllByIdForStatusCheck', outline, {  observe: 'response' });
  }
}
