{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "OpenAgentWorks factory receipt",
  "type": "object",
  "properties": {
    "profile_version": {
      "const": "1.0.0"
    },
    "package_id": {
      "type": "string",
      "minLength": 1
    },
    "package_manifest_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "received_at": {
      "type": "string",
      "format": "date-time"
    },
    "factory_id": {
      "type": "string",
      "minLength": 1
    },
    "status": {
      "enum": [
        "accepted",
        "unsupported_profile",
        "invalid_package",
        "blocked",
        "software_complete",
        "production_enabled"
      ]
    },
    "supported_versions": {
      "type": "object",
      "properties": {
        "openagentworks": {
          "type": "string",
          "minLength": 1
        },
        "json_schema": {
          "type": "string",
          "minLength": 1
        },
        "openapi": {
          "type": "string",
          "minLength": 1
        },
        "asyncapi": {
          "type": "string",
          "minLength": 1
        },
        "reqif": {
          "type": "string",
          "minLength": 1
        }
      },
      "required": [
        "openagentworks",
        "json_schema",
        "openapi",
        "asyncapi",
        "reqif"
      ],
      "additionalProperties": false
    },
    "capability_results": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "capability_id": {
            "type": "string",
            "minLength": 1
          },
          "release_ref": {
            "type": "string",
            "minLength": 1
          },
          "state": {
            "enum": [
              "not_started",
              "in_progress",
              "software_complete",
              "production_enabled",
              "blocked",
              "failed"
            ]
          },
          "requirement_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "test_evidence_uris": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "blocker_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "capability_id",
          "release_ref",
          "state",
          "requirement_ids",
          "test_evidence_uris",
          "blocker_ids"
        ],
        "additionalProperties": false
      }
    },
    "decisions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "reason": {
            "type": "string",
            "minLength": 1
          },
          "affected_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "id",
          "reason",
          "affected_ids"
        ],
        "additionalProperties": false
      }
    },
    "external_blockers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "owner_role": {
            "type": "string",
            "minLength": 1
          },
          "affected_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "required_evidence": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "id",
          "owner_role",
          "affected_ids",
          "required_evidence"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "profile_version",
    "package_id",
    "package_manifest_sha256",
    "received_at",
    "factory_id",
    "status",
    "supported_versions",
    "capability_results",
    "decisions",
    "external_blockers"
  ],
  "additionalProperties": false
}
