package me.koba1.led.controller;

import me.koba1.led.Main;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/device")
public class DeviceController {
    public record Device(boolean connected) {
    }

    @GetMapping("/status")
    public Device getStatus() {
        return new Device(Main.getInstance().getDeviceManager().isConnected());
    }

    @PostMapping("/reconnect")
    public Device reconnect() {
        return new Device(Main.getInstance().getDeviceManager().reconnect());
    }
}

