# EOAP Schemas (c) 2024-2025
# 
# EOAP Schemas is licensed under
# Creative Commons Attribution-ShareAlike 4.0 International.
#
# You should have received a copy of the license along with this work.
# If not, see <https://creativecommons.org/licenses/by-sa/4.0/>.

# Geometry
# https://geojson.org/schema/Geometry.json

- type: enum
  name: PointType
  symbols:
  - Point

- type: record
  name: Point
  fields:
  - type: PointType
    name: type
  - type:
      type: array
      items: double
    name: coordinates
  - type:
      type: array
      items: double
    name: bbox

- type: enum
  name: LineStringType
  symbols:
  - LineString

- type: record
  name: LineString
  fields:
  - type: LineStringType
    name: type
  - type:
      type: array
      items: double
    name: coordinates
  - type:
      type: array
      items: double
    name: bbox

- type: enum
  name: PolygonType
  symbols:
  - Polygon

- type: record
  name: Polygon
  fields:
  - type: PolygonType
    name: type
  - type:
      type: array
      items:
        type: array
        items: double
    name: coordinates
  - type:
      type: array
      items: double
    name: bbox

- type: enum
  name: MultiPointType
  symbols:
  - MultiPoint

- type: record
  name: MultiPoint
  fields:
  - type: MultiPointType
    name: type
  - type:
      type: array
      items:
        type: array
        items: double
    name: coordinates
  - type:
      type: array
      items: double
    name: bbox

- type: enum
  name: MultiLineStringType
  symbols:
  - MultiLineString

- type: record
  name: MultiLineString
  fields:
  - type: MultiLineStringType
    name: type
  - type:
      type: array
      items:
        type: array
        items:
          type: array
          items: double
    name: coordinates
  - type:
      type: array
      items: double
    name: bbox

- type: enum
  name: MultiPolygonType
  symbols:
  - MultiPolygon

- type: record
  name: MultiPolygon
  fields:
  - type: MultiPolygonType
    name: type
  - type:
      type: array
      items:
        type: array
        items:
          type: array
          items:
            type: array
            items: double
    name: coordinates
  - type:
      type: array
      items: double
    name: bbox

# Feature
# https://geojson.org/schema/Feature.json

- type: enum
  name: FeatureType
  symbols:
  - Feature

- type: record
  name: Feature
  fields:
  - type: FeatureType
    name: type
  - name: id
    type: string
    doc: "Identifier"
  - type: 
    - Point
    - LineString
    - Polygon
    - MultiPoint
    - MultiLineString
    - MultiPolygon
    name: geometry
  - type:
      type: array
      items: double
    name: bbox

- type: enum
  name: GeometryCollectionType
  symbols:
  - GeometryCollection

- type: record
  name: GeometryCollection
  fields:
  - type: GeometryCollectionType
    name: type
#    type: array
#    items:
#    - type: Point
#    - type: LineString
#    - type: Polygon
#    - type: MultiPoint
#    - type: MultiLineString
#    - type: MultiPolygon
#    name: geometries
  - type:
      type: array
      items: double
    name: bbox


# from https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/link.yaml

- type: record
  name: Link
  fields:
  - type: string
    name: href
    doc: "i.e. http://data.example.com/buildings/123"
  - type: string
    name: rel
    doc: "i.e. alternate"
  - type: string
    name: type
    doc: "i.e. application/geo+json"
  - type: string
    name: hreflang
    doc: "i.e. en"
  - type: string
    name: title
    doc: "i.e. Trierer Strasse 70, 53115 Bonn"
  - type: int
    name: length

# from https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/featureCollectionGeoJSON.yaml

- type: enum
  name: FeatureCollectionType
  symbols:
  - FeatureCollection

- type: record
  name: FeatureCollection
  fields:
  - type: FeatureCollectionType
    name: type
  - type:
      type: array
      items: Feature
    name: features
  - type:
      type: array
      items: Link
    name: links
  - type: string
    name: timeStamp
  - type: int
    name: numberMatched
  - type: int
    name: numberReturned