package app import ( "context" "encoding/json" "time" "github.com/dtoro/oikos/internal/core/domain" "github.com/dtoro/oikos/internal/core/ports" "github.com/google/uuid" ) // EntityService owns the entity aggregate's use-cases: create with derived // checks, update with optimistic versioning and check regeneration, // lifecycle transitions. Validation against the (cached) ontology happens // here, in the pure half; transactional check-then-act invariants // (version, declared transitions, preconditions) run in the repository // (plan ยง3.6). type EntityService struct { entities ports.EntityRepository onto ports.OntologyStore } // NewEntityService wires the service. func NewEntityService(entities ports.EntityRepository, onto ports.OntologyStore) *EntityService { return &EntityService{entities: entities, onto: onto} } // CreateEntityCmd is one entity creation. Actor identifies the calling // surface for the audit trail ("operator: