dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts@v1.0.2/dtos/devicestatus.go (about)

     1  package dtos
     2  
     3  import (
     4  	"dev.azure.com/aidainnovazione0090/DeviceManager/_git/go-mod-core-contracts/models"
     5  )
     6  
     7  // DeviceStatus represents a Data Transfer Object for DeviceStatus.
     8  type DeviceStatus struct {
     9  	DeviceName string            `json:"deviceName"` // The name or identifier of the device.
    10  	Status     models.StatusKind `json:"status"`     // The current status of the device.
    11  	Origin     int64             `json:"origin"`     // The origin or source of the status update.
    12  	LastUpdate int64             `json:"lastUpdate"` // The timestamp of the last status update.
    13  
    14  	AlarmCount  int64                `json:"alarmCount"`  // The number of alarms associated with the device.
    15  	MaxSeverity models.AlarmSeverity `json:"maxSeverity"` // The maximum severity level of the alarms for the device.
    16  	Silence     models.SilenceKind   `json:"silence"`     // The silent status of the device.
    17  }
    18  
    19  func FromDeviceStatusModelToDTO(d models.DeviceStatus) DeviceStatus {
    20  	return DeviceStatus{
    21  		DeviceName:  d.DeviceName,
    22  		Status:      d.Status,
    23  		Origin:      d.Origin,
    24  		LastUpdate:  d.LastUpdate,
    25  		AlarmCount:  d.AlarmCount,
    26  		MaxSeverity: d.MaxSeverity,
    27  		Silence:     d.Silence,
    28  	}
    29  }