oc-lib/models/resources/workflow/graph/graph.go
2024-07-24 17:08:30 +02:00

42 lines
1.9 KiB
Go

package graph
type Graph struct {
Items map[string]GraphItem `bson:"items" json:"items" default:"{}" validate:"required"`
Links []GraphLink `bson:"links" json:"links" default:"{}" validate:"required"`
}
type GraphItem struct {
ID string `bson:"id" json:"id" validate:"required"`
Width float64 `bson:"width" json:"width" validate:"required"`
Height float64 `bson:"height" json:"height" validate:"required"`
Position Position `bson:"position" json:"position" validate:"required"`
ResourceID string `bson:"resource_id" json:"resource_id" validate:"required"`
}
type GraphLink struct {
Source Position `bson:"source" json:"source" validate:"required"`
Destination Position `bson:"destination" json:"destination" validate:"required"`
Style GraphLinkStyle `bson:"style" json:"style" validate:"required"`
}
type GraphLinkStyle struct {
Color int64 `bson:"color" json:"color" validate:"required"`
Stroke float64 `bson:"stroke" json:"stroke" validate:"required"`
Tension float64 `bson:"tension" json:"tension"`
HeadRadius float64 `bson:"head_radius" json:"head_radius"`
DashWidth float64 `bson:"dash_width" json:"dash_width"`
DashSpace float64 `bson:"dash_space" json:"dash_space"`
EndArrow Position `bson:"end_arrow" json:"end_arrow"`
StartArrow Position `bson:"start_arrow" json:"start_arrow"`
ArrowStyle int64 `bson:"arrow_style" json:"arrow_style" validate:"required"`
ArrowDirection int64 `bson:"arrow_direction" json:"arrow_direction" validate:"required"`
StartArrowWidth float64 `bson:"start_arrow_width" json:"start_arrow_width"`
EndArrowWidth float64 `bson:"end_arrow_width" json:"end_arrow_width"`
}
type Position struct {
ID string `json:"id" bson:"id" validate:"required"`
X float64 `json:"x" bson:"x" validate:"required"`
Y float64 `json:"y" bson:"y" validate:"required"`
}