97 lines
4.8 KiB
Go
97 lines
4.8 KiB
Go
package dto
|
|
|
|
import "git.huangwc.com/pig/pig-farm-controller/internal/infra/models"
|
|
|
|
// CreateDeviceRequest 定义了创建设备时需要传入的参数
|
|
type CreateDeviceRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
DeviceTemplateID uint `json:"device_template_id" binding:"required"`
|
|
AreaControllerID uint `json:"area_controller_id" binding:"required"`
|
|
Location string `json:"location,omitempty"`
|
|
Properties map[string]interface{} `json:"properties,omitempty"`
|
|
}
|
|
|
|
// UpdateDeviceRequest 定义了更新设备时需要传入的参数
|
|
type UpdateDeviceRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
DeviceTemplateID uint `json:"device_template_id" binding:"required"`
|
|
AreaControllerID uint `json:"area_controller_id" binding:"required"`
|
|
Location string `json:"location,omitempty"`
|
|
Properties map[string]interface{} `json:"properties,omitempty"`
|
|
}
|
|
|
|
// CreateAreaControllerRequest 定义了创建区域主控时需要传入的参数
|
|
type CreateAreaControllerRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
NetworkID string `json:"network_id" binding:"required"`
|
|
Location string `json:"location,omitempty"`
|
|
Properties map[string]interface{} `json:"properties,omitempty"`
|
|
}
|
|
|
|
// UpdateAreaControllerRequest 定义了更新区域主控时需要传入的参数
|
|
type UpdateAreaControllerRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
NetworkID string `json:"network_id" binding:"required"`
|
|
Location string `json:"location,omitempty"`
|
|
Properties map[string]interface{} `json:"properties,omitempty"`
|
|
}
|
|
|
|
// CreateDeviceTemplateRequest 定义了创建设备模板时需要传入的参数
|
|
type CreateDeviceTemplateRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
Category models.DeviceCategory `json:"category" binding:"required"`
|
|
Commands map[string]interface{} `json:"commands" binding:"required"`
|
|
Values []models.ValueDescriptor `json:"values,omitempty"`
|
|
}
|
|
|
|
// UpdateDeviceTemplateRequest 定义了更新设备模板时需要传入的参数
|
|
type UpdateDeviceTemplateRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Manufacturer string `json:"manufacturer,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
Category models.DeviceCategory `json:"category" binding:"required"`
|
|
Commands map[string]interface{} `json:"commands" binding:"required"`
|
|
Values []models.ValueDescriptor `json:"values,omitempty"`
|
|
}
|
|
|
|
// DeviceResponse 定义了返回给客户端的单个设备信息的结构
|
|
type DeviceResponse struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
DeviceTemplateID uint `json:"device_template_id"`
|
|
DeviceTemplateName string `json:"device_template_name"`
|
|
AreaControllerID uint `json:"area_controller_id"`
|
|
AreaControllerName string `json:"area_controller_name"`
|
|
Location string `json:"location"`
|
|
Properties map[string]interface{} `json:"properties"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
// AreaControllerResponse 定义了返回给客户端的单个区域主控信息的结构
|
|
type AreaControllerResponse struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
NetworkID string `json:"network_id"`
|
|
Location string `json:"location"`
|
|
Status string `json:"status"`
|
|
Properties map[string]interface{} `json:"properties"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|
|
|
|
// DeviceTemplateResponse 定义了返回给客户端的单个设备模板信息的结构
|
|
type DeviceTemplateResponse struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
Manufacturer string `json:"manufacturer"`
|
|
Description string `json:"description"`
|
|
Category models.DeviceCategory `json:"category"`
|
|
Commands map[string]interface{} `json:"commands"`
|
|
Values []models.ValueDescriptor `json:"values"`
|
|
CreatedAt string `json:"created_at"`
|
|
UpdatedAt string `json:"updated_at"`
|
|
}
|