package api

import (
	"gadmin/internal/admin/forms"
	"gadmin/internal/admin/service"
	"github.com/gin-gonic/gin"
)

func AdminLogList(c *gin.Context) {
	var req forms.AdminLogListReq
	if err := c.ShouldBind(&req); err != nil {
		c.JSON(200, ErrorResponse(err))
		return
	}
	if err := forms.ParseParams(&req); err != nil {
		c.JSON(200, ErrorResponse(err))
		return
	}

	c.JSON(200, service.AdminLog.List(c, req))
}

func AdminLogView(c *gin.Context) {
	var req forms.AdminLogViewReq
	if err := c.ShouldBind(&req); err != nil {
		c.JSON(200, ErrorResponse(err))
		return
	}
	if err := forms.ParseParams(&req); err != nil {
		c.JSON(200, ErrorResponse(err))
		return
	}

	c.JSON(200, service.AdminLog.View(c, req))
}
