import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { TypeRoom } from '../models/typeroom.model';

@Injectable({ providedIn: 'root' })
export class TypeRoomService {
    // addType(modelType: Function) {
    //   throw new Error('Method not implemented.');
    // }

    constructor(private http: HttpClient) { }
    url: string = "http://b872-2405-9800-bc03-3665-282a-83c6-a83e-fc1b.ngrok.io";
    listType: TypeRoom[] = []

    addTypeRoom(model: TypeRoom) {
        console.log("type", model)
    this.http.post(this.url + "/typeroom/", model).subscribe(response => {
      console.log(response);

    })
    }

    getListTypeRoom(): Observable<TypeRoom[]> {
        return this.http.get<TypeRoom[]>(this.url + "/typeroom/lists");
    }
}
