package models

import "github.com/jinzhu/gorm"

// Device device model
// device is a product instance, which is managed by our platform
type Device struct {
	gorm.Model
	RecordId string `gorm:"column:record_id;size:32;index"`
	// which product the device belongs to
	ProductID string `gorm:"column:product_id;size:32;index"`
	// universal device identifier, generated from vendorid-productid-deviceserial
	DeviceIdentifier string `sql:"type:varchar(200);not null;unique;key"`
	// device secret which is auto generated by the platform
	DeviceSecret string `sql:"type:varchar(200);not null;"`
	// device key is used to auth a device
	DeviceKey string `sql:"type:varchar(200);not null;key;"`
	// device name
	DeviceName string `sql:"type:varchar(200);not null;"`
	// device desc
	DeviceDescription string `sql:"type:text;not null;"`
	// device version(the agent version)
	DeviceVersion string `sql:"type:text;not null;"`
	// vendor id
	VendorID string `gorm:"column:vendor_id;size:32;index"`
	//通讯模组名称
	ModuleName string
}

// DeviceQuery device query
type DeviceQuery struct {
	Device
	ProductName string
}

// Devices
type Devices struct {
	Device
	Status int
}

// DeviceChartData 设备数据图表
type DeviceChartData struct {
	Dt    string
	Count int
}
