package Presentation

import (
	ChannelsRoutes "data_broker/routes/channels"
	DataRoutes "data_broker/routes/data"

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

type Server struct {
	engine gin.Engine
}

func (server *Server) Init() {
	server.engine = *gin.Default()
}

func (server *Server) MapRoutes() {
	server.engine.GET("/channels/:channel", ChannelsRoutes.Pull)
	server.engine.GET("/data/:channel/:key", DataRoutes.Pull)
	server.engine.POST("/data/push", DataRoutes.Push)
}

func (server *Server) Start(url string) {
	server.engine.Run(url)
}
