{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schema.rezkit.app/1.0/product-provider/service-description",
  "type": "object",
  "title": "Service Description",
  "description": "Describes a product provider service and it's capabilities",
  "additionalProperties": false,

  "required": [
    "name",
    "version",
    "services",
    "operations"
  ],

  "properties": {
    "name": {
      "type": "string"
    },

    "version": {
      "type": "string",
      "const": "1.0",
      "description": "Service Description Schema Version."
    },

    "operations": {
      "type": "object",
      "properties": {
        "get_product": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "url": {
              "type": "string"
            }
          }
        }
      }
    },

    "services": {
      "type": "object",
      "additionalProperties": false,

      "properties": {
        "packages": {
          "type": "object",
          "additionalProperties": false,
          "required": ["operations"],
          "properties": {
            "configuration": {
              "type": "object",
              "properties": {
                "package_code_regexp": {
                  "type": "string",
                  "description": "A regexp which describes the format of package codes"
                }
              }
            },

            "operations": {
              "type": "object",
              "additionalProperties": false,
              "required": ["package_search"],
              "properties": {
                "package_list": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                },

                "book_package": {
                  "type": "object",
                  "required": ["url"],
                  "additionalProperties": false,
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                },

                "cancel_booking":  {
                  "type": "object",
                  "required": ["url"],
                  "additionalProperties": false,
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                },

                "get_booking": {
                  "type": "object",
                  "required": ["url"],
                  "additionalProperties": false,
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                },

                "update_booking": {
                  "type": "object",
                  "required": ["url"],
                  "additionalProperties": false,
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                },

                "package_search": {
                  "type": "object",
                  "required": ["url"],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "supported_features": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "departure_date_filter",
                          "package_code_filter",
                          "price_value_filter"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
