package parking

import (
	"wails-app/internal/api/v1/parking"
	"wails-app/internal/api/v1/uhf"

	"github.com/gin-gonic/gin"
)

func SetupParkingRouter(router *gin.RouterGroup) {
	router.GET("/channel/events", parking.GetChannelEvents)
	router.GET("/channel/test-event", parking.SimulateEvent)

	parkingGroup := router.Group("/parking")
	parkLotGroup := parkingGroup.Group("/lot")
	{
		parkLotGroup.POST("/create", parking.CreateParkingLot)
		parkLotGroup.PUT("/update", parking.UpdateParkingLot)
		parkLotGroup.GET("/get", parking.GetParkingLotByID)
		parkLotGroup.GET("/get-by-code", parking.GetParkingLotByCode)
		parkLotGroup.GET("/list", parking.ListParkingLots)
		parkLotGroup.GET("/all", parking.QueryAllParkingLots)
		parkLotGroup.DELETE("/delete", parking.DeleteParkingLot)
	}
	boothGroup := parkingGroup.Group("/booth")
	{
		boothGroup.POST("/create", parking.CreateBooth)
		boothGroup.PUT("/update", parking.UpdateBooth)
		boothGroup.GET("/get", parking.GetBoothByID)
		boothGroup.GET("/get-by-code", parking.GetBoothByCode)
		boothGroup.GET("/list", parking.ListBooths)
		boothGroup.GET("/all", parking.QueryAllBooths)
		boothGroup.DELETE("/delete", parking.DeleteBooth)
	}
	channelGroup := parkingGroup.Group("/channel")
	{
		channelGroup.POST("/create", parking.CreateChannel)
		channelGroup.PUT("/update", parking.UpdateChannel)
		channelGroup.GET("/get", parking.GetChannelByID)
		channelGroup.GET("/get-by-code", parking.GetChannelByCode)
		channelGroup.GET("/list", parking.ListChannels)
		channelGroup.GET("/all", parking.QueryAllChannels)
		channelGroup.DELETE("/delete", parking.DeleteChannel)
	}
	deviceGroup := parkingGroup.Group("/device")
	{
		deviceGroup.POST("/create", uhf.CreateReader)
		deviceGroup.PUT("/update", uhf.UpdateReader)
		deviceGroup.GET("/connectedDevice", uhf.ConnectedDevice)
		deviceGroup.GET("/get-by-code", uhf.GetReaderByCode)
		deviceGroup.GET("/list", uhf.ListReaders)
		deviceGroup.GET("/all", uhf.QueryAllReaders)
		deviceGroup.DELETE("/delete", uhf.DeleteReader)
	}
}
