Files
boc/docs/arc/domain-model.schema.json
T
Bernt bae705aa97 ARCHITECTURE: NFC roadmap, edge AI, audit logging
- Add NFC ePassport roadmap (ICAO 9303, eIDAS)
- Add TensorFlow.js edge face detection (BlazeFace)
- Add structured audit logger (GDPR-compliant)
- Risk scoring support

Part of KYC Apple Native UX v1.1.0
2026-06-29 16:24:48 +00:00

612 lines
21 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://aamos.io/schemas/domain-model/v1.0.0",
"title": "AAMOS Canonical Domain Model",
"description": "JSON Schema for the AAMOS canonical object system. All domain objects must conform to the Entity base contract and their specific type schema.",
"definitions": {
"uuid": {
"type": "string",
"format": "uuid",
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
},
"iso8601_datetime": {
"type": "string",
"format": "date-time"
},
"iso8601_date": {
"type": "string",
"format": "date"
},
"currency_code": {
"type": "string",
"pattern": "^[A-Z]{3}$",
"description": "ISO 4217 currency code"
},
"country_code": {
"type": "string",
"pattern": "^[A-Z]{2}$",
"description": "ISO 3166-1 alpha-2 country code"
},
"data_classification": {
"type": "string",
"enum": ["public", "internal", "confidential", "restricted"],
"description": "Data sensitivity level per ARC-003"
},
"EntityBase": {
"type": "object",
"description": "Abstract base contract. All canonical objects must include these fields.",
"required": ["id", "tenant_id", "created_at", "updated_at", "created_by", "version"],
"properties": {
"id": {
"$ref": "#/definitions/uuid",
"description": "UUID v7 — globally unique, time-ordered"
},
"tenant_id": {
"$ref": "#/definitions/uuid",
"description": "Isolation domain per ARC-003"
},
"created_at": {
"$ref": "#/definitions/iso8601_datetime",
"description": "Creation timestamp, UTC"
},
"updated_at": {
"$ref": "#/definitions/iso8601_datetime",
"description": "Last update timestamp, UTC"
},
"created_by": {
"$ref": "#/definitions/uuid",
"description": "Person.id or system identifier"
},
"deleted_at": {
"oneOf": [
{ "$ref": "#/definitions/iso8601_datetime" },
{ "type": "null" }
],
"description": "Soft-delete timestamp. null = active"
},
"version": {
"type": "integer",
"minimum": 1,
"description": "Optimistic locking version, incremented on every UPDATE"
},
"metadata": {
"type": "object",
"description": "Module-specific extensions as key-value pairs",
"additionalProperties": true
}
}
},
"Organization": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["name", "org_type", "country_code", "status"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"org_number": { "type": ["string", "null"], "description": "Legal registration number" },
"org_type": {
"type": "string",
"enum": ["company", "department", "team", "group", "subsidiary"]
},
"parent_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }],
"description": "Self-referential hierarchy"
},
"country_code": { "$ref": "#/definitions/country_code" },
"tax_id": { "type": ["string", "null"], "description": "VAT registration number" },
"currency_code": { "$ref": "#/definitions/currency_code" },
"status": {
"type": "string",
"enum": ["active", "inactive", "merged", "dissolved"]
},
"external_refs": {
"type": "object",
"description": "External system IDs: erp_id, crm_id, etc.",
"additionalProperties": { "type": "string" }
}
}
}
]
},
"Person": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["first_name", "last_name", "person_type"],
"properties": {
"first_name": { "type": "string", "minLength": 1 },
"last_name": { "type": "string", "minLength": 1 },
"display_name": { "type": ["string", "null"] },
"email": {
"oneOf": [
{ "type": "string", "format": "email" },
{ "type": "null" }
]
},
"phone": {
"type": ["string", "null"],
"description": "E.164 format: +46701234567"
},
"national_id": {
"type": ["string", "null"],
"description": "Encrypted at rest. GDPR restricted."
},
"person_type": {
"type": "string",
"enum": ["employee", "contact", "customer", "owner", "system"]
},
"primary_org_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"user_account_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"gdpr_consent": {
"type": "object",
"description": "Consent register per processing purpose",
"additionalProperties": {
"type": "object",
"required": ["granted", "granted_at"],
"properties": {
"granted": { "type": "boolean" },
"granted_at": { "$ref": "#/definitions/iso8601_datetime" },
"expires_at": {
"oneOf": [
{ "$ref": "#/definitions/iso8601_datetime" },
{ "type": "null" }
]
}
}
}
}
}
}
]
},
"Asset": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["name", "asset_type", "status"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"asset_type": {
"type": "string",
"enum": ["fixed_asset", "inventory", "product", "license", "resource", "intangible"]
},
"serial_number": { "type": ["string", "null"] },
"acquisition_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_date" }, { "type": "null" }]
},
"acquisition_cost": {
"oneOf": [{ "type": "number", "minimum": 0 }, { "type": "null" }]
},
"currency_code": {
"oneOf": [{ "$ref": "#/definitions/currency_code" }, { "type": "null" }]
},
"owner_org_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"location_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"status": {
"type": "string",
"enum": ["active", "disposed", "under_maintenance", "transferred"]
},
"depreciation_policy": {
"oneOf": [
{
"type": "object",
"properties": {
"method": { "type": "string", "enum": ["straight_line", "declining_balance", "sum_of_years_digits", "units_of_production"] },
"useful_life_years": { "type": "number", "minimum": 0 },
"residual_value": { "type": "number", "minimum": 0 },
"rate_percent": { "type": ["number", "null"] }
},
"required": ["method"]
},
{ "type": "null" }
]
}
}
}
]
},
"Location": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["location_type", "country_code"],
"properties": {
"name": { "type": ["string", "null"] },
"location_type": {
"type": "string",
"enum": ["address", "workplace", "warehouse", "country", "virtual"]
},
"street": { "type": ["string", "null"] },
"city": { "type": ["string", "null"] },
"postal_code": { "type": ["string", "null"] },
"country_code": { "$ref": "#/definitions/country_code" },
"region": { "type": ["string", "null"] },
"coordinates": {
"oneOf": [
{
"type": "object",
"required": ["longitude", "latitude"],
"properties": {
"longitude": { "type": "number", "minimum": -180, "maximum": 180 },
"latitude": { "type": "number", "minimum": -90, "maximum": 90 }
}
},
{ "type": "null" }
]
},
"parent_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
}
}
}
]
},
"Project": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["name", "project_type", "status", "owner_id", "org_id"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"code": { "type": ["string", "null"] },
"project_type": {
"type": "string",
"enum": ["internal", "client", "rnd", "infrastructure", "overhead"]
},
"status": {
"type": "string",
"enum": ["planning", "active", "on_hold", "completed", "cancelled"]
},
"owner_id": { "$ref": "#/definitions/uuid" },
"org_id": { "$ref": "#/definitions/uuid" },
"budget": {
"oneOf": [{ "type": "number", "minimum": 0 }, { "type": "null" }]
},
"currency_code": {
"oneOf": [{ "$ref": "#/definitions/currency_code" }, { "type": "null" }]
},
"start_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_date" }, { "type": "null" }]
},
"end_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_date" }, { "type": "null" }]
},
"parent_project_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
}
}
}
]
},
"Task": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["title", "task_type", "status", "priority"],
"properties": {
"title": { "type": "string", "minLength": 1 },
"description": { "type": ["string", "null"] },
"task_type": {
"type": "string",
"enum": ["manual", "automated", "approval", "review", "notification"]
},
"status": {
"type": "string",
"enum": ["pending", "in_progress", "blocked", "completed", "cancelled"]
},
"priority": {
"type": "string",
"enum": ["low", "medium", "high", "critical"]
},
"assignee_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"project_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"parent_task_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"due_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_datetime" }, { "type": "null" }]
},
"completed_at": {
"oneOf": [{ "$ref": "#/definitions/iso8601_datetime" }, { "type": "null" }]
},
"workflow_instance_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
}
}
}
]
},
"Workflow": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["workflow_definition_id", "workflow_version", "status", "initiator_id"],
"properties": {
"workflow_definition_id": { "type": "string" },
"workflow_version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$" },
"status": {
"type": "string",
"enum": ["pending", "running", "waiting", "completed", "failed", "cancelled"]
},
"context": {
"type": "object",
"description": "Runtime context for the workflow instance",
"additionalProperties": true
},
"started_at": {
"oneOf": [{ "$ref": "#/definitions/iso8601_datetime" }, { "type": "null" }]
},
"completed_at": {
"oneOf": [{ "$ref": "#/definitions/iso8601_datetime" }, { "type": "null" }]
},
"initiator_id": { "$ref": "#/definitions/uuid" },
"current_step": { "type": ["string", "null"] }
}
}
]
},
"Document": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["title", "document_type", "classification"],
"properties": {
"title": { "type": "string", "minLength": 1 },
"document_type": {
"type": "string",
"enum": ["invoice", "receipt", "contract", "report", "attachment", "specification", "certificate"]
},
"mime_type": { "type": ["string", "null"] },
"storage_key": { "type": ["string", "null"], "description": "S3 or blob storage path" },
"checksum": { "type": ["string", "null"], "description": "SHA-256 of file content" },
"size_bytes": {
"oneOf": [{ "type": "integer", "minimum": 0 }, { "type": "null" }]
},
"source_system": { "type": ["string", "null"] },
"related_entity_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"related_entity_type": { "type": ["string", "null"] },
"classification": { "$ref": "#/definitions/data_classification" },
"extracted_data": {
"oneOf": [
{
"type": "object",
"description": "AI-extracted fields from document_extraction capability",
"additionalProperties": true
},
{ "type": "null" }
]
}
}
}
]
},
"Transaction": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["transaction_type", "amount", "currency_code", "status", "transaction_date"],
"properties": {
"transaction_type": {
"type": "string",
"enum": ["journal_entry", "payment", "invoice", "credit_note", "accrual", "depreciation", "transfer"]
},
"amount": {
"type": "number",
"description": "Absolute amount"
},
"currency_code": { "$ref": "#/definitions/currency_code" },
"base_currency_amount": {
"oneOf": [{ "type": "number" }, { "type": "null" }]
},
"exchange_rate": {
"oneOf": [{ "type": "number", "minimum": 0 }, { "type": "null" }]
},
"status": {
"type": "string",
"enum": ["draft", "posted", "voided", "pending_approval"]
},
"transaction_date": { "$ref": "#/definitions/iso8601_date" },
"value_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_date" }, { "type": "null" }]
},
"reference": { "type": ["string", "null"] },
"counterparty_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"project_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"document_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"lines": {
"type": "array",
"items": {
"type": "object",
"required": ["account_code", "debit", "credit"],
"properties": {
"line_id": { "$ref": "#/definitions/uuid" },
"account_code": { "type": "string" },
"debit": { "type": "number", "minimum": 0 },
"credit": { "type": "number", "minimum": 0 },
"description": { "type": ["string", "null"] },
"cost_center_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
}
}
}
}
}
}
]
},
"Event": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["event_type", "event_version", "source_service", "correlation_id", "subject_type", "subject_id", "payload", "published_at"],
"properties": {
"event_type": {
"type": "string",
"pattern": "^aamos\\.[a-z]+\\.[a-z_]+\\.[a-z_]+$",
"description": "Namespaced: aamos.<module>.<object>.<verb>"
},
"event_version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+$"
},
"source_service": { "type": "string" },
"correlation_id": { "$ref": "#/definitions/uuid" },
"causation_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"subject_type": { "type": "string" },
"subject_id": { "$ref": "#/definitions/uuid" },
"payload": {
"type": "object",
"additionalProperties": true
},
"published_at": { "$ref": "#/definitions/iso8601_datetime" }
}
}
]
},
"Contract": {
"allOf": [
{ "$ref": "#/definitions/EntityBase" },
{
"type": "object",
"required": ["title", "contract_type", "status", "owner_org_id"],
"properties": {
"title": { "type": "string", "minLength": 1 },
"contract_type": {
"type": "string",
"enum": ["supplier", "customer", "employment", "sla", "license", "framework", "nda"]
},
"status": {
"type": "string",
"enum": ["draft", "pending_signature", "active", "expired", "terminated", "renewed"]
},
"counterparty_org_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"counterparty_person_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"owner_org_id": { "$ref": "#/definitions/uuid" },
"start_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_date" }, { "type": "null" }]
},
"end_date": {
"oneOf": [{ "$ref": "#/definitions/iso8601_date" }, { "type": "null" }]
},
"auto_renewal": { "type": "boolean", "default": false },
"value": {
"oneOf": [{ "type": "number", "minimum": 0 }, { "type": "null" }]
},
"currency_code": {
"oneOf": [{ "$ref": "#/definitions/currency_code" }, { "type": "null" }]
},
"document_id": {
"oneOf": [{ "$ref": "#/definitions/uuid" }, { "type": "null" }]
},
"terms": {
"oneOf": [
{
"type": "object",
"additionalProperties": true,
"description": "Structured contract terms"
},
{ "type": "null" }
]
}
}
}
]
}
},
"type": "object",
"title": "DomainModelManifest",
"description": "Registry of all AAMOS canonical objects.",
"properties": {
"schema_version": {
"type": "string",
"const": "1.0.0"
},
"canonical_objects": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Entity",
"Organization",
"Person",
"Asset",
"Location",
"Project",
"Task",
"Workflow",
"Document",
"Transaction",
"Event",
"Contract"
]
}
}
},
"examples": [
{
"schema_version": "1.0.0",
"canonical_objects": [
"Entity", "Organization", "Person", "Asset", "Location",
"Project", "Task", "Workflow", "Document", "Transaction",
"Event", "Contract"
]
}
]
}