{
    "additionalProperties": false,
    "description": "Schema for a bad row resulting from enrichment failures",
    "properties": {
        "failure": {
            "description": "Information regarding the enrichment failures",
            "properties": {
                "messages": {
                    "description": "List of failure messages associated with the enrichment failures",
                    "items": {
                        "additionalProperties": false,
                        "description": "Individual enrichment failure or null in case of validation",
                        "properties": {
                            "enrichment": {
                                "additionalProperties": false,
                                "description": "Information needed to identify an enrichment",
                                "properties": {
                                    "identifier": {
                                        "description": "Uniquely identifies the instance of of the enrichment which produced this failure",
                                        "maxLength": 256,
                                        "type": "string"
                                    },
                                    "schemaKey": {
                                        "description": "The schema coordinates for this enrichment",
                                        "type": "string"
                                    }
                                },
                                "required": [
                                    "schemaKey",
                                    "identifier"
                                ],
                                "type": [
                                    "object",
                                    "null"
                                ]
                            },
                            "message": {
                                "anyOf": [
                                    {
                                        "additionalProperties": false,
                                        "description": "Error which was internal to the enrichment regarding its input data",
                                        "properties": {
                                            "expectation": {
                                                "description": "Expectation which was not met",
                                                "maxLength": 256,
                                                "type": "string"
                                            },
                                            "field": {
                                                "description": "Field which did not meet the enrichment's expectations",
                                                "maxLength": 64,
                                                "type": "string"
                                            },
                                            "value": {
                                                "description": "Stringified representation of the value which did not meet expectations",
                                                "type": [
                                                    "string",
                                                    "null"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "field",
                                            "expectation"
                                        ],
                                        "type": "object"
                                    },
                                    {
                                        "additionalProperties": false,
                                        "description": "Error which was external to the enrichment, e.g. a connection issue",
                                        "properties": {
                                            "error": {
                                                "description": "Error that occurred",
                                                "maxLength": 512,
                                                "type": "string"
                                            }
                                        },
                                        "required": [
                                            "error"
                                        ],
                                        "type": "object"
                                    },
                                    {
                                        "additionalProperties": false,
                                        "description": "Supplied JSON did not validate against its schema (or schema was not found)",
                                        "properties": {
                                            "error": {
                                                "anyOf": [
                                                    {
                                                        "additionalProperties": false,
                                                        "description": "Resolution error - schema could not be found in the specified repositories, defined by ResolutionError in the Iglu Client",
                                                        "properties": {
                                                            "error": {
                                                                "enum": [
                                                                    "ResolutionError"
                                                                ]
                                                            },
                                                            "lookupHistory": {
                                                                "items": {
                                                                    "properties": {
                                                                        "attempts": {
                                                                            "description": "Number of attempts which have been made",
                                                                            "minimum": 0,
                                                                            "type": "integer"
                                                                        },
                                                                        "errors": {
                                                                            "description": "Set of errors which happened for this repository",
                                                                            "items": {
                                                                                "properties": {
                                                                                    "error": {
                                                                                        "description": "Type of error (NotFound does not contain a message)",
                                                                                        "enum": [
                                                                                            "RepoFailure",
                                                                                            "ClientFailure",
                                                                                            "NotFound"
                                                                                        ]
                                                                                    },
                                                                                    "message": {
                                                                                        "description": "Optional message in case of ClientFailure or RepoFailure",
                                                                                        "maxLength": 256,
                                                                                        "type": "string"
                                                                                    }
                                                                                },
                                                                                "required": [
                                                                                    "error"
                                                                                ],
                                                                                "type": "object"
                                                                            },
                                                                            "minItems": 1,
                                                                            "type": "array"
                                                                        },
                                                                        "lastAttempt": {
                                                                            "_format": "date-time",
                                                                            "description": "Timestamp of a last attempt being made",
                                                                            "type": "string"
                                                                        },
                                                                        "repostitory": {
                                                                            "description": "Name of the repostitory as written in resolver.json",
                                                                            "type": "string"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "repository",
                                                                        "errors",
                                                                        "attempts",
                                                                        "lastAttempt"
                                                                    ],
                                                                    "type": "object"
                                                                },
                                                                "minItems": 1,
                                                                "type": "array"
                                                            }
                                                        },
                                                        "required": [
                                                            "error",
                                                            "lookupHistory"
                                                        ]
                                                    },
                                                    {
                                                        "additionalProperties": false,
                                                        "description": "Data is invalid against resolved schema",
                                                        "properties": {
                                                            "dataReports": {
                                                                "items": {
                                                                    "additionalProperties": false,
                                                                    "properties": {
                                                                        "keyword": {
                                                                            "description": "JSON Schema Keywrod caused invalidation",
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        "message": {
                                                                            "description": "Human-readable message describing the issue with the schema",
                                                                            "type": "string"
                                                                        },
                                                                        "path": {
                                                                            "description": "JSON Path to an issue in the faulty JSON datum",
                                                                            "type": [
                                                                                "string",
                                                                                "null"
                                                                            ]
                                                                        },
                                                                        "targets": {
                                                                            "type": [
                                                                                "array",
                                                                                "null"
                                                                            ]
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "path",
                                                                        "message",
                                                                        "keyword",
                                                                        "targets"
                                                                    ]
                                                                },
                                                                "minItems": 1,
                                                                "type": "array"
                                                            },
                                                            "error": {
                                                                "enum": [
                                                                    "ValidationError"
                                                                ]
                                                            }
                                                        },
                                                        "required": [
                                                            "dataReports"
                                                        ]
                                                    },
                                                    {
                                                        "additionalProperties": false,
                                                        "description": "Schema is invalid and cannot be used to validate an instance",
                                                        "properties": {
                                                            "error": {
                                                                "enum": [
                                                                    "ValidationError"
                                                                ]
                                                            },
                                                            "schemaIssues": {
                                                                "description": "List of problems in resolved JSON schema",
                                                                "items": {
                                                                    "additionalProperties": false,
                                                                    "properties": {
                                                                        "message": {
                                                                            "description": "Human-readable message describing the issue with the schema",
                                                                            "type": "string"
                                                                        },
                                                                        "path": {
                                                                            "description": "JSON Path to an issue in the faulty JSON Schema",
                                                                            "type": "string"
                                                                        }
                                                                    },
                                                                    "required": [
                                                                        "path",
                                                                        "message"
                                                                    ],
                                                                    "type": "object"
                                                                },
                                                                "minItems": 1,
                                                                "type": "array"
                                                            }
                                                        },
                                                        "required": [
                                                            "error"
                                                        ]
                                                    }
                                                ],
                                                "description": "Iglu client error"
                                            },
                                            "schemaKey": {
                                                "description": "The iglu schema coordinates to validate against",
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                ],
                                "description": "Information about the failure that happened for this enrichment",
                                "type": "object"
                            }
                        },
                        "required": [
                            "enrichment",
                            "message"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                },
                "timestamp": {
                    "_format": "date-time",
                    "description": "Timestamp at which the failure occurred",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "payload": {
            "properties": {
                "enriched": {
                    "additionalProperties": false,
                    "description": "The partially enriched event that resulted in schema violations",
                    "properties": {
                        "app_id": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "base_currency": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_colordepth": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_cookies": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_family": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_features_director": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_flash": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_gears": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_java": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_pdf": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_quicktime": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_realplayer": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_silverlight": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_features_windowsmedia": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_lang": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_name": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_renderengine": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_type": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_version": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "br_viewheight": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "br_viewwidth": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "collector_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "contexts": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "derived_contexts": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "derived_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "doc_charset": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "doc_height": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "doc_width": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "domain_sessionid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "domain_sessionidx": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "domain_userid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "dvce_created_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "dvce_ismobile": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "dvce_screenheight": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "dvce_screenwidth": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "dvce_sent_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "dvce_type": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "etl_tags": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "etl_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event_fingerprint": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event_format": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event_id": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event_name": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event_vendor": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "event_version": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "geo_city": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "geo_country": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "geo_latitude": {
                            "type": [
                                "number",
                                "null"
                            ]
                        },
                        "geo_longitude": {
                            "type": [
                                "number",
                                "null"
                            ]
                        },
                        "geo_region": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "geo_region_name": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "geo_timezone": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "geo_zipcode": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ip_domain": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ip_isp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ip_netspeed": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ip_organization": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_campaign": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_clickid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_content": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_medium": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_network": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_source": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "mkt_term": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "name_tracker": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "network_userid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "os_family": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "os_manufacturer": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "os_name": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "os_timezone": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_referrer": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_title": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_url": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_urlfragment": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_urlhost": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_urlpath": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_urlport": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "page_urlquery": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "page_urlscheme": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "platform": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "pp_xoffset_max": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "pp_xoffset_min": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "pp_yoffset_max": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "pp_yoffset_min": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "refr_domain_userid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_dvce_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_medium": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_source": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_term": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_urlfragment": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_urlhost": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_urlpath": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_urlport": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "refr_urlquery": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "refr_urlscheme": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "se_action": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "se_category": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "se_label": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "se_property": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "se_value": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_category": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_currency": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_name": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_orderid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_price": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_price_base": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ti_quantity": {
                            "type": [
                                "integer",
                                "null"
                            ]
                        },
                        "ti_sku": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_affiliation": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_city": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_country": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_currency": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_orderid": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_shipping": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_shipping_base": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_state": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_tax": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_tax_base": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_total": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "tr_total_base": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "true_tstamp": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "txn_id": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "unstruct_event": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "user_fingerprint": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "user_id": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "user_ipaddress": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "useragent": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "v_collector": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "v_etl": {
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "v_tracker": {
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    }
                },
                "raw": {
                    "additionalProperties": false,
                    "description": "The raw event extracted from collector payload",
                    "properties": {
                        "contentType": {
                            "description": "Content type of the payload as detected by the collector",
                            "maxLength": 256,
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "encoding": {
                            "description": "Encoding of the collector payload",
                            "maxLength": 32,
                            "type": "string"
                        },
                        "headers": {
                            "description": "List of the headers part of this collector payload",
                            "items": {
                                "maxLength": 8192,
                                "type": "string"
                            },
                            "type": [
                                "array",
                                "null"
                            ]
                        },
                        "hostname": {
                            "description": "Hostname of the payload as detected by the collector",
                            "maxLength": 8192,
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "ipAddress": {
                            "description": "IP address of the payload as detected by the collector",
                            "maxLength": 128,
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "loaderName": {
                            "maxLength": 32,
                            "type": "string"
                        },
                        "parameters": {
                            "description": "Query string of the collector payload containing this event",
                            "items": {
                                "additionalProperties": false,
                                "properties": {
                                    "name": {
                                        "description": "Name of the querystring parameter",
                                        "maxLength": 512,
                                        "type": "string"
                                    },
                                    "value": {
                                        "description": "Possible value for the querystring parameter",
                                        "maxLength": 512,
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "name",
                                    "value"
                                ],
                                "type": "object"
                            },
                            "type": [
                                "array",
                                "null"
                            ]
                        },
                        "refererUri": {
                            "description": "Referer of the payload as detected by the collector",
                            "maxLength": 8192,
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "timestamp": {
                            "_format": "date-time",
                            "description": "Timestamp at which the payload was collected",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "userId": {
                            "_format": "uuid",
                            "description": "Network user id associated with this payload",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "useragent": {
                            "description": "User agent of the payload as detected by the collector",
                            "maxLength": 4096,
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "vendor": {
                            "description": "Vendor of the adapter that processed this payload, here com.snowplowanalytics.snowplow",
                            "maxLength": 64,
                            "type": "string"
                        },
                        "version": {
                            "description": "Version of the adapter that processed this payload",
                            "maxLength": 16,
                            "type": "string"
                        }
                    },
                    "required": [
                        "vendor",
                        "version",
                        "loaderName",
                        "encoding"
                    ],
                    "type": "object"
                }
            },
            "type": "object"
        },
        "processor": {
            "additionalProperties": false,
            "description": "Information about the piece of software responsible for the creation of enrichment failures",
            "properties": {
                "artifact": {
                    "description": "Artifact responsible for the creation of enrichment failures",
                    "maxLength": 512,
                    "type": "string"
                },
                "version": {
                    "description": "Version of the artifact responsible for the creation of enrichment failures",
                    "maxLength": 32,
                    "pattern": "^(\\d+\\.\\d+\\.\\d+.*)$",
                    "type": "string"
                }
            },
            "required": [
                "artifact",
                "version"
            ],
            "type": "object"
        }
    },
    "required": [
        "failure",
        "payload",
        "processor"
    ],
    "self": {
        "format": "jsonschema",
        "name": "enrichment_failures",
        "vendor": "com.snowplowanalytics.snowplow.badrows",
        "version": "2-0-0"
    },
    "type": "object"
}