289 lines
11 KiB
Go
289 lines
11 KiB
Go
package res
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Cable Connection Response
|
|
type CableConnectionResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
FromDeviceID uuid.UUID `json:"from_device_id"`
|
|
ToDeviceID uuid.UUID `json:"to_device_id"`
|
|
CableLength float64 `json:"cable_length"`
|
|
CableType string `json:"cable_type"`
|
|
BranchingType *string `json:"branching_type,omitempty"`
|
|
InstallationDate *time.Time `json:"installation_date,omitempty"`
|
|
Status string `json:"status"`
|
|
StatusColor string `json:"status_color"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
|
|
// Device Information
|
|
FromDevice *CableDeviceInfo `json:"from_device,omitempty"`
|
|
ToDevice *CableDeviceInfo `json:"to_device,omitempty"`
|
|
|
|
// Calculated Fields
|
|
RouteEfficiency *float64 `json:"route_efficiency,omitempty"` // Percentage
|
|
EstimatedCost *float64 `json:"estimated_cost,omitempty"`
|
|
MaintenanceDue *bool `json:"maintenance_due,omitempty"`
|
|
QualityScore *float64 `json:"quality_score,omitempty"`
|
|
}
|
|
|
|
type CableDeviceInfo struct {
|
|
ID uuid.UUID `json:"id"`
|
|
DeviceCode string `json:"device_code"`
|
|
DeviceType string `json:"device_type"`
|
|
Latitude float64 `json:"latitude"`
|
|
Longitude float64 `json:"longitude"`
|
|
Province *string `json:"province,omitempty"`
|
|
City *string `json:"city,omitempty"`
|
|
}
|
|
|
|
// Cable Length Distribution Response
|
|
type CableLengthDistributionResponse struct {
|
|
Under100m int `json:"under_100m"`
|
|
From100To500m int `json:"from_100_500m"`
|
|
From500To1000m int `json:"from_500_1000m"`
|
|
From1To5km int `json:"from_1_5km"`
|
|
Above5km int `json:"above_5km"`
|
|
AverageLength float64 `json:"average_length"`
|
|
MinLength float64 `json:"min_length"`
|
|
MaxLength float64 `json:"max_length"`
|
|
TotalConnections int `json:"total_connections"`
|
|
}
|
|
|
|
// Cable Type Analytics Response
|
|
type CableTypeAnalyticsResponse struct {
|
|
TypeStats []CableTypeStats `json:"type_stats"`
|
|
TotalConnections int `json:"total_connections"`
|
|
TotalLength float64 `json:"total_length"`
|
|
MostUsedType string `json:"most_used_type"`
|
|
LeastUsedType string `json:"least_used_type"`
|
|
}
|
|
|
|
type CableTypeStats struct {
|
|
CableType string `json:"cable_type"`
|
|
Count int `json:"count"`
|
|
AverageLength float64 `json:"average_length"`
|
|
TotalLength float64 `json:"total_length"`
|
|
Percentage float64 `json:"percentage"`
|
|
}
|
|
|
|
// Cable Status Summary Response
|
|
type CableStatusSummaryResponse struct {
|
|
StatusStats []CableStatusStats `json:"status_stats"`
|
|
TotalConnections int `json:"total_connections"`
|
|
HealthScore float64 `json:"health_score"` // 0-100
|
|
}
|
|
|
|
type CableStatusStats struct {
|
|
Status string `json:"status"`
|
|
Count int `json:"count"`
|
|
Percentage float64 `json:"percentage"`
|
|
}
|
|
|
|
// Optimal Route Response
|
|
type OptimalRouteResponse struct {
|
|
FromDeviceID uuid.UUID `json:"from_device_id"`
|
|
ToDeviceID uuid.UUID `json:"to_device_id"`
|
|
DirectDistance float64 `json:"direct_distance"`
|
|
RecommendedCableLength float64 `json:"recommended_cable_length"`
|
|
ExistingConnections []RouteConnectionResponse `json:"existing_connections"`
|
|
AlternativeRoutes []AlternativeRoute `json:"alternative_routes,omitempty"`
|
|
Recommendations []string `json:"recommendations"`
|
|
EstimatedCost *float64 `json:"estimated_cost,omitempty"`
|
|
ComplexityScore float64 `json:"complexity_score"` // 1-10
|
|
}
|
|
|
|
type RouteConnectionResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
FromDeviceID uuid.UUID `json:"from_device_id"`
|
|
ToDeviceID uuid.UUID `json:"to_device_id"`
|
|
CableLength float64 `json:"cable_length"`
|
|
CableType string `json:"cable_type"`
|
|
Status string `json:"status"`
|
|
HopCount int `json:"hop_count"`
|
|
TotalLength float64 `json:"total_length"`
|
|
}
|
|
|
|
type AlternativeRoute struct {
|
|
RouteID string `json:"route_id"`
|
|
Path []RouteConnectionResponse `json:"path"`
|
|
TotalLength float64 `json:"total_length"`
|
|
HopCount int `json:"hop_count"`
|
|
EstimatedCost *float64 `json:"estimated_cost,omitempty"`
|
|
ReliabilityScore float64 `json:"reliability_score"` // 0-100
|
|
Recommendations []string `json:"recommendations"`
|
|
}
|
|
|
|
// Cable Path Response
|
|
type CablePathResponse struct {
|
|
FromDeviceID uuid.UUID `json:"from_device_id"`
|
|
ToDeviceID uuid.UUID `json:"to_device_id"`
|
|
TotalLength float64 `json:"total_length"`
|
|
HopCount int `json:"hop_count"`
|
|
ConnectionPath []uuid.UUID `json:"connection_path"`
|
|
PathDetails []PathSegment `json:"path_details"`
|
|
IsComplete bool `json:"is_complete"`
|
|
QualityScore *float64 `json:"quality_score,omitempty"`
|
|
}
|
|
|
|
type PathSegment struct {
|
|
ConnectionID uuid.UUID `json:"connection_id"`
|
|
FromDevice CableDeviceInfo `json:"from_device"`
|
|
ToDevice CableDeviceInfo `json:"to_device"`
|
|
CableLength float64 `json:"cable_length"`
|
|
CableType string `json:"cable_type"`
|
|
Status string `json:"status"`
|
|
SignalLoss *float64 `json:"signal_loss,omitempty"`
|
|
SegmentOrder int `json:"segment_order"`
|
|
}
|
|
|
|
// Network Map Response
|
|
type NetworkMapResponse struct {
|
|
Connections []NetworkMapConnection `json:"connections"`
|
|
Stats NetworkMapStats `json:"stats"`
|
|
Bounds *CableMapBounds `json:"bounds,omitempty"`
|
|
}
|
|
|
|
type NetworkMapConnection struct {
|
|
ID uuid.UUID `json:"id"`
|
|
FromDeviceID uuid.UUID `json:"from_device_id"`
|
|
ToDeviceID uuid.UUID `json:"to_device_id"`
|
|
CableLength float64 `json:"cable_length"`
|
|
CableType string `json:"cable_type"`
|
|
Status string `json:"status"`
|
|
FromDeviceCode string `json:"from_device_code"`
|
|
FromDeviceType string `json:"from_device_type"`
|
|
FromLatitude float64 `json:"from_latitude"`
|
|
FromLongitude float64 `json:"from_longitude"`
|
|
ToDeviceCode string `json:"to_device_code"`
|
|
ToDeviceType string `json:"to_device_type"`
|
|
ToLatitude float64 `json:"to_latitude"`
|
|
ToLongitude float64 `json:"to_longitude"`
|
|
}
|
|
|
|
type NetworkMapStats struct {
|
|
TotalConnections int `json:"total_connections"`
|
|
AverageLength float64 `json:"average_length"`
|
|
TotalLength float64 `json:"total_length"`
|
|
UniqueDevices int `json:"unique_devices"`
|
|
}
|
|
|
|
type CableMapBounds struct {
|
|
NorthEast CableCoordinate `json:"north_east"`
|
|
SouthWest CableCoordinate `json:"south_west"`
|
|
}
|
|
|
|
type CableCoordinate struct {
|
|
Latitude float64 `json:"latitude"`
|
|
Longitude float64 `json:"longitude"`
|
|
}
|
|
|
|
// Maintenance Response
|
|
type MaintenanceItemResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
FromDeviceID uuid.UUID `json:"from_device_id"`
|
|
ToDeviceID uuid.UUID `json:"to_device_id"`
|
|
CableLength float64 `json:"cable_length"`
|
|
CableType string `json:"cable_type"`
|
|
InstallationDate *time.Time `json:"installation_date,omitempty"`
|
|
Status string `json:"status"`
|
|
FromDeviceCode string `json:"from_device_code"`
|
|
ToDeviceCode string `json:"to_device_code"`
|
|
DaysSinceInstallation int `json:"days_since_installation"`
|
|
MaintenancePriority string `json:"maintenance_priority"`
|
|
RecommendedAction string `json:"recommended_action"`
|
|
}
|
|
|
|
// Cable Analysis Response
|
|
type CableAnalysisResponse struct {
|
|
ConnectionID *uuid.UUID `json:"connection_id,omitempty"`
|
|
AnalysisType string `json:"analysis_type"`
|
|
OverallScore float64 `json:"overall_score"` // 0-100
|
|
SignalQuality *SignalQualityMetrics `json:"signal_quality,omitempty"`
|
|
RouteOptimization *RouteOptimizationMetrics `json:"route_optimization,omitempty"`
|
|
CostAnalysis *CostAnalysisMetrics `json:"cost_analysis,omitempty"`
|
|
Recommendations []string `json:"recommendations"`
|
|
Warnings []string `json:"warnings,omitempty"`
|
|
Alternatives []AlternativeRoute `json:"alternatives,omitempty"`
|
|
GeneratedAt time.Time `json:"generated_at"`
|
|
}
|
|
|
|
type SignalQualityMetrics struct {
|
|
SignalLoss float64 `json:"signal_loss"`
|
|
OpticalPower float64 `json:"optical_power"`
|
|
SNR *float64 `json:"snr,omitempty"`
|
|
QualityGrade string `json:"quality_grade"` // A, B, C, D, F
|
|
IsWithinLimits bool `json:"is_within_limits"`
|
|
}
|
|
|
|
type RouteOptimizationMetrics struct {
|
|
DirectDistance float64 `json:"direct_distance"`
|
|
ActualCableLength float64 `json:"actual_cable_length"`
|
|
EfficiencyRatio float64 `json:"efficiency_ratio"`
|
|
OptimalPathExists bool `json:"optimal_path_exists"`
|
|
PotentialSavings *float64 `json:"potential_savings,omitempty"`
|
|
}
|
|
|
|
type CostAnalysisMetrics struct {
|
|
MaterialCost float64 `json:"material_cost"`
|
|
InstallationCost float64 `json:"installation_cost"`
|
|
MaintenanceCost float64 `json:"maintenance_cost"`
|
|
TotalCost float64 `json:"total_cost"`
|
|
CostPerMeter float64 `json:"cost_per_meter"`
|
|
CostEfficiency string `json:"cost_efficiency"` // excellent, good, fair, poor
|
|
}
|
|
|
|
// Network Health Response
|
|
type NetworkHealthResponse struct {
|
|
OverallHealth float64 `json:"overall_health"` // 0-100
|
|
TotalConnections int `json:"total_connections"`
|
|
HealthByType []TypeHealthMetrics `json:"health_by_type"`
|
|
HealthByRegion []RegionHealthMetrics `json:"health_by_region"`
|
|
CriticalIssues []HealthIssue `json:"critical_issues"`
|
|
Recommendations []string `json:"recommendations"`
|
|
LastUpdated time.Time `json:"last_updated"`
|
|
}
|
|
|
|
type TypeHealthMetrics struct {
|
|
CableType string `json:"cable_type"`
|
|
HealthScore float64 `json:"health_score"`
|
|
TotalConnections int `json:"total_connections"`
|
|
IssueCount int `json:"issue_count"`
|
|
}
|
|
|
|
type RegionHealthMetrics struct {
|
|
Region string `json:"region"`
|
|
HealthScore float64 `json:"health_score"`
|
|
TotalConnections int `json:"total_connections"`
|
|
IssueCount int `json:"issue_count"`
|
|
}
|
|
|
|
type HealthIssue struct {
|
|
ConnectionID uuid.UUID `json:"connection_id"`
|
|
IssueType string `json:"issue_type"`
|
|
Severity string `json:"severity"`
|
|
Description string `json:"description"`
|
|
RecommendedAction string `json:"recommended_action"`
|
|
DetectedAt time.Time `json:"detected_at"`
|
|
}
|
|
|
|
// Bulk Operation Response
|
|
type BulkOperationResponse struct {
|
|
TotalRequested int `json:"total_requested"`
|
|
Successful int `json:"successful"`
|
|
Failed int `json:"failed"`
|
|
Errors []BulkOperationError `json:"errors,omitempty"`
|
|
Results []CableConnectionResponse `json:"results,omitempty"`
|
|
ExecutionTime string `json:"execution_time"`
|
|
}
|
|
|
|
type BulkOperationError struct {
|
|
Index int `json:"index"`
|
|
Error string `json:"error"`
|
|
Details string `json:"details,omitempty"`
|
|
}
|