{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "title": "GuidePost TWBK V1.0 schema.",
  "properties": {
    "type": {
      "type": "string",
      "title": "GuidePost type",
      "description": "Describes the underlying regulation/standard.",
      "default": "TWBK",
      "enum": ["TWBK"]
    },
    "locID": {
      "type": "string",
      "title": "Location ID",
      "description": "Location-ID; This ID may be user-defined or derived from a database (e.g. PK).",
    },
    "locDesc": {
      "type": "string",
      "title": "Location description",
      "description": "This member allows to describe the location of the guidepost."
    },
    "locRespons": {
      "type": "string",
      "title": "Location responsibility",
      "description": "Defines the maintenance responsibility for this guidepost-location (not the trail-responsibility !)."
    },
    "locSign": {
      "type": "string",
      "title": "Location sign",
      "description": "In case the guidepost-location should be equipped with a white location-sign."
    },
    "locAltitude": {
      "type": "integer",
      "title": "Location altitude",
      "description": "In case the guidepost-location should be equipped with a white location-sign.",
      "minimum": 0,
      "maximum": 10000

    },
    "locLatitude": {
      "type": "number",
      "title": "Location latitude",
      "description": "Defines the y-position (Latitude) of the guidepost location. The value is required and be defined in decimal-degrees (DD). The CRS has to be GCS-WGS84 (epsg:4326). In case of southern hemisphere negative Latitude-coordinates must be used.",
      "minimum": -90,
      "maximum": 90
    },
    "locLongitude": {
      "type": "number",
      "title": "Location longitude",
      "description": "Defines the x-position (Longitude) of the guidepost location. The value is required and be defined in decimal-degrees (DD). The CRS has to be GCS-WGS84 (epsg:4326). In case of positions west of Greenwich negative Longitude-coordinates must be used.",
      "minimum": -180,
      "maximum": 180
    },
    "ordered": {
      "type": "string",
      "title": "Ordered",
      "description": "he value must be a string defining a date in the notation dd-mm-yyyy.",
      "pattern" : "^[0-9]{1,2}-[0-9]{1,2}-[0-9]{4}$"
    },
    "signs": {
      "type": "array",
      "title": "Signs",
      "description": "The array of objects defines the individual signs on the guidepost-location.",
      "items": {
        "type": "object",
        "title": "Signs schema.",
        "description": "Signs are the fundamental elements of a guidepost.",
        "properties": {
          "signID": {
            "type": "integer",
            "title": "Sign ID",
            "description": "Defines the position (order) of the sign on the guidepost - starting with 1 as the most top one.",
            "default": 1,
            "minimum": 0
          },
          "signRespons": {
            "type": "string",
            "title": "Sign Respons",
            "description": "Trail-Responsibility for the targets on this sign."
          },
          "signDirection": {
            "type": "integer",
            "title": "Sign direction",
            "description": "Direction (arrow) of the sign in coded values.",
            "default": 0,
            "enum": [0,1]
          },
          "signRow": {
            "type": "array",
            "title": "Sign row.",
            "description": "Nested objects defining the dedicated targets of the sign. Has to be at least one and at most three.",
            "minimum": 1,
            "maximum": 3,
            "items": {
              "type": "object",
              "title": "Sign row schema",
              "properties": {
                "rowID": {
                  "type": "integer",
                  "title": "Row ID",
                  "description": "Defines the target's position on the sign. Starting with 1 as the most top one.",
                  "default": 1,
                  "minimum": 1,
                  "maximum": 3
                },
                "targetName": {
                  "type": "string",
                  "title": "Target name",
                  "description": "Name of a target the dedicated sign is guiding to. "
                },
                "subTarget": {
                  "type": "string",
                  "title": "Subtarget name",
                  "description": "Optional second line (smaller letters) with reference to the target."
                },
                "targetType": {
                  "type": "array",
                  "title": "Target type",
                  "description": "Symbols ('Piktogramm') with reference to the target.",
                  "items": {
                    "type": "integer"
                  },
                  "minimum": 0
                },
                "targetTime": {
                  "type": "string",
                  "title": "Target time",
                  "description": "Time to reach the target.",
                  "pattern": "^[0-9]{2}:[0-9]{2}$",
                },
                "routeID": {
                  "type": "array",
                  "title": "route ID",
                  "description": "Official numbers of the trail(s) to the dedicated target. ",
                  "items": {
                    "type": "string"
                  },
                  "minimum": 0,
                  "maximum": 3
                },
                "targetDifficulty": {
                  "type": "integer",
                  "title": "Target difficulty",
                  "description": "Describes the hiker's requirements to reach the target based on the trail specifications described in TWBK.",
                  "default": 0,
                  "enum": [0,1,2,3,4]
                }
              },
              "required": [
                "targetName",
                "targetDifficulty"
              ]
            }
          }
        },
        "required": [
          "signID",
          "signDirection",
          "signRow"
        ]
      }
    }
  },
  "required": [
    "type",
    "locID",
    "locLatitude",
    "locLongitude"
  ]
}
