# Institutional Capability Lineage Architecture (ICLA)
# Reference Specification
#
# Copyright (c) 2026 Mariano Garralda-Barrio
#
# Licensed under the Creative Commons Attribution 4.0
# International License (CC BY 4.0).
#
# See LICENSE in the repository root.

$schema: https://json-schema.org/draft/2020-12/schema
title: CEE-side Materialization
type: object
required:
  - document_type
  - format_version
  - specification_version
  - id
  - artifact_status
  - normative
  - schema_ref
  - status
  - generated_from
  - assembly_ref
  - cee_ref
  - substrate
  - transformation
  - representation
  - content_hash
  - created_at
  - expires_at
  - access
  - evaluation_binding
  - evidence_binding
  - preserves_assembly_semantics
  - preserves_assembly_authority
properties:
  document_type: {const: cee-side-materialization}
  format_version: {const: icla-artifact/0.1-draft}
  specification_version:
    type: object
    required: [icla-spec]
    properties:
      icla-spec: {const: 0.1.0}
    additionalProperties: false
  id: {type: string, pattern: "^MAT-[A-Z0-9-]+$"}
  artifact_status: {const: reference}
  normative: {const: false}
  schema_ref: {type: string}
  status: {const: immutable}
  generated_from:
    type: object
    required: [assembly, cee, transformation]
    properties:
      assembly: {type: string, pattern: "^ASM-[A-Z0-9-]+$"}
      cee: {type: string, pattern: "^CEE-[A-Z0-9-]+$"}
      transformation: {$ref: "#/$defs/versioned_component"}
    additionalProperties: false
  assembly_ref: {type: string, pattern: "^ASM-[A-Z0-9-]+$"}
  cee_ref: {type: string, pattern: "^CEE-[A-Z0-9-]+$"}
  substrate: {$ref: "#/$defs/versioned_component"}
  transformation: {$ref: "#/$defs/versioned_component"}
  representation:
    type: object
    required: [kind, control, payload_retention]
    properties:
      kind: {enum: [bundle, workspace, message, procedure, payload, access-handles]}
      control: {const: cee-controlled}
      payload_retention: {const: policy-dependent}
      local_reference: {type: string, minLength: 1}
    additionalProperties: false
  content_hash: {type: string, pattern: "^[a-f0-9]{64}$"}
  created_at: {type: string, format: date-time}
  expires_at: {type: [string, "null"], format: date-time}
  access:
    type: object
    required: [mode, policy_ref]
    properties:
      mode: {enum: [local-reference, governed-access-handles]}
      policy_ref: {type: string, minLength: 1}
      handles:
        type: array
        minItems: 1
        items:
          type: object
          required: [id, uri, authority]
          additionalProperties: true
    additionalProperties: false
  evaluation_binding: {$ref: "#/$defs/versioned_component"}
  evidence_binding: {$ref: "#/$defs/versioned_component"}
  preserves_assembly_semantics: {const: true}
  preserves_assembly_authority: {const: true}
$defs:
  versioned_component:
    type: object
    required: [id, version]
    properties:
      id: {type: string, minLength: 1}
      version: {type: [integer, string]}
    additionalProperties: false
additionalProperties: false
