package report

import (
	"strconv"

	"github.com/gin-gonic/gin"
	"wails-app/internal/model/common/response"
	"wails-app/internal/modules/report/service"
)

var reportSvc = service.ReportService{}

func RevenueReport(c *gin.Context) {
	lotID, _ := strconv.Atoi(c.Query("parking_lot_id"))
	items, err := reportSvc.RevenueReport(c.Query("start_date"), c.Query("end_date"), uint(lotID))
	if err != nil {
		response.FailWithMessage(err.Error(), c)
		return
	}
	response.OkWithData(items, c)
}

func SetupReportRouter(router *gin.RouterGroup) {
	router.GET("/report/revenue", RevenueReport)
}
