{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://blockprotocol.org/types/modules/graph/0.3/schema/entity-type",
  "title": "Entity Type",
  "description": "Specifies the structure of a Block Protocol entity type",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "const": "https://blockprotocol.org/types/modules/graph/0.3/schema/entity-type"
    },
    "kind": {
      "const": "entityType"
    },
    "$id": {
      "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/versioned-url"
    },
    "type": {
      "const": "object"
    },
    "title": {
      "type": "string"
    },
    "titlePlural": {
      "type": "string"
    },
    "inverse": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "titlePlural": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "description": {
      "type": "string"
    },
    "allOf": {
      "$comment": "Present if this entity type is a parent entity type.",
      "type": "array",
      "items": {
        "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/entity-type-reference"
      },
      "minItems": 1
    },
    "properties": {
      "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/property-type-object"
    },
    "required": {
      "type": "array",
      "items": {
        "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/base-url"
      }
    },
    "links": {
      "type": "object",
      "propertyNames": {
        "$comment": "Property names must be a valid versioned URL to a link entity type to allow for outgoing links of that type from this entity.",
        "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/versioned-url"
      },
      "patternProperties": {
        ".*": {
          "type": "object",
          "properties": {
            "type": {
              "const": "array"
            },
            "items": {
              "$ref": "#/$defs/oneOfEntityTypeReference"
            },
            "minItems": {
              "type": "integer",
              "minimum": 0
            },
            "maxItems": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": ["type", "items"],
          "additionalProperties": false
        }
      }
    },
    "labelProperty": {
      "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/base-url"
    },
    "icon": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "$schema",
    "kind",
    "type",
    "$id",
    "title",
    "description",
    "properties"
  ],
  "$defs": {
    "oneOfEntityTypeReference": {
      "description": "Specifies a set of entity types inside a oneOf",
      "type": "object",
      "properties": {
        "oneOf": {
          "type": "array",
          "items": {
            "$ref": "https://blockprotocol.org/types/modules/graph/0.3/schema/entity-type-reference"
          }
        }
      },
      "additionalProperties": false
    }
  }
}
