# =============================================================================
# Semantic Annotations (Field → Concept Mappings)
# =============================================================================
#
# Maps physical fields in each data contract to concepts defined in
# ontologies.yaml (the Ontology / Concept Registry).
#
# This file answers: "What does column X in contract Y *mean*?"
# The concept registry (ontologies.yaml) answers: "What *is* concept Z?"
#
# Structure (per contract):
#   contract_name    – Links to the contract in contracts.yaml.
#   contract_version – Contract version this annotation applies to.
#   version          – Annotation version (for independent evolution).
#   fields           – Map of field name → annotation.
#
# Per-field annotation keys:
#   concept       – Concept id from ontologies.yaml (required).
#   tags          – Additional field-level tags (optional, supplements concept tags).
#   lineage       – { derived_from?, source_system? } (optional).
#   relationships – List of { target, type } to fields in other contracts (optional).
#
# Relationship types: references | derived_from | same_as | related_to
#
# =============================================================================

# -----------------------------------------------------------------------------
# Order domain (intraday / rebalance orders)
# -----------------------------------------------------------------------------
- contract_name: order_domain
  contract_version: "1.0.0"
  version: "1.0.0"
  fields:
    order_id:
      concept: OrderIdentifier
      tags: [identifier, primary_key]
    symbol:
      concept: InstrumentSymbol
    side:
      concept: OrderSide
    quantity:
      concept: OrderQuantity
    status:
      concept: OrderLifecycleState
    filled_qty:
      concept: FilledQuantity
    created_at:
      concept: CreationTimestamp

# -----------------------------------------------------------------------------
# Intraday signal domain
# -----------------------------------------------------------------------------
- contract_name: intraday_signal_domain
  contract_version: "1.0.0"
  version: "1.0.0"
  fields:
    signal_id:
      concept: SignalIdentifier
      tags: [identifier, primary_key]
    symbol:
      concept: InstrumentSymbol
    direction:
      concept: SignalDirection
    strength:
      concept: SignalStrength
    status:
      concept: SignalLifecycleState
    created_at:
      concept: CreationTimestamp

# -----------------------------------------------------------------------------
# Intraday session domain
# -----------------------------------------------------------------------------
- contract_name: intraday_session_domain
  contract_version: "1.0.0"
  version: "1.0.0"
  fields:
    session_id:
      concept: SessionIdentifier
      tags: [identifier, primary_key]
    account_id:
      concept: AccountIdentifier
    status:
      concept: SessionLifecycleState
    started_at:
      concept: SessionStart
    ended_at:
      concept: SessionEnd

# -----------------------------------------------------------------------------
# Portfolio domain (weekly optimization)
# -----------------------------------------------------------------------------
- contract_name: portfolio_domain
  contract_version: "1.0.0"
  version: "1.0.0"
  fields:
    portfolio_id:
      concept: PortfolioIdentifier
      tags: [identifier, primary_key]
    status:
      concept: PortfolioLifecycleState
    last_rebalance_at:
      concept: LastRebalanceTime
    created_at:
      concept: CreationTimestamp

# -----------------------------------------------------------------------------
# Optimization cycle domain (weekly optimization)
# -----------------------------------------------------------------------------
- contract_name: optimization_cycle_domain
  contract_version: "1.0.0"
  version: "1.0.0"
  fields:
    run_id:
      concept: RunIdentifier
      tags: [identifier, primary_key]
    portfolio_id:
      concept: PortfolioIdentifier
      relationships:
        - target: portfolio_domain.portfolio_id
          type: references
    status:
      concept: CycleLifecycleState
    started_at:
      concept: CycleStart
    completed_at:
      concept: CycleEnd
