package core

import (
	"fmt"
	"net/http"

	"github.com/brutella/hc/accessory"
)

func powerToggle(w http.ResponseWriter, r *http.Request) {
	TogglePower()
	//os.Exit(0)
}

// WebInterface handles the prometheus scrape endpoint
func WebInterface(acc accessory.Thermostat) {
	http.HandleFunc("/power", powerToggle(acc))
	http.ListenAndServe(fmt.Sprintf(":%d", 8192), nil)
}
