package rule

import (
	"cloud.o-forge.io/core/oc-lib/models/utils"
	"cloud.o-forge.io/core/oc-lib/tools"
	"github.com/google/uuid"
)

/*
* Rule is a struct that represents a rule of a shared workspace
 */
type Rule struct {
	utils.AbstractObject          // AbstractObject contains the basic fields of an object (id, name)
	Description          string   `json:"description,omitempty" bson:"description,omitempty"` // Description is the description of the rule
	Condition            string   `json:"condition,omitempty" bson:"condition,omitempty"`     // NOT DEFINITIVE TO SPECIFICATION
	Actions              []string `json:"actions,omitempty" bson:"actions,omitempty"`         // NOT DEFINITIVE TO SPECIFICATION
}

func (r *Rule) GenerateID() {
	r.UUID = uuid.New().String()
}

func (d *Rule) GetAccessor(request *tools.APIRequest) utils.Accessor {
	return NewAccessor(request)
}

func (d *Rule) VerifyAuth(request *tools.APIRequest) bool {
	return true
}
