- Metadata =
Model.define(
:changes, :comment, :parameters,
types: {changes: Hash, comment: String, parameters: Hash}
)
- Event =
Model.define(
:name, :domain, :metadata,
types: {name: String, domain: String, metadata: Metadata},
transforms: {metadata: ->(value) { Metadata.parse(value) }}
)
- Concept =
Model.define(
:id, :relation, :content,
types: {id: String, relation: String, content: Hash}
)
- Chain =
Model.define(
:id, :name,
types: {id: String, name: String}
)
- Thought =
Model.define(
:chain, :relation, :index,
types: {chain: Chain, relation: String, index: Integer},
transforms: {chain: ->(value) { Chain.parse(value) }}
)
- OriginEntity =
Model.define(
:id, :current_state, :identifier,
types: {id: String, current_state: String, identifier: String}
)
- Flow =
Model.define(
:id, :origin_entity,
types: {id: String, origin_entity: OriginEntity},
transforms: {origin_entity: ->(value) { OriginEntity.parse(value) }}
)
- Branch =
Model.define(
:id, :chain_id, :current_state, :flow,
types: {id: String, chain_id: String, current_state: String, flow: Flow},
transforms: {flow: ->(value) { Flow.parse(value) }}
)
- Step =
Model.define(
:id, :current_state, :index, :attempt, :concepts, :thought, :branch,
defaults: {concepts: []},
types: {
id: String, current_state: String, index: Integer, attempt: Integer,
concepts: Array, thought: Thought, branch: Branch
},
transforms: {
concepts: lambda do |value|
raise Error::ValidationError, "concepts must be an array" unless value.is_a?(Array)
value.map { |concept| Concept.parse(concept) }
end,
thought: ->(value) { Thought.parse(value) },
branch: ->(value) { Branch.parse(value) }
}
)