package za.co.rootbranch.coffeechat.controllers;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import za.co.rootbranch.coffeechat.models.Room;
import za.co.rootbranch.coffeechat.services.RoomService;

@RestController
public class RoomsController {
    @Autowired
    private RoomService roomService;
    
    @GetMapping("/api/rooms")
    public List<Room> getRooms(){
        return roomService.findRooms();
    }
    @PostMapping("/api/room")
    public Room addRoom(@RequestBody Room room){
        return roomService.addRoom(room);
    }
}
