import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Role } from './role';
import { environment } from '../../../environments/environment';
let header = new HttpHeaders();
header = header.set('Content-Type', 'application/json; charset=utf-8');
@Injectable({
  providedIn: 'root'
})
export class RoleService {
  baseUrl: string = environment.serviceUrl;
  constructor(private httpClient: HttpClient) { }
  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/RoleApi');
  }
  Post(role: Role): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/RoleApi/Add', role, { headers: header, observe: 'response' })
  }
  GetById(role: Role): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/RoleApi/GetById', role, { headers: header, observe: 'response' });
  }
  Put(role: Role): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/RoleApi/Update', role, { headers: header, observe: 'response' })
  }
  Delete(role: Role) {
    return this.httpClient.post<any>(this.baseUrl + 'api/RoleApi/activeordeactive', role, { headers: header, observe: 'response' })
  }

}
