package routes

import (
	"github.com/gofiber/fiber/v2"

	"github.com/break/junhong_cmp_fiber/internal/handler/h5"
	"github.com/break/junhong_cmp_fiber/internal/model/dto"
	"github.com/break/junhong_cmp_fiber/pkg/openapi"
)

func registerH5EnterpriseDeviceRoutes(router fiber.Router, handler *h5.EnterpriseDeviceHandler, doc *openapi.Generator, basePath string) {
	devices := router.Group("/devices")
	groupPath := basePath + "/devices"

	Register(devices, doc, groupPath, "GET", "", handler.ListDevices, RouteSpec{
		Summary: "企业设备列表（H5）",
		Tags:    []string{"H5-企业设备"},
		Input:   new(dto.H5EnterpriseDeviceListReq),
		Output:  new(dto.EnterpriseDeviceListResp),
		Auth:    true,
	})

	Register(devices, doc, groupPath, "GET", "/:device_id", handler.GetDeviceDetail, RouteSpec{
		Summary: "获取设备详情（H5）",
		Tags:    []string{"H5-企业设备"},
		Input:   new(dto.DeviceDetailReq),
		Output:  new(dto.EnterpriseDeviceDetailResp),
		Auth:    true,
	})

	Register(devices, doc, groupPath, "POST", "/:device_id/cards/:card_id/suspend", handler.SuspendCard, RouteSpec{
		Summary: "停机卡（H5）",
		Tags:    []string{"H5-企业设备"},
		Input:   new(dto.DeviceCardOperationReq),
		Output:  new(dto.DeviceCardOperationResp),
		Auth:    true,
	})

	Register(devices, doc, groupPath, "POST", "/:device_id/cards/:card_id/resume", handler.ResumeCard, RouteSpec{
		Summary: "复机卡（H5）",
		Tags:    []string{"H5-企业设备"},
		Input:   new(dto.DeviceCardOperationReq),
		Output:  new(dto.DeviceCardOperationResp),
		Auth:    true,
	})
}
