package routes

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

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

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

	Register(enterprises, doc, groupPath, "POST", "/:id/allocate-devices", handler.AllocateDevices, RouteSpec{
		Summary: "授权设备给企业",
		Tags:    []string{"企业设备授权"},
		Input:   new(dto.AllocateDevicesReq),
		Output:  new(dto.AllocateDevicesResp),
		Auth:    true,
	})

	Register(enterprises, doc, groupPath, "POST", "/:id/recall-devices", handler.RecallDevices, RouteSpec{
		Summary: "撤销设备授权",
		Tags:    []string{"企业设备授权"},
		Input:   new(dto.RecallDevicesReq),
		Output:  new(dto.RecallDevicesResp),
		Auth:    true,
	})

	Register(enterprises, doc, groupPath, "GET", "/:id/devices", handler.ListDevices, RouteSpec{
		Summary: "企业设备列表",
		Tags:    []string{"企业设备授权"},
		Input:   new(dto.EnterpriseDeviceListReq),
		Output:  new(dto.EnterpriseDeviceListResp),
		Auth:    true,
	})
}
