package model

import "time"

// Alarm 告警数据对象 alarm
type Alarm struct {
	ID                string    `json:"id" gorm:"id"`
	AlarmSeq          string    `json:"alarmSeq" gorm:"alarm_seq"`
	AlarmId           string    `json:"alarmId" gorm:"alarm_id"`
	AlarmTitle        string    `json:"alarmTitle" gorm:"alarm_title"`
	NeType            string    `json:"neType" gorm:"ne_type"`
	NeId              string    `json:"neId" gorm:"ne_id"`
	AlarmCode         string    `json:"alarmCode" gorm:"alarm_code"`
	EventTime         time.Time `json:"eventTime" gorm:"event_time"`
	AlarmType         string    `json:"alarmType" gorm:"alarm_type"`
	OrigSeverity      string    `json:"origSeverity" gorm:"orig_severity"`           // 1: Critical, 2: Major, 3: Minor, 4: Warning, 5: Event(Only VNF)
	PerceivedSeverity string    `json:"perceivedSeverity" gorm:"perceived_severity"` // 1: Critical, 2: Major, 3: Minor, 4: Warning, 5: Event(Only VNF)
	PvFlag            string    `json:"pvFlag" gorm:"pv_flag"`
	NeName            string    `json:"neName" gorm:"ne_name"`
	ObjectUid         string    `json:"objectUid" gorm:"object_uid"`
	ObjectName        string    `json:"objectName" gorm:"object_name"`
	ObjectType        string    `json:"objectType" gorm:"object_type"`
	LocationInfo      string    `json:"locationInfo" gorm:"location_info"`
	Province          string    `json:"province" gorm:"province"`
	AlarmStatus       string    `json:"alarmStatus" gorm:"alarm_status"` // 0:clear, 1:active
	SpecificProblem   string    `json:"specificProblem" gorm:"specific_problem"`
	SpecificProblemId string    `json:"specificProblemId" gorm:"specific_problem_id"`
	AddInfo           string    `json:"addInfo" gorm:"add_info"`
	Counter           string    `json:"counter" gorm:"counter"`
	LatestEventTime   time.Time `json:"latestEventTime" gorm:"latest_event_time"`
	AckState          string    `json:"ackState" gorm:"ack_state"` // 0: Unacked, 1: Acked
	AckTime           time.Time `json:"ackTime" gorm:"ack_time"`
	AckUser           string    `json:"ackUser" gorm:"ack_user"`
	ClearType         string    `json:"clearType" gorm:"clear_type"` // 0: Unclear, 1: AutoClear, 2: ManualClear
	ClearTime         time.Time `json:"clearTime" gorm:"clear_time"`
	ClearUser         string    `json:"clearUser" gorm:"clear_user"`
	Timestamp         time.Time `json:"timestamp" gorm:"timestamp"`
}

// TableName 表名称
func (*Alarm) TableName() string {
	return "alarm"
}

// AlarmQuery 告警数据查询参数结构体
type AlarmQuery struct {
	NeType       string `json:"neType" form:"neType" binding:"required"` // 网元类型
	NeID         string `json:"neId" form:"neId" binding:"required"`
	RmUID        string `json:"rmUID" form:"rmUID"`
	OrigSeverity string `json:"origSeverity" form:"origSeverity"` // 告警类型 1: Critical, 2: Major, 3: Minor, 4: Warning, 5: Event(Only VNF)
	StartTime    string `json:"startTime" form:"startTime"`
	EndTime      string `json:"endTime" form:"endTime"`
	SortField    string `json:"sortField" form:"sortField" binding:"omitempty,oneof=timestamp"` // 排序字段，填写结果字段
	SortOrder    string `json:"sortOrder" form:"sortOrder" binding:"omitempty,oneof=asc desc"`  // 排序升降序，asc desc
	PageNum      int64  `json:"pageNum" form:"pageNum" binding:"required"`
	PageSize     int64  `json:"pageSize" form:"pageSize" binding:"required"`
}
