{
    "title": "V2.1.1\\Common",
    "definitions": {
        "credentials": {
            "type": "object",
            "properties": {
                "token": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                },
                "url": {
                    "type": "string",
                    "format": "uri"
                },
                "business_details": {
                    "$ref": "common.schema.json#/definitions/business_details"
                },
                "party_id": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 3
                },
                "country_code": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2
                }
            },
            "additionalProperties": false
        },
        "status_code": {
            "type": "integer"
        },
        "status_message": {
            "type": [
                "string",
                "null"
            ]
        },
        "timestamp": {
            "type": "string",
            "pattern": "^([0-9]{4})-(1[0-2]|0[0-9])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](Z|[-+](0[0-9]|1[0-4]):[0-5][0-9])?$"
        },
        "business_details": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                },
                "website": {
                    "type": [
                        "string",
                        "null"
                    ],
                    "format": "uri"
                },
                "logo": {
                    "oneOf": [
                        {
                            "type": "null"
                        },
                        {
                            "$ref":"#/definitions/image"
                        }
                    ]
                }
            },
            "required": [
                "name"
            ],
            "additionalProperties": false
        },
        "evse_status": {
            "type": "string",
            "enum": [
                "AVAILABLE",
                "BLOCKED",
                "CHARGING",
                "INOPERATIVE",
                "OUTOFORDER",
                "PLANNED",
                "REMOVED",
                "RESERVED",
                "UNKNOWN"
            ]
        },
        "exceptional_period": {
            "type": "object",
            "properties": {
                "period_begin": {
                    "$ref": "#/definitions/timestamp"
                },
                "period_end": {
                    "$ref": "#/definitions/timestamp"
                }
            },
            "required": [
                "period_begin",
                "period_end"
            ],
            "additionalProperties": false
        },
        "hours": {
            "type": "object",
            "properties": {
                "regular_hours": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "$ref": "#/definitions/regular_hours"
                    }
                },
                "twentyfourseven": {
                    "type": "boolean"
                },
                "exceptional_openings": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "$ref": "#/definitions/exceptional_period"
                    }
                },
                "exceptional_closings": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "$ref": "#/definitions/exceptional_period"
                    }
                }
            },
            "additionalProperties": false
        },
        "image": {
            "type": "object",
            "properties": {
                "url": {
                    "type": "string",
                    "format": "uri"
                },
                "thumbnail": {
                    "type": [
                        "string",
                        "null"
                    ],
                    "format": "uri"
                },
                "category": {
                    "type": "string",
                    "enum": [
                        "CHARGER",
                        "ENTRANCE",
                        "LOCATION",
                        "NETWORK",
                        "OPERATOR",
                        "OTHER",
                        "OWNER"
                    ]
                },
                "type": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4
                },
                "width": {
                    "type": [
                        "integer",
                        "null"
                    ]
                },
                "height": {
                    "type": [
                        "integer",
                        "null"
                    ]
                }
            },
            "required": [
                "url",
                "category",
                "type"
            ],
            "additionalProperties": false
        },
        "latitude": {
            "type": "string",
            "minLength": 1,
            "maxLength": 10,
            "pattern": "^-?[0-9]{1,2}\\.[0-9]{6}$"
        },
        "longitude": {
            "type": "string",
            "minLength": 1,
            "maxLength": 11,
            "pattern": "^-?[0-9]{1,3}\\.[0-9]{6}$"
        },
        "geo_location": {
            "type": "object",
            "properties": {
                "latitude": {
                    "$ref": "#/definitions/latitude"
                },
                "longitude": {
                    "$ref": "#/definitions/longitude"
                }
            },
            "additionalProperties": false
        },
        "display_text": {
            "type": "object",
            "properties": {
                "language": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 2,
                    "pattern": "^[A-Za-z]{2}$"
                },
                "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512
                }
            },
            "required": [
                "language",
                "text"
            ],
            "additionalProperties": false
        },
        "regular_hours": {
            "type": "object",
            "properties": {
                "weekday": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 7
                },
                "period_begin": {
                    "type": "string",
                    "pattern": "[0-2][0-9]:[0-5][0-9]"
                },
                "period_end": {
                    "type": "string",
                    "pattern": "[0-2][0-9]:[0-5][0-9]"
                }
            },
            "additionalProperties": false
        },
        "related_locations": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "latitude": {
                        "$ref": "#/definitions/latitude"
                    },
                    "longitude": {
                        "$ref": "#/definitions/longitude"
                    },
                    "name": {
                        "$ref": "#/definitions/display_text"
                    }
                }
            }
        },
        "energy_mix": {
            "type": "object",
            "properties": {
                "is_green_energy": {
                    "type": "boolean"
                },
                "energy_sources": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "object",
                        "properties": {
                            "source": {
                                "type": "string",
                                "enum": [
                                    "NUCLEAR",
                                    "GENERAL_FOSSIL",
                                    "COAL",
                                    "GAS",
                                    "GENERAL_GREEN",
                                    "SOLAR",
                                    "WIND",
                                    "WATER"
                                ]
                            },
                            "percentage": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 100
                            }
                        },
                        "required": [
                            "source",
                            "percentage"
                        ],
                        "additionalProperties": false
                    }
                },
                "environ_impact": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "object",
                        "properties": {
                            "source": {
                                "type": "string",
                                "enum": [
                                    "NUCLEAR_WASTE",
                                    "CARBON_DIOXIDE"
                                ]
                            },
                            "amount": {
                                "type": "number"
                            }
                        },
                        "required": [
                            "source",
                            "amount"
                        ],
                        "additionalProperties": false
                    }
                },
                "supplier_name": {
                    "type": [
                        "string",
                        "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                },
                "energy_product_name": {
                    "type": [
                        "string",
                        "null"
                    ],
                    "minLength": 1,
                    "maxLength": 64
                }
            },
            "required": [
                "is_green_energy"
            ],
            "additionalProperties": false
        },
        "charging_period": {
            "type": "object",
            "properties": {
                "start_date_time": {
                    "type": "string"
                },
                "dimensions": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "ENERGY",
                                    "FLAT",
                                    "MAX_CURRENT",
                                    "MIN_CURRENT",
                                    "PARKING_TIME",
                                    "TIME"
                                ]
                            },
                            "volume": {
                                "type": "number"
                            }
                        },
                        "required": [
                            "type",
                            "volume"
                        ],
                        "additionalProperties": false
                    }
                }
            },
            "required": [
                "start_date_time",
                "dimensions"
            ],
            "additionalProperties": false
        },
        "location_references": {
            "type": "object",
            "properties": {
                "location_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 39
                },
                "evse_uids": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 39
                    }
                },
                "connector_ids": {
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 39
                    }
                }
            },
            "required": [
                "location_id"
            ]
        },
        "version": {
            "type": "string",
            "enum": [
                "2.0",
                "2.1",
                "2.1.1"
            ]
        }
    }
}