package model

import "time"

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