{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "additionalProperties": false,
    "definitions": {
        "company": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "A company which is the subject of a statement",
            "properties": {
                "company_number": {
                    "type": "string"
                },
                "identifier": {
                    "description": "An official identifier paired with a code for the issuer of the identifier, e.g sec/12345",
                    "pattern": "^[^/]+/[^/]+$",
                    "type": "string"
                },
                "jurisdiction": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            },
            "required": [
                "name",
                "jurisdiction"
            ],
            "type": "object"
        },
        "financial-payment-data-object": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "properties": {
                "confidence": {
                    "type": "string"
                },
                "data_type": {
                    "enum": [
                        "financial_payment"
                    ]
                },
                "properties": {
                    "properties": {
                        "csv_line_number": {
                            "description": "If the source for the data is a CSV file, you can optionally include the line number of the CSV from which this data was retrieved",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "currency": {
                            "description": "The currency of the payment (three letter symbol, e.g. USD, GBP, EUR)",
                            "type": "string"
                        },
                        "date": {
                            "_format": "date",
                            "description": "The date on which the payment was made",
                            "type": "string"
                        },
                        "department_name": {
                            "description": "The name of the government department which the entity belongs to (if relevant), e.g. Department of Health",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "description": {
                            "description": "The description of the transaction as given in the raw data",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "entity_name": {
                            "description": "The name of the government entity that made the payment, e.g. Environment Agency",
                            "type": "string"
                        },
                        "entity_uri": {
                            "description": "A unique URL (ideally a dereferencable URI) for the government entity",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "expense_area": {
                            "description": "category (in words) of the expenditure",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "expense_type": {
                            "description": "The type of expense -- can be either capital, revenue (i.e. current expenditure) or null",
                            "enum": [
                                "capital",
                                "revenue",
                                null
                            ]
                        },
                        "jurisdiction": {
                            "description": "The jurisdiction of the body that made the payment, eg. UK, France, Delaware, Manchester",
                            "type": "string"
                        },
                        "more_details_url": {
                            "description": "A url from which more details can be seen (may be the same as the source_url)",
                            "type": [
                                "string",
                                "null"
                            ]
                        },
                        "payee_name": {
                            "description": "The name of the payee (the entity that received the money)",
                            "type": "string"
                        },
                        "transaction_number": {
                            "description": "The unique identifier for the transaction, scoped to this bot",
                            "type": "string"
                        },
                        "value": {
                            "description": "The amount transacted (e.g. 19.95)",
                            "type": "string"
                        }
                    },
                    "required": [
                        "value",
                        "payee_name",
                        "date",
                        "currency"
                    ],
                    "type": "object"
                },
                "source_url": {
                    "type": "string"
                }
            },
            "required": [
                "data_type",
                "properties",
                "source_url",
                "confidence"
            ],
            "type": "object"
        }
    },
    "description": "A Financial-Payment is a payment from government to a recipient",
    "properties": {
        "company": {
            "$ref": "#/definitions/company"
        },
        "data": {
            "additionalItems": false,
            "description": "This is an array of data objects, that is the objects which actually contain the data about the datum. Generally there will only be one element in this, although in for some types of data_types there may naturally be several releated to the same company, e.g. shareholders",
            "items": {
                "$ref": "#/definitions/financial-payment-data-object"
            },
            "type": "array"
        },
        "retrieved_at": {
            "_format": "date",
            "type": "string"
        },
        "sample_date": {
            "_format": "date",
            "type": "string"
        },
        "source_jurisdiction": {
            "description": "Jurisdiction of the source of the data",
            "type": "string"
        }
    },
    "required": [
        "company",
        "data",
        "sample_date"
    ],
    "type": "object"
}