package model

type UserOnlineDevice struct {
	ID          uint64 `gorm:"primaryKey;column:id" json:"id"`
	UserID      int    `gorm:"column:user_id;index:idx_user_online_devices_user;uniqueIndex:idx_user_online_devices_unique" json:"user_id"`
	NodeID      int    `gorm:"column:node_id;index:idx_user_online_devices_node;uniqueIndex:idx_user_online_devices_unique" json:"node_id"`
	IP          string `gorm:"column:ip;size:191;uniqueIndex:idx_user_online_devices_unique" json:"ip"`
	FirstSeenAt int64  `gorm:"column:first_seen_at" json:"first_seen_at"`
	LastSeenAt  int64  `gorm:"column:last_seen_at;index:idx_user_online_devices_last_seen" json:"last_seen_at"`
	ExpiresAt   int64  `gorm:"column:expires_at;index:idx_user_online_devices_expires" json:"expires_at"`
	CreatedAt   int64  `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   int64  `gorm:"column:updated_at" json:"updated_at"`

	User User `gorm:"foreignKey:UserID;references:ID" json:"user"`
}

func (UserOnlineDevice) TableName() string {
	return "v2_user_online_devices"
}
