{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "OpenAgentWorks package manifest core1.0",
  "type": "object",
  "properties": {
    "package_id": {
      "type": "string",
      "minLength": 1
    },
    "product_slug": {
      "type": "string",
      "minLength": 1
    },
    "product_version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "profile": {
      "type": "object",
      "properties": {
        "name": {
          "const": "OpenAgentWorks"
        },
        "version": {
          "const": "1.0.0"
        },
        "status": {
          "const": "proposed_custom_profile"
        }
      },
      "required": [
        "name",
        "version",
        "status"
      ],
      "additionalProperties": false
    },
    "required_features": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "uniqueItems": true
    },
    "entrypoint": {
      "const": "package.json"
    },
    "canonical_catalogs": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "business_validator_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "resources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1
          },
          "media_type": {
            "type": "string",
            "minLength": 1
          },
          "role": {
            "enum": [
              "canonical_catalog",
              "contract",
              "schema",
              "vendor_schema",
              "projection",
              "tooling",
              "example",
              "standard",
              "validation_evidence",
              "manifest"
            ]
          },
          "validation": {
            "enum": [
              "json",
              "json_schema",
              "xml_schema",
              "reqif",
              "python_source",
              "dependency_lock"
            ]
          },
          "schema_path": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "source_paths": {
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "required": [
          "path",
          "media_type",
          "role",
          "validation",
          "schema_path",
          "required",
          "source_paths"
        ],
        "additionalProperties": false
      }
    },
    "precedence": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "receipt_schema": {
      "type": "string",
      "minLength": 1
    },
    "instance_status": {
      "const": "specification_only"
    },
    "integrity": {
      "type": "object",
      "properties": {
        "format": {
          "const": "BagIt1.0"
        },
        "algorithm": {
          "const": "SHA256"
        },
        "payload_manifest": {
          "const": "../manifest-sha256.txt"
        }
      },
      "required": [
        "format",
        "algorithm",
        "payload_manifest"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "package_id",
    "product_slug",
    "product_version",
    "created_at",
    "profile",
    "required_features",
    "entrypoint",
    "canonical_catalogs",
    "business_validator_id",
    "resources",
    "precedence",
    "receipt_schema",
    "instance_status",
    "integrity"
  ],
  "additionalProperties": false
}
