// rule is used for automated works such as timers, ifttts.
package models

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

// Rule rule
type Rule struct {
	gorm.Model
	// which device the rule belongs to
	DeviceID int64
	// 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)"`
}
