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

@Injectable({
  providedIn: 'root'
})
export class JobmetaService {
  baseUrl: string = environment.serviceUrl;

  constructor(private httpClient: HttpClient) {
  }

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/JobMetaApi');
  }
  GetActive(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/JobMetaApi/GetActiveJobMeta');
  }
  Post(Jobmeta: Jobmeta): Observable<any> {

    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/JobMetaApi/add', Jobmeta, { headers: header, observe: 'response' });
  }
  Delete(Jobmeta: Jobmeta) {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/JobMetaApi/activeordeactive',
      Jobmeta, { headers: header, observe: 'response' });
  }
  Put(Jobmeta: Jobmeta): Observable<any> {
    let header = new HttpHeaders();
    header = header.set('Content-Type', 'application/json; charset=utf-8');
    return this.httpClient.post(this.baseUrl + 'api/JobMetaApi/Update', Jobmeta, { headers: header, observe: 'response' });
  }
  Get_projectdeflst(userid :any):Observable<any>{
    return this.httpClient.get(this.baseUrl + 'api/JobMetaApi/Get_projectdeflst/' + userid);
  }

}
