{
    "$id": "../observables/artifact.json",
    "$schema": "http://json-schema.org/draft-06/schema#",
    "title": "artifact",
    "description": "The Artifact Object permits capturing an array of bytes (8-bits), as a base64-encoded string string, or linking to a file-like payload.",
    "type": "object",
    "allOf": [
        {
            "$ref": "../common/cyber-observable-core.json"
        },
        {
            "properties": {
                "type": {
                    "type": "string",
                    "description": "The value of this property MUST be `artifact`.",
                    "const": "artifact"
                },
                "mime_type": {
                    "type": "string",
                    "pattern": "^(application|audio|font|image|message|model|multipart|text|video)/[a-zA-Z0-9.+_-]+",
                    "description": "The value of this property MUST be a valid MIME type as specified in the IANA Media Types registry."
                }
            }
        }
    ],
    "oneOf": [
        {
            "properties": {
                "payload_bin": {
                    "$ref": "../common/binary.json",
                    "description": "Specifies the binary data contained in the artifact as a base64-encoded string."
                },
                "hashes": {
                    "$ref": "../common/hashes-type.json",
                    "description": "Specifies a dictionary of hashes for the contents of the url or the payload_bin.  This MUST be provided when the url property is present."
                }
            },
            "required": [
                "payload_bin"
            ],
            "not": {
                "required": [
                    "url"
                ]
            }
        },
        {
            "properties": {
                "url": {
                    "$ref": "../common/url-regex.json",
                    "description": "The value of this property MUST be a valid URL that resolves to the unencoded content."
                },
                "hashes": {
                    "$ref": "../common/hashes-type.json",
                    "description": "Specifies a dictionary of hashes for the contents of the url or the payload_bin.  This MUST be provided when the url property is present."
                }
            },
            "required": [
                "url",
                "hashes"
            ],
            "not": {
                "required": [
                    "payload_bin"
                ]
            }
        }
    ]
}