{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "anitya_response": {
            "type": "object",
            "description": "Anitya maps upstream components to downstream packages",
            "properties": {},
            "additionalProperties": true
        },
        "changes": {
            "type": "object",
            "description": "Breakdown of changed lines per given file",
            "properties": {
                "lines": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "file": {
                    "type": "string"
                }
            },
            "required": [
                "lines",
                "file"
            ],
            "additionalProperties": false
        },
        "diff": {
            "type": "object",
            "description": "Information about changed files and lines",
            "properties": {
                "files": {
                    "type": "integer"
                },
                "lines": {
                    "type": "integer"
                },
                "changes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/changes"
                    }
                }
            },
            "required": [
                "files",
                "lines",
                "changes"
            ],
            "additionalProperties": false
        },
        "downstream": {
            "type": "object",
            "description": "Patch information about downstream SRPM",
            "properties": {
                "diff": {
                    "$ref": "#/definitions/diff"
                },
                "patch_files": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "package": {
                    "type": "string"
                }
            },
            "required": [
                "diff",
                "patch_files",
                "package"
            ],
            "additionalProperties": false
        },
        "downstream_usage_summary": {
            "type": "object",
            "properties": {
                "package_names": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "registered_srpms": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/srpm_record"
                    }
                },
                "all_rhn_channels": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "all_rhsm_content_sets": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "all_rhsm_product_names": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "package_names",
                "registered_srpms",
                "all_rhn_channels",
                "all_rhsm_content_sets",
                "all_rhsm_product_names"
            ],
            "additionalProperties": false
        },
        "pulp_cdn_response": {
            "type": "object",
            "description": "The Pulp CDN handles Red Hat's SRPM publication",
            "properties": {
                "srpm_filename": {
                    "type": "string"
                },
                "rhn_channels": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "rhsm_content_sets": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "rhsm_product_names": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "srpm_filename",
                "rhn_channels",
                "rhsm_content_sets",
                "rhsm_product_names"
            ],
            "additionalProperties": true
        },
        "srpm_record": {
            "type": "object",
            "description": "Summary of Red Hat tracked SRPM",
            "properties": {
                "package_name": {
                    "type": "string"
                },
                "epoch": {
                    "type": "number"
                },
                "version": {
                    "type": "string"
                },
                "release": {
                    "type": "string"
                },
                "patch_count": {
                    "type": "number"
                },
                "modified_line_count": {
                    "type": "number"
                },
                "modified_file_count": {
                    "type": "number"
                },
                "published_in": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "architectures": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "hashes": {
                    "type": "object",
                    "properties": {
                        "md5": {
                            "type": "string"
                        },
                        "sha1": {
                            "type": "string"
                        },
                        "sha256": {
                            "type": "string"
                        }
                    }
                }
            },
            "required": [
                "package_name",
                "epoch",
                "version",
                "release",
                "patch_count",
                "modified_line_count",
                "modified_file_count"
            ],
            "additionalProperties": false
        },
        "toolchain_responses": {
            "type": "object",
            "properties": {
                "redhat_anitya": {
                    "$ref": "#/definitions/anitya_response"
                },
                "brew": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/downstream"
                    }
                },
                "pulp_cdn": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/pulp_cdn_response"
                    }
                }
            },
            "additionalProperties": false
        }
    },
    "type": "object",
    "description": "Result of DownstreamUsage worker",
    "properties": {
        "schema": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "description": "Name of the schema",
                    "pattern": "^[a-zA-Z0-9_]+$"
                },
                "version": {
                    "type": "string",
                    "description": "Version of the schema",
                    "pattern": "^[0-9]+-[0-9]+-[0-9]+$"
                },
                "url": {
                    "type": "string",
                    "description": "Full URL of the schema",
                    "format": "uri"
                }
            },
            "required": [
                "name",
                "version"
            ],
            "additionalProperties": false
        },
        "_release": {
            "type": "string",
            "description": "Unique release id in form of \"ecosystem:package:version\""
        },
        "status": {
            "type": "string",
            "enum": [
                "success",
                "error"
            ]
        },
        "details": {
            "$ref": "#/definitions/toolchain_responses"
        },
        "summary": {
            "$ref": "#/definitions/downstream_usage_summary"
        }
    },
    "required": [
        "status",
        "summary"
    ],
    "additionalProperties": false,
    "title": "downstream_usage_result-v2-2-0"
}