package nodes import ( "time" ) // Node is the central entity of Verstak — a tree item that can be // a case, folder, note, document, etc. type Node struct { ID string `json:"id"` ParentID *string `json:"parent_id,omitempty"` Type string `json:"type"` Title string `json:"title"` Slug string `json:"slug"` Path *string `json:"path,omitempty"` Section string `json:"section,omitempty"` SortOrder int `json:"sort_order"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt *time.Time `json:"deleted_at,omitempty"` Revision int `json:"revision"` DeviceID *string `json:"device_id,omitempty"` } // IsDeleted reports whether the node has been soft-deleted. func (n *Node) IsDeleted() bool { return n.DeletedAt != nil } // IsRoot reports whether the node has no parent. func (n *Node) IsRoot() bool { return n.ParentID == nil } // Meta is a generic key-value attached to a node. type Meta struct { Key string `json:"key"` Value string `json:"value"` } // NodeWithMeta bundles a node and its metadata entries. type NodeWithMeta struct { Node Node `json:"node"` Meta []Meta `json:"meta"` }