package model

import "github.com/jinzhu/gorm"

// All 导出
type All struct {
	Product       *Product
	Vendor        *Vendor
	User          *User
	Application   *Application
	Protocal      *Protocal
	Sensor        *Sensor
	Alert         *Alert
	Device        *Device
	SubDevice     *SubDevice
	Role          *Role
	Relation      *Relation
	RuleChain     *RuleChain
	RuleNode      *RuleNode
	Ota           *Ota
	SceneHis      *SceneHis
	DeviceCommand *DeviceCommandModel
	DeviceStatus  *DeviceStatusModel
}

// Init 初始化所有model
func (a *All) Init(db *gorm.DB) *All {
	a.Product = new(Product).Init(db)
	a.Vendor = new(Vendor).Init(db)
	a.User = new(User).Init(db)
	a.Application = new(Application).Init(db)
	a.Protocal = new(Protocal).Init(db)
	a.Sensor = new(Sensor).Init(db)
	a.Alert = new(Alert).Init(db)
	a.Device = new(Device).Init(db)
	a.SubDevice = new(SubDevice).Init(db)
	a.Role = new(Role).Init(db)
	a.Relation = new(Relation).Init(db)
	a.RuleChain = new(RuleChain).Init(db)
	a.RuleNode = new(RuleNode).Init(db)
	a.Ota = new(Ota).Init(db)
	a.SceneHis = new(SceneHis).Init(db)
	a.DeviceCommand = new(DeviceCommandModel).Init(db)
	a.DeviceStatus = new(DeviceStatusModel).Init(db)
	return a
}
