{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:awoooi:vibework-iwooos-onboarding-handoff-v1",
  "title": "VibeWork IwoooS Onboarding Handoff v1",
  "description": "定義 VibeWork 納入 IwoooS 只讀視野時的 repo、product、surface、owner、evidence refs、資料分級、部署邊界與獨立產品邊界。此契約不授權 repo / refs / workflow 變更、secret 收集、production deploy、掃描、修復或 runtime execution。",
  "type": "object",
  "required": [
    "schema_version",
    "status",
    "date",
    "mode",
    "source_evidence_refs",
    "summary",
    "product_identity",
    "repo_scope",
    "product_surfaces",
    "owner_response_handoff",
    "independent_product_boundary",
    "data_classification_intake",
    "deployment_boundary",
    "acceptance_rules",
    "forbidden_actions"
  ],
  "properties": {
    "schema_version": {"const": "vibework_iwooos_onboarding_handoff_v1"},
    "status": {"type": "string", "enum": ["draft_waiting_owner_review"]},
    "date": {"type": "string"},
    "mode": {"type": "string", "enum": ["product_scope_handoff_only"]},
    "source_evidence_refs": {
      "type": "array",
      "items": {"type": "string"},
      "minItems": 1
    },
    "summary": {
      "type": "object",
      "required": [
        "product_name",
        "onboarding_handoff_package_ready",
        "onboarding_handoff_completion_percent",
        "product_boundary_merged_into_awoooi",
        "owner_response_received",
        "owner_response_accepted",
        "repo_refs_truth_accepted",
        "data_classification_accepted",
        "deployment_boundary_accepted",
        "runtime_gate_open",
        "runtime_execution_authorized",
        "production_deploy_authorized",
        "repo_creation_authorized",
        "refs_sync_authorized",
        "workflow_modification_authorized",
        "secret_value_collection_authorized",
        "shared_database_authorized",
        "shared_session_authorized",
        "shared_rbac_authorized",
        "action_buttons_allowed"
      ],
      "properties": {
        "product_name": {"type": "string"},
        "onboarding_handoff_package_ready": {"type": "boolean"},
        "onboarding_handoff_completion_percent": {"type": "integer", "minimum": 0, "maximum": 100},
        "product_boundary_merged_into_awoooi": {"type": "boolean", "const": false},
        "owner_response_received": {"type": "boolean", "const": false},
        "owner_response_accepted": {"type": "boolean", "const": false},
        "repo_refs_truth_accepted": {"type": "boolean", "const": false},
        "data_classification_accepted": {"type": "boolean", "const": false},
        "deployment_boundary_accepted": {"type": "boolean", "const": false},
        "runtime_gate_open": {"type": "boolean", "const": false},
        "runtime_execution_authorized": {"type": "boolean", "const": false},
        "production_deploy_authorized": {"type": "boolean", "const": false},
        "repo_creation_authorized": {"type": "boolean", "const": false},
        "refs_sync_authorized": {"type": "boolean", "const": false},
        "workflow_modification_authorized": {"type": "boolean", "const": false},
        "secret_value_collection_authorized": {"type": "boolean", "const": false},
        "shared_database_authorized": {"type": "boolean", "const": false},
        "shared_session_authorized": {"type": "boolean", "const": false},
        "shared_rbac_authorized": {"type": "boolean", "const": false},
        "action_buttons_allowed": {"type": "boolean", "const": false}
      },
      "additionalProperties": false
    },
    "product_identity": {
      "type": "object",
      "required": ["product_type", "current_focus", "technical_stack", "language_policy"],
      "properties": {
        "product_type": {"type": "string"},
        "current_focus": {"type": "string"},
        "technical_stack": {"type": "array", "items": {"type": "string"}, "minItems": 1},
        "language_policy": {"type": "string"}
      },
      "additionalProperties": false
    },
    "repo_scope": {
      "type": "object",
      "required": ["active_workspace", "reference_worktree", "required_owner_answers"],
      "properties": {
        "active_workspace": {
          "type": "object",
          "required": ["path", "status_summary", "canonical_for_iwooos", "forbidden_actions"],
          "properties": {
            "path": {"type": "string"},
            "status_summary": {"type": "string"},
            "canonical_for_iwooos": {"type": "boolean", "const": false},
            "forbidden_actions": {"type": "array", "items": {"type": "string"}, "minItems": 1}
          },
          "additionalProperties": false
        },
        "reference_worktree": {
          "type": "object",
          "required": ["path", "head_sha", "origin_main_sha", "main_sha", "remote", "refs_truth_status"],
          "properties": {
            "path": {"type": "string"},
            "head_sha": {"type": "string"},
            "origin_main_sha": {"type": "string"},
            "main_sha": {"type": "string"},
            "remote": {"type": "string"},
            "refs_truth_status": {"type": "string"}
          },
          "additionalProperties": false
        },
        "required_owner_answers": {"type": "array", "items": {"type": "string"}, "minItems": 1}
      },
      "additionalProperties": false
    },
    "product_surfaces": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["surface_id", "routes", "boundary"],
        "properties": {
          "surface_id": {"type": "string"},
          "routes": {"type": "array", "items": {"type": "string"}, "minItems": 1},
          "boundary": {"type": "string"}
        },
        "additionalProperties": false
      },
      "minItems": 1
    },
    "owner_response_handoff": {
      "type": "object",
      "required": [
        "status",
        "request_dispatch_authorized",
        "required_response_fields",
        "allowed_decisions",
        "forbidden_inputs",
        "response_received",
        "response_accepted"
      ],
      "properties": {
        "status": {"type": "string", "enum": ["ready_not_dispatched"]},
        "request_dispatch_authorized": {"type": "boolean", "const": false},
        "required_response_fields": {"type": "array", "items": {"type": "string"}, "minItems": 1},
        "allowed_decisions": {"type": "array", "items": {"type": "string"}, "minItems": 1},
        "forbidden_inputs": {"type": "array", "items": {"type": "string"}, "minItems": 1},
        "response_received": {"type": "boolean", "const": false},
        "response_accepted": {"type": "boolean", "const": false}
      },
      "additionalProperties": false
    },
    "independent_product_boundary": {
      "type": "object",
      "required": ["must_remain_independent", "forbidden_couplings", "allowed_future_integrations"],
      "properties": {
        "must_remain_independent": {"type": "boolean"},
        "forbidden_couplings": {"type": "array", "items": {"type": "string"}, "minItems": 1},
        "allowed_future_integrations": {"type": "array", "items": {"type": "string"}, "minItems": 1}
      },
      "additionalProperties": false
    },
    "data_classification_intake": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["data_type", "status", "collection_rule"],
        "properties": {
          "data_type": {"type": "string"},
          "status": {"type": "string", "enum": ["waiting_owner_classification"]},
          "collection_rule": {"type": "string"}
        },
        "additionalProperties": false
      },
      "minItems": 1
    },
    "deployment_boundary": {
      "type": "object",
      "required": [
        "public_host",
        "production_mode",
        "compose_host",
        "compose_directory",
        "internal_web",
        "database_boundary",
        "k3s_namespace_reference",
        "production_verification_in_this_awoooi_stage",
        "deployment_authorized"
      ],
      "properties": {
        "public_host": {"type": "string"},
        "production_mode": {"type": "string"},
        "compose_host": {"type": "string"},
        "compose_directory": {"type": "string"},
        "internal_web": {"type": "string"},
        "database_boundary": {"type": "string"},
        "k3s_namespace_reference": {"type": "string"},
        "production_verification_in_this_awoooi_stage": {"type": "boolean", "const": false},
        "deployment_authorized": {"type": "boolean", "const": false}
      },
      "additionalProperties": false
    },
    "acceptance_rules": {"type": "array", "items": {"type": "string"}, "minItems": 1},
    "forbidden_actions": {"type": "array", "items": {"type": "string"}, "minItems": 1}
  },
  "additionalProperties": false
}
