$schema: http://json-schema.org/draft-04/schema#
type: object

# All of these keys correspond to properties in the Cue object
properties:
  number:
    type: integer
    description: The actual value times 1000, because we use fixed point rather than deal with decimals.

  schedule_at:
    type: string
    default: ''
    description: Natural language recurring schedule, like 'every 2 hours'


  shortcut:
    type: string
    default: ''
    description: A shortcut code used to enter this cue
    section: basic
    icon: arrow-down-circle-outline

  checkpoint:
    type: boolean
    default: false
    description: If true, when entering this cue, save it to disk to jump back later.

  fade_in:
    type: number
    default: 0

  sound_fade_out:
    type: number
    default: 0

  sound_fade_in:
    type: number
    default: 0

  length:
    anyOf:
      - { "type": "number" }
      - { "type": "string" }
    default: 0

  track:
    type: boolean
    default: true
    description: Keep values from previous cues

  next_cue:
    anyOf:
      - { "type": "number" }
      - { "type": "string" }
      - { "type": "null" }
    default: ''

  sound:
    type: string
    default: ''
    icon: music
    section: media

  slide:
    type: string
    default: ''
    section: media

  label_image:
    type: string
    default: ''
    description: An image to represent the cue in the control UI


  notes:
    type: string
    default: ''
    description: Notes intended for the designer or operator.

  markdown:
    type: string
    default: ''
    description: Some rich text that could be displayed in the sidebar

  sound_output:
    type: string
    default: ''

  sound_start_position:
    type: number
    default: 0

  media_speed:
    type: number
    default: 1

  media_wind_up:
    type: number
    default: 0

  media_wind_down:
    type: number
    default: 0
    description: Slow down media at the end for the robot losing power effect

  # Todo: migrate to CamelCase or migrate others to snake_case?
  rel_length:
    type: boolean
    default: false

  reentrant:
    description: "If false, the system will block entering the cue if already in the cue"
    type: boolean
    default: true
    section: basic
    icon: mdi-replay

  length_randomize:
    type: number
    default: 0

  inherit_rules:
    type: string
    default: ''
    section: rules
    icon: script-text-outline

  rules:
    type: array
    default: []

  probability:
    type: string
    default: ''
    description: When the cue is a possibility for random selection, determines the weight.  Unset has weight 1.

  values:
    type: object
    default: {}
    additionalProperties:
      type: object
      additionalProperties:
        anyOf:
          - { "type": "number" }
          - { "type": "string" }
          - { "type": "null" }

  sound_volume:
    anyOf:
      - { "type": "number" }
      - { "type": "string" }
    default: 1

  sound_loops:
    type: integer
    default: 0

  trigger_shortcut:
    type: string
    default: ''

  named_for_sound:
    type: boolean
    default: false

  metadata:
    type: object
    default: {}

required:
  - number