{
    "additionalProperties": false,
    "description": "Schema for a data load succeeding",
    "properties": {
        "application": {
            "description": "Loader's name and version",
            "maxLength": 128,
            "type": "string"
        },
        "attempt": {
            "description": "How many attempts were taken to load the batch",
            "minimum": 0,
            "type": "integer"
        },
        "loadingCompleted": {
            "_format": "date-time",
            "description": "Time when loader finished loading (should match the ingestion timestamp in manifest)",
            "type": "string"
        },
        "loadingStarted": {
            "_format": "date-time",
            "description": "Time when loader started loading (first attempt)",
            "type": "string"
        },
        "shredding": {
            "additionalProperties": false,
            "description": "Information about the batch taken from transformation step, isomorphic to shredding_complete schema",
            "properties": {
                "base": {
                    "_format": "uri",
                    "description": "Blob storage path to the root of the batch",
                    "maxLength": 1024,
                    "type": "string"
                },
                "compression": {
                    "description": "File compression type",
                    "enum": [
                        "GZIP",
                        "NONE"
                    ]
                },
                "count": {
                    "description": "Count of events in the batch, null means the count could not be calculated",
                    "properties": {
                        "good": {
                            "description": "Amount of good events in the batch",
                            "minimum": 0,
                            "type": "integer"
                        }
                    },
                    "type": [
                        "object",
                        "null"
                    ]
                },
                "processor": {
                    "description": "Identificator of a shredder sent the message",
                    "properties": {
                        "artifact": {
                            "description": "Name of the artifact",
                            "maxLength": 64,
                            "type": "string"
                        },
                        "version": {
                            "description": "Semantic Version of the artifact",
                            "maxLength": 16,
                            "type": "string"
                        }
                    },
                    "required": [
                        "artifact",
                        "version"
                    ],
                    "type": "object"
                },
                "timestamps": {
                    "description": "Set of timestamps associated with the batch",
                    "properties": {
                        "jobCompleted": {
                            "_format": "date-time",
                            "description": "Time when the batch shredding has been finished (and the message being prepared)",
                            "type": "string"
                        },
                        "jobStarted": {
                            "_format": "date-time",
                            "description": "Time when the batch started being shredded",
                            "type": "string"
                        },
                        "max": {
                            "_format": "date-time",
                            "description": "The latest collector_tstamp available in the batch",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "min": {
                            "_format": "date-time",
                            "description": "The earliest collector_stamp available in the batch",
                            "type": [
                                "string",
                                "null"
                            ]
                        }
                    },
                    "required": [
                        "jobStarted",
                        "jobCompleted",
                        "min",
                        "max"
                    ],
                    "type": "object"
                },
                "typesInfo": {
                    "description": "Info about schemas used in events and output formats in the respective batch",
                    "oneOf": [
                        {
                            "additionalProperties": false,
                            "properties": {
                                "transformation": {
                                    "description": "Type of the transformation",
                                    "enum": [
                                        "SHREDDED"
                                    ]
                                },
                                "types": {
                                    "description": "Set of Iglu URIs and the format they were shredded into",
                                    "items": {
                                        "additionalProperties": false,
                                        "properties": {
                                            "format": {
                                                "description": "File format into which the entities were shredded",
                                                "enum": [
                                                    "TSV",
                                                    "JSON"
                                                ]
                                            },
                                            "schemaKey": {
                                                "description": "Iglu URI",
                                                "maxLength": 256,
                                                "type": "string"
                                            },
                                            "snowplowEntity": {
                                                "description": "Type of the self-describing JSON in the event",
                                                "enum": [
                                                    "SELF_DESCRIBING_EVENT",
                                                    "CONTEXT"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "schemaKey",
                                            "format",
                                            "snowplowEntity"
                                        ]
                                    },
                                    "type": "array"
                                }
                            },
                            "required": [
                                "transformation",
                                "types"
                            ]
                        },
                        {
                            "additionalProperties": false,
                            "properties": {
                                "fileFormat": {
                                    "description": "Output file format",
                                    "enum": [
                                        "JSON",
                                        "PARQUET"
                                    ]
                                },
                                "transformation": {
                                    "description": "Type of the transformation",
                                    "enum": [
                                        "WIDEROW"
                                    ]
                                },
                                "types": {
                                    "description": "Set of Iglu URIs and the format they were shredded into",
                                    "items": {
                                        "additionalProperties": false,
                                        "properties": {
                                            "schemaKey": {
                                                "description": "Iglu URI",
                                                "maxLength": 256,
                                                "type": "string"
                                            },
                                            "snowplowEntity": {
                                                "description": "Type of the self-describing JSON in the event",
                                                "enum": [
                                                    "SELF_DESCRIBING_EVENT",
                                                    "CONTEXT"
                                                ]
                                            }
                                        },
                                        "required": [
                                            "schemaKey",
                                            "snowplowEntity"
                                        ]
                                    },
                                    "type": "array"
                                }
                            },
                            "required": [
                                "transformation",
                                "fileFormat",
                                "types"
                            ]
                        }
                    ],
                    "type": "object"
                }
            },
            "required": [
                "base",
                "compression",
                "typesInfo",
                "timestamps",
                "processor"
            ],
            "type": "object"
        },
        "tags": {
            "description": "Set of key value pairs providing additional information",
            "type": "object"
        }
    },
    "required": [
        "shredding",
        "application",
        "attempt",
        "loadingStarted",
        "loadingCompleted",
        "tags"
    ],
    "self": {
        "format": "jsonschema",
        "name": "load_succeeded",
        "vendor": "com.snowplowanalytics.monitoring.batch",
        "version": "3-0-0"
    },
    "type": "object"
}