# 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: Capability Resolution and Admission
type: object
required:
  - document_type
  - format_version
  - specification_version
  - id
  - artifact_status
  - normative
  - schema_ref
  - generated_from
  - cee_ref
  - cee_configuration_ref
  - intent_ref
  - registry_snapshot_ref
  - matcher
  - confidence
  - candidate_generation
  - relation_expansion
  - filtering
  - constraint_validation
  - conflict_resolution
  - admission
  - trace
properties:
  document_type: {const: capability-resolution}
  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: "^RES-[A-Z0-9-]+$"}
  artifact_status: {const: reference}
  normative: {const: false}
  schema_ref: {type: string}
  generated_from: {type: object, minProperties: 2}
  cee_ref: {type: string, pattern: "^CEE-[A-Z0-9-]+$"}
  cee_configuration_ref: {type: string, pattern: "^CEE-CONFIG-[A-Z0-9-]+$"}
  intent_ref: {type: string, pattern: "^INT-[A-Z0-9-]+$"}
  registry_snapshot_ref: {type: string, pattern: "^REG-SNAP-[A-Z0-9-]+$"}
  matcher:
    type: object
    required: [id, version, method]
    properties:
      id: {type: string, pattern: "^MATCHER-[A-Z0-9-]+$"}
      version: {type: [integer, string]}
      method: {type: string, minLength: 1}
    additionalProperties: true
  confidence:
    type: object
    required: [mode, calibration]
    properties:
      mode: {enum: [qualitative, quantitative]}
      calibration: {type: string, minLength: 1}
      interpretation: {type: string, minLength: 1}
    additionalProperties: true
  candidate_generation: {type: object}
  relation_expansion: {type: object}
  filtering: {type: object}
  constraint_validation:
    type: array
    minItems: 1
  conflict_resolution: {type: object}
  admission:
    type: object
    required: [id, status, admitted_capabilities]
    properties:
      id: {type: string, pattern: "^ADM-[A-Z0-9-]+$"}
      status: {enum: [admitted, rejected, escalated]}
      admitted_capabilities:
        type: array
        items:
          type: object
          required: [capability, ckc, version]
          additionalProperties: true
    allOf:
      - if:
          properties:
            status: {const: admitted}
          required: [status]
        then:
          properties:
            admitted_capabilities: {minItems: 1}
    additionalProperties: true
  trace: {type: object}
additionalProperties: true
