{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:agent-market-governance-snapshot-v1",
  "title": "AWOOOI Agent Market Governance Snapshot (v1)",
  "type": "object",
  "required": [
    "schema_version",
    "generated_at",
    "inputs",
    "policy",
    "evaluation_cadence",
    "market_watch_health",
    "current_decision",
    "summary",
    "candidate_groups",
    "candidate_statuses",
    "operator_decision_queue",
    "next_allowed_actions",
    "forbidden_actions_without_new_approval"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "agent_market_governance_snapshot_v1"
    },
    "generated_at": {
      "type": "string",
      "minLength": 1
    },
    "inputs": {
      "type": "object",
      "required": [
        "watch_report_generated_at",
        "integration_review_generated_at",
        "discovery_classification_generated_at",
        "promotion_review_generated_at",
        "candidate_registry_schema_version"
      ],
      "additionalProperties": true
    },
    "policy": {
      "type": "object",
      "required": [
        "snapshot_is_decision_source",
        "priority_upgrade_approved",
        "market_scorecard_update_approved",
        "replay_candidate_approved",
        "sdk_installation_approved",
        "paid_api_calls_approved",
        "production_changes_approved",
        "shadow_or_canary_approved",
        "replacement_decision_allowed"
      ],
      "properties": {
        "snapshot_is_decision_source": {"type": "boolean", "const": false},
        "priority_upgrade_approved": {"type": "boolean", "const": false},
        "market_scorecard_update_approved": {"type": "boolean", "const": false},
        "replay_candidate_approved": {"type": "boolean", "const": false},
        "sdk_installation_approved": {"type": "boolean", "const": false},
        "paid_api_calls_approved": {"type": "boolean", "const": false},
        "production_changes_approved": {"type": "boolean", "const": false},
        "shadow_or_canary_approved": {"type": "boolean", "const": false},
        "replacement_decision_allowed": {"type": "boolean", "const": false}
      },
      "additionalProperties": true
    },
    "evaluation_cadence": {
      "type": "object",
      "required": [
        "workflow",
        "schedule",
        "timezone",
        "next_scheduled_run_at",
        "trigger_modes",
        "primary_source_policy",
        "controlled_review_gate"
      ],
      "properties": {
        "workflow": {
          "type": "string",
          "minLength": 1
        },
        "schedule": {
          "type": "string",
          "minLength": 1
        },
        "timezone": {
          "type": "string",
          "const": "Asia/Taipei"
        },
        "next_scheduled_run_at": {
          "type": "string",
          "minLength": 1
        },
        "trigger_modes": {
          "type": "array",
          "minItems": 1,
          "items": {"type": "string", "minLength": 1}
        },
        "primary_source_policy": {
          "type": "string",
          "minLength": 1
        },
        "controlled_review_gate": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false
    },
    "market_watch_health": {
      "type": "object",
      "required": [
        "status",
        "freshness_sla_hours",
        "stale_grace_hours",
        "stale_after",
        "source_failures_require_controlled_reverify",
        "blocked_from_integration",
        "controlled_queue_reasons",
        "operator_blockers"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": ["healthy", "controlled_queue", "blocked"]
        },
        "freshness_sla_hours": {
          "type": "integer",
          "const": 168
        },
        "stale_grace_hours": {
          "type": "integer",
          "const": 6
        },
        "stale_after": {
          "type": "string",
          "minLength": 1
        },
        "source_failures_require_controlled_reverify": {
          "type": "boolean"
        },
        "source_failures_block_priority_upgrade": {
          "type": "boolean"
        },
        "blocked_from_integration": {
          "type": "integer",
          "minimum": 0
        },
        "controlled_queue_reasons": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        },
        "operator_blockers": {
          "type": "array",
          "items": {"type": "string", "minLength": 1}
        }
      },
      "additionalProperties": false
    },
    "current_decision": {
      "type": "string",
      "minLength": 1
    },
    "summary": {
      "type": "object",
      "required": [
        "candidate_count",
        "source_count",
        "source_failures",
        "changed_candidates",
        "integration_queue_count",
        "blocked_from_integration",
        "watch_only_candidates_reviewed",
        "eligible_for_market_scorecard_prescreen",
        "recommended_watch_additions_remaining",
        "priority_upgrades_approved",
        "market_scorecard_updates_approved",
        "replay_candidates_approved",
        "sdk_installations_approved",
        "paid_api_calls_approved",
        "production_changes_approved",
        "shadow_or_canary_approved",
        "replacement_decisions_approved"
      ],
      "properties": {
        "candidate_count": {"type": "integer", "minimum": 0},
        "source_count": {"type": "integer", "minimum": 0},
        "source_failures": {"type": "integer", "minimum": 0},
        "changed_candidates": {"type": "integer", "minimum": 0},
        "integration_queue_count": {"type": "integer", "minimum": 0},
        "blocked_from_integration": {"type": "integer", "minimum": 0},
        "watch_only_candidates_reviewed": {"type": "integer", "minimum": 0},
        "eligible_for_market_scorecard_prescreen": {"type": "integer", "minimum": 0},
        "recommended_watch_additions_remaining": {"type": "integer", "minimum": 0},
        "priority_upgrades_approved": {"type": "integer", "const": 0},
        "market_scorecard_updates_approved": {"type": "integer", "const": 0},
        "replay_candidates_approved": {"type": "integer", "const": 0},
        "sdk_installations_approved": {"type": "integer", "const": 0},
        "paid_api_calls_approved": {"type": "integer", "const": 0},
        "production_changes_approved": {"type": "integer", "const": 0},
        "shadow_or_canary_approved": {"type": "integer", "const": 0},
        "replacement_decisions_approved": {"type": "integer", "const": 0}
      },
      "additionalProperties": true
    },
    "candidate_groups": {
      "type": "object",
      "required": [
        "production_baseline",
        "replay_or_integration_blocked",
        "watch_only_candidates",
        "watch_only_scorecard_prescreen_ready"
      ],
      "properties": {
        "production_baseline": {"type": "array", "items": {"type": "string"}},
        "replay_or_integration_blocked": {"type": "array", "items": {"type": "string"}},
        "watch_only_candidates": {"type": "array", "items": {"type": "string"}},
        "watch_only_scorecard_prescreen_ready": {"type": "array", "items": {"type": "string"}}
      },
      "additionalProperties": true
    },
    "candidate_statuses": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "candidate_id",
          "display_name",
          "role",
          "evaluation_priority",
          "gate_status",
          "current_gate",
          "required_next_gate",
          "integration_decision",
          "score",
          "evidence",
          "approvals",
          "operator_blockers"
        ],
        "properties": {
          "candidate_id": {"type": "string", "minLength": 1},
          "display_name": {"type": "string", "minLength": 1},
          "role": {"type": "string"},
          "evaluation_priority": {"type": "string"},
          "gate_status": {
            "type": "string",
            "enum": [
              "production_baseline",
              "integration_blocked",
              "integration_reviewed",
              "watch_only_prescreen_ready",
              "watch_only_blocked",
              "watch_only_monitoring",
              "registered_no_review"
            ]
          },
          "current_gate": {"type": "string"},
          "required_next_gate": {"type": "string"},
          "integration_decision": {"type": "string"},
          "score": {"type": ["number", "null"]},
          "evidence": {
            "type": "object",
            "required": [
              "latest_replay_summary",
              "latest_smoke_gate",
              "latest_smoke_matrix",
              "latest_smoke_model"
            ],
            "properties": {
              "latest_replay_summary": {"type": ["string", "null"]},
              "latest_smoke_gate": {"type": ["string", "null"]},
              "latest_smoke_matrix": {"type": ["string", "null"]},
              "latest_smoke_model": {"type": ["string", "null"]}
            },
            "additionalProperties": false
          },
          "approvals": {
            "type": "object",
            "required": [
              "replay",
              "sdk_install",
              "paid_api",
              "shadow_or_canary",
              "production_routing"
            ],
            "properties": {
              "replay": {"type": "boolean", "const": false},
              "sdk_install": {"type": "boolean", "const": false},
              "paid_api": {"type": "boolean", "const": false},
              "shadow_or_canary": {"type": "boolean", "const": false},
              "production_routing": {"type": "boolean", "const": false}
            },
            "additionalProperties": false
          },
          "operator_blockers": {
            "type": "array",
            "items": {"type": "string"}
          }
        },
        "additionalProperties": false
      }
    },
    "operator_decision_queue": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "candidate_id",
          "display_name",
          "priority",
          "queue_status",
          "recommended_action",
          "approval_boundary",
          "risk_notes",
          "evidence_refs"
        ],
        "properties": {
          "candidate_id": {"type": "string", "minLength": 1},
          "display_name": {"type": "string", "minLength": 1},
          "priority": {"type": "integer", "minimum": 0},
          "queue_status": {
            "type": "string",
            "enum": [
              "baseline_protected",
              "blocked_needs_evidence",
              "controlled_review_required",
              "controlled_priority_review",
              "watch_only_blocked",
              "watch_only_monitoring",
              "registered_no_review"
            ]
          },
          "recommended_action": {"type": "string", "minLength": 1},
          "approval_boundary": {
            "type": "object",
            "required": [
              "replacement_adr_required",
              "priority_upgrade_required",
              "market_scorecard_update_required",
              "replay_approval_required",
              "sdk_install_approval_required",
              "paid_api_approval_required",
              "shadow_or_canary_approval_required",
              "production_routing_approval_required"
            ],
            "properties": {
              "replacement_adr_required": {"type": "boolean"},
              "priority_upgrade_required": {"type": "boolean"},
              "market_scorecard_update_required": {"type": "boolean"},
              "replay_approval_required": {"type": "boolean"},
              "sdk_install_approval_required": {"type": "boolean"},
              "paid_api_approval_required": {"type": "boolean"},
              "shadow_or_canary_approval_required": {"type": "boolean"},
              "production_routing_approval_required": {"type": "boolean"}
            },
            "additionalProperties": false
          },
          "risk_notes": {
            "type": "array",
            "items": {"type": "string"}
          },
          "evidence_refs": {
            "type": "array",
            "items": {"type": "string"}
          }
        },
        "additionalProperties": false
      }
    },
    "next_allowed_actions": {
      "type": "array",
      "items": {"type": "string"}
    },
    "forbidden_actions_without_new_approval": {
      "type": "array",
      "items": {"type": "string"}
    }
  },
  "additionalProperties": false
}
