82 lines
3.0 KiB
Go
82 lines
3.0 KiB
Go
package res
|
|
|
|
import (
|
|
"time"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Simplified response for list
|
|
type NearestDeviceResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
DeviceCode string `json:"device_code"`
|
|
DeviceType string `json:"device_type"`
|
|
Distance float64 `json:"distance_km"`
|
|
Address string `json:"address"`
|
|
Longitude float64 `json:"longitude"`
|
|
Latitude float64 `json:"latitude"`
|
|
Status string `json:"status"`
|
|
PortAmount int `json:"port_amount"`
|
|
Region *string `json:"region,omitempty"`
|
|
Province *string `json:"province,omitempty"`
|
|
City *string `json:"city,omitempty"`
|
|
District *string `json:"district,omitempty"`
|
|
ImageURL *string `json:"image_url"`
|
|
|
|
// Connection counts
|
|
BackboneCount int `json:"backbone_count"`
|
|
FishboneCount int `json:"fishbone_count"`
|
|
TowerCount int `json:"tower_count"`
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// Detailed response for single device
|
|
type NearestDeviceDetailResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
DeviceCode string `json:"device_code"`
|
|
DeviceType string `json:"device_type"`
|
|
Distance float64 `json:"distance_km"`
|
|
Address string `json:"address"`
|
|
Longitude float64 `json:"longitude"`
|
|
Latitude float64 `json:"latitude"`
|
|
Status string `json:"status"`
|
|
PortAmount int `json:"port_amount"`
|
|
Region *string `json:"region,omitempty"`
|
|
Province *string `json:"province,omitempty"`
|
|
City *string `json:"city,omitempty"`
|
|
District *string `json:"district,omitempty"`
|
|
ImageURL *string `json:"image_url"`
|
|
ImageURLs []string `json:"image_urls"`
|
|
|
|
// Detailed connection information
|
|
Backbones []BackboneConnectionInfo `json:"backbones"`
|
|
Fishbones []FishboneConnectionInfo `json:"fishbones"`
|
|
Towers []TowerConnectionInfo `json:"towers"`
|
|
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type BackboneConnectionInfo struct {
|
|
ID uuid.UUID `json:"id"`
|
|
BackboneCode string `json:"backbone_code"`
|
|
CoreAmount int `json:"core_amount"`
|
|
IsStartDevice bool `json:"is_start_device"`
|
|
ConnectedTo string `json:"connected_to"` // Device code of the other end
|
|
}
|
|
|
|
type FishboneConnectionInfo struct {
|
|
ID uuid.UUID `json:"id"`
|
|
FishboneCode string `json:"fishbone_code"`
|
|
CoreAmount int `json:"core_amount"`
|
|
BackboneCode string `json:"backbone_code"`
|
|
IsStartDevice bool `json:"is_start_device"`
|
|
ConnectedTo string `json:"connected_to"` // Device code of the other end
|
|
}
|
|
|
|
type TowerConnectionInfo struct {
|
|
ID uuid.UUID `json:"id"`
|
|
TowerCode string `json:"tower_code"`
|
|
Distance float64 `json:"distance_km"` // Distance from tower to device
|
|
ImageURL *string `json:"image_url,omitempty"`
|
|
} |