{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "product_awoooi_manifest_v1",
  "title": "AWOOOI product manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "product",
    "source_control",
    "runtime",
    "contracts",
    "operation_boundaries"
  ],
  "properties": {
    "schema_version": {
      "const": "product_awoooi_manifest_v1"
    },
    "product": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "display_name", "owner", "lifecycle", "priority"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "display_name": { "type": "string", "minLength": 1 },
        "owner": { "type": "string", "minLength": 1 },
        "lifecycle": { "enum": ["production", "development", "retired"] },
        "priority": { "enum": ["P0", "P1", "P2", "P3"] }
      }
    },
    "source_control": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "authority",
        "repo",
        "development_branch",
        "production_branch",
        "github_status"
      ],
      "properties": {
        "authority": { "const": "gitea" },
        "repo": { "type": "string", "pattern": "^[^/]+/[^/]+$" },
        "development_branch": { "type": "string", "minLength": 1 },
        "production_branch": { "type": "string", "minLength": 1 },
        "github_status": { "const": "stopped_retired_do_not_use" }
      }
    },
    "runtime": {
      "type": "object",
      "additionalProperties": false,
      "required": ["production_url", "delivery_workbench_api"],
      "properties": {
        "production_url": { "type": "string", "pattern": "^https://[^\\s]+$" },
        "delivery_workbench_api": { "type": "string", "pattern": "^/api/v1/" }
      }
    },
    "contracts": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "data_contract_ref",
        "security_contract_ref",
        "runtime_inventory_ref"
      ],
      "properties": {
        "data_contract_ref": { "type": "string", "minLength": 1 },
        "security_contract_ref": { "type": "string", "minLength": 1 },
        "runtime_inventory_ref": { "type": "string", "minLength": 1 }
      }
    },
    "operation_boundaries": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "read_only_manifest_allowed",
        "github_api_allowed",
        "repo_creation_allowed",
        "refs_sync_allowed",
        "workflow_trigger_allowed",
        "host_or_k8s_write_allowed",
        "secret_read_allowed",
        "raw_session_or_sqlite_read_allowed"
      ],
      "properties": {
        "read_only_manifest_allowed": { "const": true },
        "github_api_allowed": { "const": false },
        "repo_creation_allowed": { "const": false },
        "refs_sync_allowed": { "const": false },
        "workflow_trigger_allowed": { "const": false },
        "host_or_k8s_write_allowed": { "const": false },
        "secret_read_allowed": { "const": false },
        "raw_session_or_sqlite_read_allowed": { "const": false }
      }
    }
  }
}
