[{"name":"Identifiable","desc":"Root base schema. Provides a UUID primary key. All persisted entities extend this, either directly or via BaseDocument / OperationalDocument / OperationalSubDocument / TransactionalDocument / LedgerEntry.","provides":["id"],"properties":[{"n":"id","r":true,"t":"string","info":"UUID v4 primary key."}],"extendedBy":["Attribute Set","Brand","Classification","Franchise Group","Sales Channel","Vendor Dictionary","Advanced Shipping Notice","Advanced Shipping Notice Item","Bill","Bill Item","Delivery Notification","Purchase Order Acknowledgement Line","Ship Notification","Vendor Credit","Vendor Credit Item","Vendor Invoice"]},{"name":"BaseDocument","desc":"Standard document base for non-operational entities (e.g. reports, configurations). Adds audit trail, soft-delete, custom data, and tagging.","provides":["id","recentActions","createdBy","createdDate","customData","franchiseGroups","isDeleted","modifiedBy","modifiedDate","tags","uniqueValues"],"properties":[{"n":"company","r":true,"t":"entityDetail","re":"Company","info":"The Company tenant this document belongs to. Defines the hard isolation boundary for queries, permissions, replication, and export. Paired with franchiseGroups which provides sub-tenant segmentation within this Company."},{"n":"createdBy","t":"string","info":"User ID who created the document."},{"n":"createdDate","r":true,"t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"customData","r":true,"t":"array","info":"Custom fields with label, fieldType, value, and sequence. Supports text, decimal, integer, date, flag, multiselect, lookup, and longtext."},{"n":"franchiseGroups","r":true,"t":"array","info":"EntityDetail references (code, name, alias, sequence) linking the document to franchise groups."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the document."},{"n":"modifiedDate","r":true,"t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"recentActions","r":true,"t":"array","info":"Denormalized snapshot of the most recent actions performed on this document (capped at the last 5 entries). The Entity Action Log is the system of record for the full audit trail. Each entry follows the Action inline schema: actionDate, actionedBy, code, label, actionType (FieldChange | Operation), and optional change detail."},{"n":"tags","r":true,"t":"array","info":"Free-form string tags for categorization."},{"n":"uniqueValues","r":true,"t":"array","info":"Alternative identifiers — array of Identifier (isPrimary, label, name, value)."}],"ext":"Identifiable","inlineSchemas":[{"name":"Action","schema":"schemas/common/Action.ts","properties":[{"info":"ISO 8601 timestamp when the action occurred.","name":"actionDate","type":"datetime","required":true},{"info":"User ID who performed the action.","name":"actionedBy","type":"string","required":true},{"info":"Discriminator: FieldChange for property-level mutations, Operation for domain events (e.g. status transition, approval).","name":"actionType","type":"enumeration","values":["FieldChange","Operation"],"required":true},{"info":"Field-level changes that occurred. Each entry is an ActionChange (fieldName, previousValue, newValue). Empty for Operation actions with no field-level side effects.","name":"changes","type":"array","required":true},{"info":"Stable, machine-readable action identifier (e.g. 'status.transition', 'price.update', 'approve', 'line.add'). Provides an enumerable key for reports, dashboards, and automation triggers. While actionType captures the category, code captures the semantic intent of the action.","name":"code","type":"string","required":true},{"info":"Human-readable summary of what happened (e.g. 'Status changed from Draft to Active').","name":"description","type":"string","required":true}]}]},{"name":"OperationalDocument","desc":"Extended document base for operational entities (Location, Vendor, Employee, etc.) and order-lifecycle entities (Sales Order, Purchase Order, etc.). Adds integration identifiers and an idempotency key on top of BaseDocument fields. Transactional entities extend this indirectly via TransactionalDocument.","provides":["id","recentActions","createdBy","createdDate","customData","franchiseGroups","identifiers","idmpKey","isDeleted","modifiedBy","modifiedDate","notes","tags","uniqueValues"],"properties":[{"n":"company","r":true,"t":"entityDetail","re":"Company","info":"The Company tenant this document belongs to. Defines the hard isolation boundary for queries, permissions, replication, and export. Paired with franchiseGroups which provides sub-tenant segmentation within this Company."},{"n":"createdBy","t":"string","info":"User ID who created the document."},{"n":"createdDate","r":true,"t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"customData","r":true,"t":"array","info":"Custom fields with label, fieldType, value, and sequence. Supports text, decimal, integer, date, flag, multiselect, lookup, and longtext."},{"n":"franchiseGroups","r":true,"t":"array","info":"EntityDetail references (code, name, alias, sequence) linking the document to franchise groups."},{"n":"identifiers","r":true,"t":"array","info":"OperationalIdentifier array — extends Identifier with originatingSystemName for cross-system integration."},{"n":"idmpKey","r":true,"t":"string","info":"Idempotency / integration key for data-management deduplication."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the document."},{"n":"modifiedDate","r":true,"t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"notes","t":"string","info":"Free-text notes on this document."},{"n":"recentActions","r":true,"t":"array","info":"Denormalized snapshot of the most recent actions performed on this document (capped at the last 5 entries). The Entity Action Log is the system of record for the full audit trail. Each entry follows the Action inline schema defined on BaseDocument."},{"n":"tags","r":true,"t":"array","info":"Free-form string tags for categorization."},{"n":"uniqueValues","r":true,"t":"array","info":"Alternative identifiers — array of Identifier (isPrimary, label, name, value)."}],"ext":"Identifiable","extendedBy":["Product","Location","Employee","Vendor","Style","Sales Order","Purchase Order","Transfer Order","Shipment","Fulfillment Order","Ship Order","Catalog","Stock Take","Advanced Shipping Notice","Vendor Invoice","Vendor Credit","Customer","TransactionalDocument"]},{"name":"OperationalSubDocument","desc":"Lightweight operational base for line-items and child documents. Similar to OperationalDocument but without idmpKey or franchiseGroups. Used for entities that live within a parent document context.","provides":["id","recentActions","createdBy","createdDate","customData","identifiers","isDeleted","modifiedBy","modifiedDate","notes","tags","uniqueValues"],"properties":[{"n":"recentActions","r":true,"t":"array","info":"Denormalized snapshot of the most recent actions performed on this sub-document (capped at the last 5 entries). The Entity Action Log is the system of record for the full audit trail. Each entry follows the Action inline schema defined on BaseDocument."},{"n":"createdBy","t":"string","info":"User ID who created the sub-document."},{"n":"createdDate","r":true,"t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"customData","r":true,"t":"array","info":"Custom fields with label, fieldType, value, and sequence."},{"n":"identifiers","r":true,"t":"array","info":"OperationalIdentifier array — extends Identifier with originatingSystemName."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the sub-document."},{"n":"modifiedDate","r":true,"t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"notes","t":"string","info":"Free-text notes on this sub-document."},{"n":"tags","r":true,"t":"array","info":"Free-form string tags for categorization."},{"n":"uniqueValues","r":true,"t":"array","info":"Alternative identifiers — array of Identifier (isPrimary, label, name, value)."}],"ext":"Identifiable","extendedBy":["Item","Advanced Shipping Notice Carton","Shipment Carton","Stock Transfer Carton"],"usedAsLinesBy":["Stock Adjustment","Stock Take","Stock Transfer","Transfer Order","Purchase Order","Goods Receipt","Vendor Invoice","Bill","Sales Order","Fulfillment Order","Ship Order","Fulfillment","Shipment","Sale","Advanced Shipping Notice Carton","Shipment Carton","Stock Transfer Carton","Purchase Order Acknowledgement"]},{"name":"TransactionalSubDocument","desc":"Lightweight transactional base for line-items and child documents within transactional entities. Extends OperationalSubDocument with transactionDate, fiscalDate, postedDate, and isVoided semantics. Used for sub-documents that participate in transactional workflows and may write to ledgers upon posting.","provides":["id","recentActions","createdBy","createdDate","customData","fiscalDate","identifiers","isDeleted","isVoided","modifiedBy","modifiedDate","notes","postedDate","tags","transactionDate","uniqueValues"],"properties":[{"n":"transactionDate","r":true,"t":"datetime","info":"The business date/time when the line-level transaction occurred. Typically inherited from the parent document but can be overridden for split-date scenarios."},{"n":"fiscalDate","r":true,"t":"datetime","info":"The fiscal calendar date assigned to this line. Used for period-based reporting. Typically inherited from the parent document."},{"n":"postedDate","t":"datetime","info":"Timestamp when this line was finalized and committed to its target ledger(s). Null while in a pre-posted state."},{"n":"isVoided","r":true,"t":"boolean","info":"Whether this line has been voided or reversed. Defaults to false. Voided lines remain for audit but are excluded from active reporting."}],"ext":"OperationalSubDocument","extendedBy":[]},{"name":"LookupEntity","desc":"Abstract base schema for all reference-data / dictionary entities. Provides the standard shape: code, name, alias, franchise-group scoping, active/default/deleted/readOnly flags, audit fields, and custom-data support. Not instantiated directly.","provides":["id","code","name","alias","franchiseGroups","idmpKey","isActive","isDefault","isDeleted","isReadOnly","sequence","createdBy","createdDate","modifiedBy","modifiedDate","customData"],"properties":[{"n":"alias","t":"schema","info":"Optional label/value pair for alternate display text (LookupEntityAlias)."},{"n":"code","r":true,"t":"string","info":"Human-readable key. Unique within scope."},{"n":"company","t":"entityDetail","re":"Company","info":"The Company tenant this lookup value belongs to. OPTIONAL on this base schema because a small set of dictionaries are platform-global (Currency, Locale, Country, Environment) and must have company null. All other Dictionary entities must declare company: required per the tenant-scoped-dictionary-declares-company convention."},{"n":"createdBy","t":"string","info":"User ID who created the record."},{"n":"createdDate","t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"customData","r":true,"t":"array","info":"Extensible key/value pairs for tenant-specific metadata (DocumentCustomData)."},{"n":"franchiseGroups","r":true,"t":"array","info":"EntityDetail references scoping this lookup value to one or more franchise groups."},{"n":"idmpKey","r":true,"t":"string","info":"Idempotency / integration key for data-management deduplication."},{"n":"isActive","r":true,"t":"boolean","info":"Whether this lookup value is active. Defaults to true."},{"n":"isDefault","r":true,"t":"boolean","info":"Whether this is the default selection. Defaults to false."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag. Defaults to false."},{"n":"isReadOnly","r":true,"t":"boolean","info":"Whether this lookup value is system-managed and not editable. Defaults to false."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the record."},{"n":"modifiedDate","t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"name","r":true,"t":"string","info":"Display name."},{"n":"sequence","t":"integer","info":"Display ordering hint."}],"ext":"Identifiable","extendedBy":["Currency","Locale","Tax Class","Price Level","Cost Level","Item Stock Group","Stock Limit Group","Purchasing Fee","Shipping Method","Loyalty Program"]},{"name":"LookupEntityValue","desc":"Base schema for inline value schemas within LookupEntity entities. Analogous to OperationalSubDocument for OperationalDocument — provides a lightweight identity and audit shape for nested value objects that exist only within the context of their parent LookupEntity. Carries its own id, identifiers, code, name, aliases, and audit trail.","provides":["id","identifiers","code","name","aliases","isActive","isDeleted","isDefault","sequence","createdBy","createdDate","modifiedBy","modifiedDate","customData"],"properties":[{"n":"identifiers","r":true,"t":"array","info":"OperationalIdentifier array — extends Identifier with originatingSystemName for cross-system integration."},{"n":"code","r":true,"t":"string","info":"Human-readable key. Unique within the parent entity's value collection."},{"n":"name","r":true,"t":"string","info":"Display name of the value."},{"n":"aliases","t":"array","info":"Alternative display names or label/value pairs for this value."},{"n":"isActive","r":true,"t":"boolean","info":"Whether this value is active. Defaults to true."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag. Defaults to false."},{"n":"isDefault","r":true,"t":"boolean","info":"Whether this is the default selection within the parent entity's value collection. Defaults to false."},{"n":"sequence","t":"integer","info":"Display ordering hint within the parent entity's value collection."},{"n":"createdBy","t":"string","info":"User ID who created the value."},{"n":"createdDate","t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the value."},{"n":"modifiedDate","t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"customData","r":true,"t":"array","info":"Extensible key/value pairs for tenant-specific metadata (DocumentCustomData)."}],"ext":"Identifiable"},{"name":"TransactionalDocument","desc":"Base schema for Transactional-class entities that record business events (sales, adjustments, receipts, transfers). Extends OperationalDocument with a standardized transaction date, posted date, and void/reversal semantics. Every TransactionalDocument writes to at least one Ledger upon posting.","provides":["id","recentActions","createdBy","createdDate","customData","fiscalDate","franchiseGroups","identifiers","idmpKey","isDeleted","isVoided","modifiedBy","modifiedDate","notes","postedDate","tags","transactionDate","uniqueValues"],"properties":[{"n":"transactionDate","r":true,"t":"datetime","info":"The business date/time when the transaction occurred. Distinct from createdDate (when the record was persisted) and postedDate (when it was finalized to ledgers). Maps to entity-specific names like Sale.date, StockAdjustment.adjustmentDate, Bill.billDate, GoodsReceipt.receivedDate, PriceAdjustment.effectiveDate, etc."},{"n":"fiscalDate","r":true,"t":"datetime","info":"The fiscal calendar date assigned to this transaction. Used for period-based reporting and accounting period assignment. May differ from transactionDate when transactions are recorded near period boundaries or when fiscal calendars do not align with calendar dates."},{"n":"postedDate","t":"datetime","info":"Timestamp when the transaction was finalized and committed to its target ledger(s). Null while the transaction is in a pre-posted state (e.g. Draft, Processing). Once set, the transaction is considered immutable for accounting purposes."},{"n":"isVoided","r":true,"t":"boolean","info":"Whether this transaction has been voided or reversed. Defaults to false. Voided transactions remain in the system for audit purposes but are excluded from active reporting. The void action writes a corresponding reversal entry to the relevant ledger(s)."}],"ext":"OperationalDocument","extendedBy":["Sale","Stock Adjustment","Stock Transfer","Goods Receipt","Purchase","Bill","Fulfillment","Price Adjustment","Cost Adjustment"]},{"name":"LedgerEntry","desc":"Base schema for Ledger-class entities — immutable, append-only audit records. Extends Identifiable directly (not OperationalDocument) because ledger entries must not be modified or deleted. Provides source-entity traceability and creation audit fields only. Individual ledger entities add domain-specific properties (e.g. ledgerLine, qty, amounts) on top.","provides":["id","entryDate","sourceEntityType","sourceEntityId","createdBy","createdDate"],"properties":[{"n":"company","r":true,"t":"entityDetail","re":"Company","info":"The Company tenant this ledger entry belongs to. Required at write time — ledger entries are immutable, so there is no opportunity to backfill company later. Also serves as the tenant partition key for ledger storage and per-tenant retention policies."},{"n":"createdBy","t":"string","info":"User ID or system principal that wrote this ledger entry."},{"n":"createdDate","r":true,"t":"datetime","info":"ISO 8601 system timestamp when the entry was persisted. Always system-generated, never back-dated (unlike entryDate which may reflect the business event date)."},{"n":"entryDate","r":true,"t":"datetime","info":"Chronological timestamp of the ledger entry — the business date/time the recorded event occurred. May differ from createdDate when entries are back-dated or batch-processed."},{"n":"sourceEntityId","r":true,"t":"string","info":"UUID of the specific entity instance that triggered this ledger entry. Together with sourceEntityType, provides a complete back-reference to the originating transaction or event."},{"n":"sourceEntityType","r":true,"t":"string","info":"Entity class name that triggered this ledger entry (e.g. 'Sale', 'Stock Adjustment', 'Price Adjustment'). Used as a partition/index key alongside sourceEntityId for traceability queries."}],"ext":"Identifiable","extendedBy":["Stock Ledger","Price Ledger","Cost Ledger","Email Log","Entity Action Log"]},{"name":"TaxonomyEntity","desc":"Base schema for hierarchical classification entities that form tree structures (categories, departments, classes). Extends Identifiable with parent/child relationships, depth tracking, and path materialization for efficient tree traversal. Not instantiated directly — concrete taxonomy entities (ProductCategory, etc.) extend this.","provides":["id","ancestorIds","code","name","fullName","parent","children","depth","path","isLeaf","isRoot","sequence","isActive","isDeleted","createdBy","createdDate","modifiedBy","modifiedDate"],"properties":[{"n":"ancestorIds","r":true,"t":"array","info":"Ordered array of ancestor node IDs from root to immediate parent. Enables fast breadcrumb rendering and subtree queries without recursive lookups. Empty array for root nodes."},{"n":"children","t":"array","info":"Child nodes in the taxonomy tree."},{"n":"code","r":true,"t":"string","info":"Human-readable identifier. Unique within the taxonomy."},{"n":"company","r":true,"t":"entityDetail","re":"Company","info":"The Company tenant this taxonomy tree belongs to. Product categories and types are always tenant-specific."},{"n":"createdBy","t":"string","info":"User ID who created the node."},{"n":"createdDate","r":true,"t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"depth","r":true,"t":"integer","info":"Zero-based depth in the tree. Root nodes have depth 0."},{"n":"fullName","t":"string","info":"Calculated field. The fully qualified name built from the materialized path, concatenating ancestor names from root to this node (e.g. 'Apparel > Men > Outerwear')."},{"n":"isActive","r":true,"t":"boolean","info":"Whether this taxonomy node is active. Defaults to true."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag. Defaults to false."},{"n":"isLeaf","r":true,"t":"boolean","info":"Whether this node has no children. Computed from children array. Leaf nodes are selectable for entity assignment; branch nodes are for navigation only."},{"n":"isRoot","r":true,"t":"boolean","info":"Whether this is a top-level node with no parent. Computed from depth (depth === 0)."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the node."},{"n":"modifiedDate","r":true,"t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"name","r":true,"t":"string","info":"Display name of the taxonomy node."},{"n":"parent","t":"entityRef","info":"Self-referencing parent node. Null for root nodes."},{"n":"path","r":true,"t":"string","info":"Materialized path for efficient ancestor/descendant queries (e.g. '/root/parent/this'). Enables tree traversal without recursive queries."},{"n":"sequence","t":"integer","info":"Display ordering hint among siblings at the same depth."}],"ext":"Identifiable","extendedBy":["Product Category","Product Type"]},{"name":"TaxonomyEntityNode","desc":"Base schema for individual nodes within a taxonomy hierarchy (e.g. Classification Department, Classification Class, Classification Subclass). Extends Identifiable with the common properties shared by all taxonomy node entities — code, name, sequence, and audit fields. Simpler than TaxonomyEntity which represents the full tree structure; TaxonomyEntityNode represents a single level/node within that tree.","provides":["id","code","name","sequence","isActive","isDeleted","createdBy","createdDate","modifiedBy","modifiedDate"],"properties":[{"n":"code","r":true,"t":"string","info":"Human-readable identifier. Unique within the node type."},{"n":"company","r":true,"t":"entityDetail","re":"Company","info":"The Company tenant this taxonomy node belongs to. Classification Department/Class/Subclass are always tenant-specific."},{"n":"createdBy","t":"string","info":"User ID who created the node."},{"n":"createdDate","r":true,"t":"datetime","info":"ISO 8601 creation timestamp."},{"n":"isActive","r":true,"t":"boolean","info":"Whether this node is active. Defaults to true."},{"n":"isDeleted","r":true,"t":"boolean","info":"Soft-delete flag. Defaults to false."},{"n":"modifiedBy","t":"string","info":"User ID who last modified the node."},{"n":"modifiedDate","r":true,"t":"datetime","info":"ISO 8601 last-modification timestamp."},{"n":"name","r":true,"t":"string","info":"Display name of the taxonomy node."},{"n":"sequence","t":"integer","info":"Display ordering hint among sibling nodes."}],"ext":"Identifiable","extendedBy":["Classification Department","Classification Class","Classification Subclass"]}]