{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://polytraders.dev/schemas/OrderIntent.json",
  "title": "OrderIntent",
  "description": "The artefact Strategy emits and Risk evaluates. Risk has no input until a Strategy has produced an OrderIntent. Risk MAY reshape (emits STRAT_RESHAPED_BY_RISK) or block; both paths are audited.",
  "type": "object",
  "required": [
    "intent_id",
    "strategy_id",
    "portfolio_id",
    "condition_id",
    "side",
    "order_type",
    "size_pusd",
    "ts"
  ],
  "properties": {
    "intent_id":     { "type": "string", "pattern": "^oi_[0-9a-zA-Z]{12,}$" },
    "strategy_id":   { "$ref": "_common.json#/$defs/StrategyId" },
    "portfolio_id":  { "$ref": "_common.json#/$defs/PortfolioId" },
    "condition_id":  { "$ref": "_common.json#/$defs/ConditionId" },
    "side":          { "$ref": "_common.json#/$defs/Side" },
    "order_type":    { "$ref": "_common.json#/$defs/OrderType" },
    "limit_price":   { "$ref": "_common.json#/$defs/Decimal" },
    "size_pusd":     { "$ref": "_common.json#/$defs/Decimal" },
    "max_slippage_bps": { "type": "integer", "minimum": 0, "maximum": 1000 },
    "ts":            { "$ref": "_common.json#/$defs/ISO8601" },
    "signal_ref":    { "type": "string", "pattern": "^sig_[0-9a-zA-Z]{12,}$" }
  },
  "additionalProperties": false
}
