{
  "$id": "https://comitiva.dev/schema/AttachmentBlock.json",
  "title": "AttachmentBlock",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "image"
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "base64"
                },
                "mediaType": {
                  "type": "string"
                },
                "data": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "mediaType",
                "data"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "file"
                },
                "path": {
                  "type": "string"
                },
                "mediaType": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "path"
              ]
            }
          ]
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "source"
      ]
    },
    {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "const": "document"
        },
        "name": {
          "type": "string"
        },
        "mediaType": {
          "type": "string"
        },
        "source": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "base64"
                },
                "mediaType": {
                  "type": "string"
                },
                "data": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "mediaType",
                "data"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "const": "file"
                },
                "path": {
                  "type": "string"
                },
                "mediaType": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "path"
              ]
            }
          ]
        }
      },
      "required": [
        "type",
        "name",
        "mediaType",
        "source"
      ]
    }
  ]
}
