required: [ version, songs ]
$defs:
  GWRadioURI:
    type: string
    description: 'A URI that points to the source file. See `GWMediaPlayer.fromURIToAbsolute()` for how to convert to a URL'
  MediaCodec:
    type: string
  MediaCodecs:
    type: array
    description: 'An array of codecs contained within the source file. Items should follow RFC6381'
    items:
    - $ref: "#/$defs/MediaCodec"
properties:
  version: { type: integer }
  songs:
    items:
      required: [ id, sources ]
      properties:
        index:
          type: integer
          description: 'Original song index'
        id:
          type: string
        metadata:
          properties:
            title: { type: string }
            artist: { type: string }
            href:
              $ref: "#/$defs/GWRadioURI" 
              description: 'A URI where the original source can be found, if known. Link may be dead'
            _nigid:
              description: 'The original song id from nigge.rs.'
              type: string
            _nigkey:
              description: 'Content of _id from the original nigge.rs song entry.'
              type: string

        misc:
          type: integer
          description: 'Media bitflags. See BMiscInfo'
        tags:
          description: 'A list of tags used for filtering.'
          type: array
          items:
            anyOf:
            - const: moonman
            - const: metadata-prefer-id
            - regex: '^radio\-media\-style\-[a-z\-]+'
            - type: string

        sources:
          type: array
          items:
          - required: [ type, uri ]
            properties:
              type: { type: string, format: mimetype }
              codecs: { "$ref": "#/$defs/MediaCodecs" }
              uri: { "$ref": "#/$defs/GWRadioURI" }
              previews:
                description: >-
                  This is an array so GWMediaPlayer can better display videos being played as audio only.
                  The first Item is how the MediaItem *should* be displayed, other Items are alternative versions the player may use.
                type: array
                items:
                - properties:
                    display_type:
                      type: integer
                      description: 'Used to determine how the media should be displayed. See EDisplayType'
                    type: { "$ref": "#/$defs/MediaCodec" }
                    codecs: { "$ref": "#/$defs/MediaCodecs" }
                    uri: { "$ref": "#/$defs/GWRadioURI" }
                    size: { type: string }