{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:tandem:schema:close",
  "title": "Tandem close manifest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "title",
    "content_type",
    "content_sha256",
    "uris"
  ],
  "properties": {
    "schema": {
      "const": "urn:tandem:close"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120,
      "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
    },
    "content_type": {
      "type": "string",
      "minLength": 3,
      "maxLength": 127,
      "pattern": "^[a-z0-9][a-z0-9!#$&^_.+-]{0,63}/[a-z0-9][a-z0-9!#$&^_.+-]{0,62}$"
    },
    "content_sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "uris": {
      "type": "array",
      "maxItems": 8,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 10,
        "maxLength": 2048,
        "pattern": "^(ipfs://[A-Za-z0-9]+(?:/[^\\s]*)?|ar://[A-Za-z0-9_-]+|sha256://[0-9a-f]{64})$"
      }
    },
    "encryption": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scheme",
        "nonce_base64",
        "key_commitment_sha256"
      ],
      "properties": {
        "scheme": {
          "const": "xchacha20-poly1305"
        },
        "nonce_base64": {
          "type": "string",
          "minLength": 32,
          "maxLength": 32,
          "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
        },
        "key_commitment_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "display": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "fit": {
          "enum": [
            "contain",
            "cover",
            "native"
          ]
        },
        "background": {
          "type": "string",
          "pattern": "^#[0-9a-fA-F]{6}$"
        },
        "alt": {
          "type": "string",
          "maxLength": 500,
          "pattern": "^[^\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f\\u007f]*$"
        }
      }
    }
  }
}
