{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://awoooi.local/schemas/ai_agent_result_capture_write_gate_review_v1.schema.json",
  "title": "AI Agent Result Capture Write Gate Review",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "schema_version",
    "generated_at",
    "program_status",
    "prior_owner_approved_promotion_dry_run",
    "write_gate_truth",
    "write_gate_reviews",
    "approval_gates",
    "post_write_verifier_plan",
    "blocked_live_writes",
    "operator_actions",
    "display_redaction_contract",
    "rollups"
  ],
  "properties": {
    "schema_version": {
      "const": "ai_agent_result_capture_write_gate_review_v1"
    },
    "program_status": {
      "type": "object",
      "required": [
        "overall_completion_percent",
        "current_priority",
        "current_task_id",
        "next_task_id",
        "read_only_mode",
        "runtime_authority",
        "status_note"
      ],
      "properties": {
        "overall_completion_percent": {
          "const": 100
        },
        "current_priority": {
          "const": "P2"
        },
        "current_task_id": {
          "const": "P2-121"
        },
        "next_task_id": {
          "const": "P2-122"
        },
        "read_only_mode": {
          "const": true
        },
        "runtime_authority": {
          "const": "result_capture_write_gate_review_only_no_live_write"
        }
      }
    },
    "write_gate_truth": {
      "type": "object",
      "required": [
        "dual_approval_required",
        "dry_run_hash_required",
        "post_write_verifier_required",
        "result_capture_write_enabled",
        "learning_write_enabled",
        "playbook_trust_write_enabled",
        "gateway_queue_write_enabled"
      ],
      "properties": {
        "dual_approval_required": {
          "const": true
        },
        "dry_run_hash_required": {
          "const": true
        },
        "post_write_verifier_required": {
          "const": true
        },
        "result_capture_write_enabled": {
          "const": false
        },
        "learning_write_enabled": {
          "const": false
        },
        "playbook_trust_write_enabled": {
          "const": false
        },
        "gateway_queue_write_enabled": {
          "const": false
        },
        "telegram_send_enabled": {
          "const": false
        },
        "production_write_enabled": {
          "const": false
        }
      }
    },
    "write_gate_reviews": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5
    },
    "approval_gates": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5
    },
    "post_write_verifier_plan": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5
    },
    "blocked_live_writes": {
      "type": "array",
      "minItems": 6,
      "maxItems": 6
    },
    "operator_actions": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5
    },
    "display_redaction_contract": {
      "type": "object",
      "properties": {
        "redaction_required": {
          "const": true
        },
        "secret_value_display_allowed": {
          "const": false
        },
        "internal_collaboration_content_display_allowed": {
          "const": false
        }
      }
    },
    "rollups": {
      "type": "object",
      "required": [
        "write_gate_review_count",
        "approval_gate_count",
        "post_write_verifier_plan_count",
        "blocked_live_write_count",
        "operator_action_count",
        "result_capture_write_count",
        "learning_write_count",
        "playbook_trust_write_count",
        "gateway_queue_write_count",
        "telegram_send_count"
      ],
      "properties": {
        "write_gate_review_count": {
          "const": 5
        },
        "approval_gate_count": {
          "const": 5
        },
        "post_write_verifier_plan_count": {
          "const": 5
        },
        "blocked_live_write_count": {
          "const": 6
        },
        "operator_action_count": {
          "const": 5
        },
        "result_capture_write_count": {
          "const": 0
        },
        "learning_write_count": {
          "const": 0
        },
        "playbook_trust_write_count": {
          "const": 0
        },
        "gateway_queue_write_count": {
          "const": 0
        },
        "telegram_send_count": {
          "const": 0
        },
        "production_write_count": {
          "const": 0
        }
      }
    }
  }
}
