{
  "$id": "https://namespace.lantmateriet.se/distribution/geodatakatalog/sokning/v1/stompunkt/v1/stompunkt-ref-1.0.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Stompunkt Referens 1.0",
  "oneOf": [
    {
      "$ref": "#/$defs/stompunkt"
    },
    {
      "$ref": "#/$defs/stomnat"
    }
  ],
  "$defs": {
    "stompunkt": {
      "type": "object",
      "properties": {
        "feature": {
          "$ref": "#/$defs/attributFeatureStompunkt"
        },
        "stompunkt": {
          "$ref": "#/$defs/attributStompunkt"
        }
      },
      "required": [
        "feature",
        "stompunkt"
      ],
      "additionalProperties": false
    },
    "attributFeatureStompunkt": {
      "type": "object",
      "properties": {
        "typ": {
          "const": "stompunkt"
        },
        "etikett": {
          "type": "string"
        }
      },
      "required": [
        "typ",
        "etikett"
      ],
      "additionalProperties": false
    },
    "attributStompunkt": {
      "type": "object",
      "properties": {
        "objektidentitet": {
          "type": "string",
          "format": "uuid"
        },
        "punktnummer": {
          "type": "string"
        },
        "namn": {
          "type": "string"
        },
        "identiskMed": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "format": "uuid"
          }
        },
        "stompunktstyp": {
          "$ref": "#/$defs/dimensionstyp"
        },
        "markering": {
          "$ref": "#/$defs/markeringstyp"
        },
        "markeringsunderlag": {
          "$ref": "#/$defs/markeringsunderlag"
        },
        "absolutLagesosakerhetIPlan": {
          "type": "number"
        },
        "absolutLagesosakerhetIHojd": {
          "type": "number"
        },
        "variantLagesbestamningsmetodIPlan": {
          "type": "string"
        },
        "variantLagesbestamningsmetodIHojd": {
          "type": "string"
        },
        "kommunkod": {
          "$ref": "#/$defs/kommunkod"
        },
        "ejAterfunnen": {
          "type": "boolean"
        },
        "forstord": {
          "type": "boolean"
        },
        "kvalitetsklassPlan": {
          "type": "string"
        },
        "kvalitetsklassHojd": {
          "type": "string"
        },
        "kategori": {
          "$ref": "#/$defs/punktkategori"
        },
        "aldreHojd": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/aldreHojd"
          }
        },
        "stomnat": {
          "type": "string",
          "format": "uuid"
        }
      },
      "required": [
        "objektidentitet",
        "punktnummer",
        "stompunktstyp",
        "markering",
        "markeringsunderlag",
        "kommunkod",
        "ejAterfunnen",
        "forstord",
        "stomnat"
      ],
      "additionalProperties": false
    },
    "aldreHojd": {
      "type": "object",
      "properties": {
        "hojdsystem": {
          "type": "string"
        },
        "hojd": {
          "type": "number"
        }
      },
      "required": [
        "hojdsystem",
        "hojd"
      ],
      "additionalProperties": false
    },
    "stomnat": {
      "type": "object",
      "properties": {
        "feature": {
          "$ref": "#/$defs/attributFeatureStomnat"
        },
        "stomnat": {
          "$ref": "#/$defs/attributStomnat"
        }
      },
      "required": [
        "feature",
        "stomnat"
      ],
      "additionalProperties": false
    },
    "attributFeatureStomnat": {
      "type": "object",
      "properties": {
        "typ": {
          "const": "stomnät"
        },
        "etikett": {
          "type": "string"
        }
      },
      "required": [
        "typ",
        "etikett"
      ],
      "additionalProperties": false
    },
    "attributStomnat": {
      "type": "object",
      "properties": {
        "objektidentitet": {
          "type": "string",
          "format": "uuid"
        },
        "namn": {
          "type": "string"
        },
        "agare": {
          "$ref": "#/$defs/organisation"
        },
        "anmarkning": {
          "type": "string",
          "queryable": false
        }
      },
      "required": [
        "objektidentitet",
        "namn",
        "agare"
      ],
      "additionalProperties": false
    },
    "organisation": {
      "type": "object",
      "properties": {
        "organisationsnamn": {
          "type": "string",
          "queryable": false
        },
        "organisationsnummer": {
          "type": "string",
          "queryable": false
        }
      },
      "additionalProperties": false
    },
    "stompunktstyp": {
      "type": "string",
      "enum": [
        "plan",
        "höjd",
        "plan och höjd"
      ]
    },
    "kommunkod": {
      "type": "string",
      "pattern": "^[0-9]{4}$"
    },
    "markeringstyp": {
      "type": "string",
      "enum": [
        "rör",
        "järn i rör",
        "dubb",
        "spik",
        "hål",
        "bult",
        "spira",
        "prisma",
        "polyfix",
        "stång",
        "ring",
        "T-märke",
        "I-märke",
        "Y-märke",
        "annan",
        "okänd",
        "plus"
      ]
    },
    "markeringsunderlag": {
      "type": "string",
      "enum": [
        "mark",
        "berg",
        "sten",
        "gjutning",
        "byggnad",
        "tak inkl. torn",
        "mur",
        "asfalt",
        "annat",
        "okänt"
      ]
    },
    "dimensionstyp": {
      "type": "string",
      "enum": [
        "plan",
        "höjd",
        "plan och höjd"
      ]
    },
    "punktkategori": {
      "type": "string",
      "enum": [
        "anslutningspunkt",
        "brukspunkt",
        "riksnätpunkt"
      ]
    }
  }
}