import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {FireForm} from "@/_models/fire-form";

@Injectable({ providedIn: 'root' })
export class FireFormsService {

    constructor(private http: HttpClient) { }

    getAll() {
        return this.http.get<FireForm[]>(`${config.apiUrl}/active`);
    }

    getAllHotWorkPermits() {
        return this.http.get<FireForm[]>(`${config.apiUrl}/hotWorkPermits`);
    }

    getAllNewForms() {
        return this.http.get<FireForm[]>(`${config.apiUrl}/newForms`);
    }

    getAllToBeReinstated() {
        return this.http.get<FireForm[]>(`${config.apiUrl}/toBeReinstated`);
    }

    register(fireForm: FireForm) {
        return this.http.put(`${config.apiUrl}/forms/fireAndSecurity`, fireForm);
    }

    delete(id: number) {
        return this.http.delete(`${config.apiUrl}/fireAndSecurity/${id}`);
    }

}