{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "additionalProperties": false,
    "definitions": {
        "levelType": {
            "description": "Note: A value of \"\" indicates that the commodity is not normally sold/purchased at this station, but is currently temporarily for sale/purchase",
            "enum": [
                0,
                1,
                2,
                3,
                ""
            ]
        }
    },
    "id": "https://eddn.edcd.io/schemas/commodity/3#",
    "properties": {
        "$schemaRef": {
            "type": "string"
        },
        "header": {
            "additionalProperties": true,
            "properties": {
                "gatewayTimestamp": {
                    "_format": "date-time",
                    "description": "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property.",
                    "type": "string"
                },
                "softwareName": {
                    "type": "string"
                },
                "softwareVersion": {
                    "type": "string"
                },
                "uploaderID": {
                    "type": "string"
                }
            },
            "required": [
                "uploaderID",
                "softwareName",
                "softwareVersion"
            ],
            "type": "object"
        },
        "message": {
            "additionalProperties": false,
            "properties": {
                "commodities": {
                    "description": "Commodities returned by the Companion API, with illegal commodities omitted",
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "buyPrice": {
                                "description": "Price to buy from the market",
                                "type": "integer"
                            },
                            "demand": {
                                "type": "integer"
                            },
                            "demandBracket": {
                                "$ref": "#/definitions/levelType"
                            },
                            "meanPrice": {
                                "type": "integer"
                            },
                            "name": {
                                "description": "Symbolic name as returned by the Companion API",
                                "minLength": 1,
                                "type": "string"
                            },
                            "sellPrice": {
                                "description": "Price to sell to the market",
                                "type": "integer"
                            },
                            "statusFlags": {
                                "items": {
                                    "minLength": 1,
                                    "type": "string"
                                },
                                "minItems": 1,
                                "type": "array",
                                "_uniqueItems": true
                            },
                            "stock": {
                                "type": "integer"
                            },
                            "stockBracket": {
                                "$ref": "#/definitions/levelType"
                            }
                        },
                        "required": [
                            "name",
                            "meanPrice",
                            "buyPrice",
                            "stock",
                            "stockBracket",
                            "sellPrice",
                            "demand",
                            "demandBracket"
                        ],
                        "type": "object"
                    },
                    "minItems": 1,
                    "type": "array"
                },
                "economies": {
                    "items": {
                        "additionalProperties": false,
                        "properties": {
                            "name": {
                                "description": "Economy type as returned by the Companion API",
                                "minLength": 1,
                                "type": "string"
                            },
                            "proportion": {
                                "type": "number"
                            }
                        },
                        "required": [
                            "name",
                            "proportion"
                        ],
                        "type": "object"
                    },
                    "type": "array"
                },
                "horizons": {
                    "description": "Whether the sending Cmdr has a Horizons pass.",
                    "type": "boolean"
                },
                "marketId": {
                    "type": "number"
                },
                "prohibited": {
                    "items": {
                        "minLength": 1,
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "stationName": {
                    "minLength": 1,
                    "type": "string"
                },
                "systemName": {
                    "minLength": 1,
                    "type": "string"
                },
                "timestamp": {
                    "_format": "date-time",
                    "type": "string"
                }
            },
            "required": [
                "systemName",
                "stationName",
                "marketId",
                "timestamp",
                "commodities"
            ],
            "type": "object"
        }
    },
    "required": [
        "$schemaRef",
        "header",
        "message"
    ],
    "type": "object"
}