package models


import (
	"github.com/jinzhu/gorm"
)

// Rule rule
// rule is used for automated works such as timers, ifttts.
type Rule struct {
	gorm.Model
	RecordId string `gorm:"column:record_id;size:32;index"`
	// which device the rule belongs to
	DeviceID string
	// rule type, timmer | ifttt
	RuleType string `sql:"type:varchar(20);not null;"`
	// which action triggers the rule
	Trigger string `sql:"type:varchar(200);not null;"`
	// where to send
	Target string `sql:"type:varchar(200);not null;"`
	// what action to take.
	Action string `sql:"type:varchar(200);not null;"`
	// if trigger once
	Once bool `sql:"default(false)"`
}