{
    "title": "Order connection request v1",
    "description": "Order a connection consisting of a carrier, one or more circuits and an SLA",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "https://api.nextpertise.nl/schemas/broadband/order_connection_request_v1.json",
    "allOf": [
        {
            "title": "Location",
            "description": "Defines a location through zipcode/housenr combination.",
            "type": "object",
            "properties": {
                "zipcode": {
                    "title": "Zipcode",
                    "description": "The zipcode must conform to the Dutch postcode format. Note that the initial digit is not allowed to be '0' unless when testing.",
                    "type": "string",
                    "pattern": "^[0-9]{4}[A-Z]{2}$"
                },
                "housenr": {
                    "title": "House number",
                    "description": "The house number that with the zipcode identifies an address.",
                    "type": "number",
                    "maximum": 99999
                },
                "housenrext": {
                    "title": "Extended house number",
                    "description": "House number suffix.",
                    "type": [
                        "string",
                        "null"
                    ],
                    "maxLength": 10
                }
            },
            "required": [
                "housenr",
                "zipcode"
            ]
        },
        {
            "type": "object",
            "properties": {
                "isra": {
                    "description": "Copy from the `connectionpoint` name off the :doc:`../broadband/zipcode` reply.",
                    "type": [
                        "string",
                        "null"
                    ],
                    "pattern": "^[0-9a-zA-Z/(). -_?]*$"
                },
                "carrier": {
                    "title": "Product ID",
                    "description": "Identifies an individual product by numeric id.",
                    "type": [
                        "integer",
                        "one of"
                    ],
                    "minimum": 0
                },
                "circuit": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "circuit": {
                                "title": "Product ID",
                                "description": "Identifies an individual product by numeric id.",
                                "type": [
                                    "integer",
                                    "one of"
                                ],
                                "minimum": 0
                            },
                            "tags": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "pattern": "[a-zA-Z0-9\\/=:_-]+"
                                }
                            },
                            "vlan": {
                                "type": "integer"
                            },
                            "vci": {
                                "type": "integer"
                            },
                            "vpi": {
                                "type": "integer"
                            }
                        },
                        "required": [
                            "circuit"
                        ]
                    }
                },
                "sla": {
                    "oneOf": [
                        {
                            "type": [
                                "null",
                                "one of"
                            ]
                        },
                        {
                            "title": "Product ID",
                            "description": "Identifies an individual product by numeric id.",
                            "type": [
                                "integer",
                                "one of"
                            ],
                            "minimum": 0
                        }
                    ],
                    "type": "one of"
                },
                "cpe": {
                    "type": "array",
                    "items": {
                        "title": "Product ID",
                        "description": "Identifies an individual product by numeric id.",
                        "type": [
                            "integer",
                            "one of"
                        ],
                        "minimum": 0
                    }
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string",
                        "pattern": "[a-zA-Z0-9\\/=:_-]+"
                    }
                },
                "enduser": {
                    "type": "object",
                    "properties": {
                        "uuid": {
                            "type": "string"
                        }
                    }
                },
                "contact_name": {
                    "type": "string"
                },
                "contact_phonenumber": {
                    "title": "Telephone number",
                    "description": "Dutch national telephone number",
                    "type": [
                        "string",
                        "null"
                    ],
                    "pattern": "^0([1-7][0-9]|85|88)[0-9]{7}$"
                },
                "contact_email": {
                    "type": [
                        "string",
                        "null"
                    ],
                    "pattern": "(^[a-zA-Z0-9_.+-/*]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)"
                },
                "contract_duration": {
                    "type": "integer",
                    "enum": [
                        12,
                        24,
                        36,
                        48,
                        60
                    ]
                },
                "additional_contact_phonenumber": {
                    "title": "Telephone number",
                    "description": "Dutch national telephone number",
                    "type": [
                        "string",
                        "null"
                    ],
                    "pattern": "^0([1-7][0-9]|85|88)[0-9]{7}$"
                },
                "confirm": {
                    "type": "object",
                    "properties": {
                        "Terminate Voice": {
                            "type": "boolean"
                        }
                    }
                },
                "custwishdate": {
                    "title": "Optional date",
                    "description": "Optional date in international format YYYY-MM-DD",
                    "oneOf": [
                        {
                            "title": "Date",
                            "description": "Date in international format YYYY-MM-DD",
                            "type": [
                                "string",
                                "null"
                            ],
                            "pattern": "^[1-9][0-9]{3}-[01][0-9]-[0-3][0-9]$"
                        },
                        {
                            "type": [
                                "null",
                                "one of"
                            ]
                        }
                    ],
                    "type": "one of"
                },
                "requested_phonenumber": {
                    "title": "Telephone number",
                    "description": "Dutch national telephone number",
                    "type": [
                        "string",
                        "null"
                    ],
                    "pattern": "^0([1-7][0-9]|85|88)[0-9]{7}$"
                },
                "serviceid": {
                    "title": "Service ID",
                    "description": "Service label, matches the carrier's nid when the service is provided by Nextpertise.",
                    "type": [
                        "null",
                        "string"
                    ]
                },
                "shipping_address": {
                    "allOf": [
                        {
                            "title": "Address",
                            "description": "A complete address.",
                            "allOf": [
                                {
                                    "title": "Location",
                                    "description": "Defines a location through zipcode/housenr combination.",
                                    "type": "object",
                                    "properties": {
                                        "zipcode": {
                                            "title": "Zipcode",
                                            "description": "The zipcode must conform to the Dutch postcode format. Note that the initial digit is not allowed to be '0' unless when testing.",
                                            "type": "string",
                                            "pattern": "^[0-9]{4}[A-Z]{2}$"
                                        },
                                        "housenr": {
                                            "title": "House number",
                                            "description": "The house number that with the zipcode identifies an address.",
                                            "type": "number",
                                            "maximum": 99999
                                        },
                                        "housenrext": {
                                            "title": "Extended house number",
                                            "description": "House number suffix.",
                                            "type": [
                                                "string",
                                                "null"
                                            ],
                                            "maxLength": 10
                                        }
                                    },
                                    "required": [
                                        "housenr",
                                        "zipcode"
                                    ]
                                },
                                {
                                    "title": "Extended location",
                                    "description": "Extends a location with street and city references.",
                                    "type": "object",
                                    "properties": {
                                        "street": {
                                            "description": "The street name.",
                                            "title": "Optional string",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "city": {
                                            "description": "The city name.",
                                            "title": "Optional string",
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        }
                                    },
                                    "required": [
                                        "street",
                                        "city"
                                    ]
                                }
                            ],
                            "type": "all of"
                        },
                        {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                },
                                "company": {
                                    "type": "string"
                                }
                            },
                            "required": [
                                "name",
                                "company"
                            ]
                        }
                    ],
                    "type": "all of"
                }
            },
            "required": [
                "carrier",
                "circuit",
                "sla",
                "enduser",
                "contact_name",
                "contact_phonenumber",
                "contract_duration"
            ]
        }
    ],
    "type": "all of"
}