$schema: http://json-schema.org/draft-07/schema#
$id: https://github.com/lsst-ts/ts_atspec/blob/master/schema/ATSpectrograph.yaml
# title must end with one or more spaces followed by the schema version, which must begin with "v"
title: ATSpectrograph v3
description: Schema for ATSpectrograph configuration files
type: object
properties:
  instrument_port:
    description: The port on which the instrument mounted on the telescope
    type: number
  host:
    description: IP of the controller
    type: string
  port:
    decription: Port for the controller
    type: integer
  min_pos:
    decription: Minimum position for the linear stage (in mm).
    type: number
  max_pos:
    decription: Maximum position for the linear stage (in mm).
    type: number
  tolerance:
    decription: Tolerance for positioning the linear stage.
    type: number

  filters:
    type: object
    properties:
      filter_name:
        decription: Currently installed filter names.
        type: array
        uniqueItems: true
        items:
          type: string
        minItems: 4
        maxItems: 4

      central_wavelength_filter:
        description: >
          Wavelength for which optical system will be opimized in units of nm. Approximations are sufficient as the
          focus dependence on wavelength is weak.
        type: array
        items:
          type: number
        minItems: 4
        maxItems: 4

      offset_focus_filter:
        description: >
          Focus offset to be applied on the secondary mirror in units of um, relative to no glass being installed.
          Positive values push the secondary down and increase the back focal distance, therefore adding glass
          thickness will result in positive focus offsets.
        type: array
        uniqueItems: false
        items:
          type: number
        minItems: 4
        maxItems: 4

      offset_pointing_filter:
        description: >
          Pointing offset to be applied to the telescope in units of arcseconds, relative to no glass being installed.
          Relative to the center of the detector, positive Y-values result in the star moving up an amplifier,
          positive X-values result in moving along rows, to higher pixel values.
        type: object
        properties:
          x:
            type: array
            uniqueItems: false
            items:
              type: number
            minItems: 4
            maxItems: 4
            description: X-offset in arcseconds.
          y:
            type: array
            uniqueItems: false
            items:
              type: number
            minItems: 4
            maxItems: 4
            description: Y-offset in arcseconds.


  gratings:
    type: object
    properties:
      grating_name:
        decription: Currently installed grating names.
        type: array
        uniqueItems: true
        items:
          type: string
        minItems: 4
        maxItems: 4
      offset_focus_grating:
        description: >
          Focus offset to be applied on the secondary mirror in units of um, relative to no glass being installed.
          Positive values push the secondary down and increase the back focal distance, therefore adding glass
          thickness will result in positive focus offsets.
        type: array
        uniqueItems: false
        items:
          type: number
        minItems: 4
        maxItems: 4
      offset_pointing_grating:
        description: >
          Pointing offset to be applied to the telescope in units of arcseconds, relative to no glass being installed.
          Relative to the center of the detector, positive Y-values result in the star moving up an amplifier,
          positive X-values result in moving along rows, to higher pixel values.
        type: object
        properties:
          x:
            type: array
            uniqueItems: false
            items:
              type: number
            minItems: 4
            maxItems: 4
            description: X-offset in arcseconds.
          y:
            type: array
            uniqueItems: false
            items:
              type: number
            minItems: 4
            maxItems: 4
            description: Y-offset in arcseconds.


additionalProperties: false
