package controller

import (
	"github.com/gin-gonic/gin"
	"iot_manager_service/app/middleware"
	"iot_manager_service/app/operation/service"
	"iot_manager_service/util/common"
	"net/http"
)

var Garbage = new(garbageCtl)

type garbageCtl struct{}

func (c *garbageCtl) GarbageList(ctx *gin.Context) {
	value, _ := ctx.Get(middleware.Authorization)
	claims := value.(*middleware.Claims)

	records, err := service.GarbageService.GarbageList(claims.TenantId)
	if err != nil {
		ctx.JSON(http.StatusOK, err)
		return
	}
	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, records))
}

func (c *garbageCtl) CountList(ctx *gin.Context) {
	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, nil))
}
