You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

47 lines
1.1 KiB

package events
import (
"fmt"
lucifer3 "git.aiterp.net/lucifer3/server"
"git.aiterp.net/lucifer3/server/internal/gentools"
"github.com/google/uuid"
"strings"
)
type AssignmentCreated struct {
ID uuid.UUID
Match string
Effect lucifer3.Effect
}
func (e AssignmentCreated) EventDescription() string {
return fmt.Sprintf("AssignmentCreated(id=%s, match=%s, effect=%s)", e.ID, e.Match, e.Effect.EffectDescription())
}
type AssignmentRemoved struct {
ID uuid.UUID
}
func (e AssignmentRemoved) EventDescription() string {
return fmt.Sprintf("AssignmentRemoved(id=%s)", e.ID)
}
type DeviceAssigned struct {
DeviceID string `json:"deviceId"`
AssignmentID *uuid.UUID `json:"assignmentId"`
}
func (e DeviceAssigned) EventDescription() string {
return fmt.Sprintf("DeviceAssigned(device=%s, %s)", e.DeviceID, e.AssignmentID)
}
type AssignmentVariables struct {
ID uuid.UUID
Map map[string]float64
}
func (e AssignmentVariables) EventDescription() string {
return fmt.Sprintf("AssignmentVariables(id=%s, keys=[%s])",
e.ID, strings.Join(gentools.MapKeys(e.Map), ","),
)
}