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

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

    constructor(private httpClient: HttpClient) {
    }

    Get(): Observable<any> {
        return this.httpClient.get<any>(this.baseUrl + 'api/StagetypeApi')
    }
    GetActive(): Observable<Stagetype[]> {
        return this.httpClient.get<Stagetype[]>(this.baseUrl + 'api/StagetypeApi/GetActiveStagetype')
    }
    Post(stagetype: Stagetype): Observable<any> {

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