{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/7digital/refs/heads/main/json-schema/streaming-platform-playlist-schema.json",
  "title": "Playlist",
  "description": "Playlist schema from 7digital API",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "example": "playlist-789012"
    },
    "name": {
      "type": "string",
      "example": "Morning Run"
    },
    "description": {
      "type": "string",
      "maxLength": 500,
      "example": "High-energy tracks for early-morning runs."
    },
    "visibility": {
      "type": "string",
      "enum": [
        "private",
        "public"
      ],
      "example": "public"
    },
    "userId": {
      "type": "string",
      "nullable": true,
      "example": "500123"
    },
    "trackCount": {
      "type": "integer",
      "example": 24
    },
    "tracks": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "trackId": {
                "type": "string",
                "example": "123456"
              },
              "title": {
                "type": "string",
                "example": "Come Together"
              },
              "artist": {
                "type": "string",
                "example": "The Beatles"
              },
              "source": {
                "type": "string",
                "description": "Source for the physical file (defaults to `7digital`).",
                "example": "7digital"
              },
              "audioUrl": {
                "type": "string",
                "format": "uri",
                "description": "Optional alternative source URL for the physical file.",
                "example": "file://a.specific.file.location.mp3"
              },
              "image": {
                "type": "string",
                "format": "uri",
                "example": "https://artwork-cdn.7static.com/static/img/sleeveart/00/117/000/0011700062_350.jpg"
              }
            },
            "required": [
              "trackId",
              "title",
              "artist"
            ]
          },
          {
            "type": "object",
            "properties": {
              "position": {
                "type": "integer",
                "example": 1
              },
              "addedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2026-05-28T14:30:00Z"
              }
            }
          }
        ]
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "example": "2026-05-28T14:30:00Z"
    },
    "modifiedAt": {
      "type": "string",
      "format": "date-time",
      "example": "2026-05-28T15:00:00Z"
    }
  }
}