{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-playlist-schema.json",
  "title": "Playlist",
  "description": "A playlist with its ordered items.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-playlists-api-openapi.yml#/components/schemas/Playlist",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Playlist id."
    },
    "spaceId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "shuffle": {
      "type": "boolean"
    },
    "fullscreen": {
      "type": "boolean"
    },
    "startsAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Plays only from this date (YYYY-MM-DD) or time, stored as sent."
    },
    "expiresAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Stops after this date (YYYY-MM-DD) or time, stored as sent."
    },
    "approvalState": {
      "type": "string",
      "enum": [
        "draft",
        "pending",
        "approved",
        "rejected"
      ],
      "description": "Only `approved` content airs where the location requires approval."
    },
    "nodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Home location; null = workspace root."
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "deletedAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ]
    },
    "fit": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "contain",
            "cover",
            "fill",
            "blur-fill"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "approvedSnapshot": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Internal: the approved version, as stored JSON text."
    },
    "importSourceId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "recalledAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ]
    },
    "recalledBy": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "usedByScreenCount": {
      "type": "integer"
    },
    "usedByScreens": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "description": "Up to 12 screens playing it."
    },
    "allocations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PlaylistAllocation"
      }
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PlaylistItem"
      }
    },
    "sharedIn": {
      "description": "Present when the playlist is outside your locations and was shared in.",
      "type": "boolean",
      "const": true
    }
  },
  "required": [
    "id",
    "spaceId",
    "name",
    "description",
    "shuffle",
    "fullscreen",
    "startsAt",
    "expiresAt",
    "approvalState",
    "nodeId",
    "createdAt",
    "updatedAt",
    "deletedAt",
    "fit",
    "approvedSnapshot",
    "importSourceId",
    "recalledAt",
    "recalledBy",
    "usedByScreenCount",
    "usedByScreens",
    "allocations",
    "items"
  ],
  "$defs": {
    "PlaylistAllocation": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "ownerKind": {
          "type": "string",
          "enum": [
            "user",
            "group",
            "org-unit"
          ]
        },
        "ownerId": {
          "type": "string"
        },
        "ownerName": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "percent",
            "every-nth",
            "daypart"
          ]
        },
        "value": {
          "type": "integer"
        },
        "endValue": {
          "description": "Absent (not null) when unset.",
          "type": "integer"
        },
        "colorClass": {
          "type": "string"
        },
        "fillSpaceId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "fillPlaylistId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "unfilledBehavior": {
          "type": "string",
          "enum": [
            "collapse",
            "filler",
            "holding"
          ]
        },
        "fillerRefKind": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "media",
                "playlist",
                "app",
                "layout",
                "ad-slot",
                "creative"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "fillerRefId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "requiresApproval": {
          "type": "boolean"
        }
      },
      "required": [
        "id",
        "label",
        "ownerKind",
        "ownerId",
        "ownerName",
        "kind",
        "value",
        "colorClass",
        "fillSpaceId",
        "fillPlaylistId",
        "unfilledBehavior",
        "fillerRefKind",
        "fillerRefId",
        "requiresApproval"
      ],
      "description": "An airtime share of the playlist given to a person, group or location."
    },
    "PlaylistItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Playlist item id."
        },
        "refKind": {
          "type": "string",
          "enum": [
            "media",
            "playlist",
            "app",
            "layout",
            "ad-slot",
            "creative"
          ]
        },
        "refId": {
          "type": "string",
          "description": "The media / app instance / layout / playlist id."
        },
        "name": {
          "type": "string"
        },
        "thumbnailUrl": {
          "type": "string",
          "description": "Empty string when there is none."
        },
        "kind": {
          "type": "string",
          "description": "The media kind for media items; `app`, `layout` or `playlist` otherwise."
        },
        "nestedItemCount": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "description": "Nested playlists only: its top-level item count."
        },
        "nestedShuffle": {
          "description": "Nested playlists only: whether that playlist plays its items in shuffled order.",
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "durationMode": {
          "type": "string",
          "enum": [
            "fixed",
            "full",
            "live",
            "loop",
            "manual"
          ]
        },
        "durationSeconds": {
          "type": "integer",
          "description": "Dwell in seconds for `fixed`."
        },
        "loopCount": {
          "type": "integer"
        },
        "loopDurationMs": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "mediaDurationSec": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "fit": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "contain",
                "cover",
                "fill",
                "blur-fill"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's own fit; null = inherit."
        },
        "assetFit": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "contain",
                "cover",
                "fill",
                "blur-fill"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "assetStartsAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "assetExpiresAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "assetActive": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "fullscreen": {
          "type": "boolean"
        },
        "playOnlyWhenTapped": {
          "type": "boolean",
          "description": "The rotation skips this item; a design's `show-design` tap action shows it."
        },
        "withheld": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "expired",
                "archived",
                "not-yet"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Why a media item is not airing now, or null."
        },
        "allocationId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "position": {
          "type": "integer"
        }
      },
      "required": [
        "id",
        "refKind",
        "refId",
        "name",
        "thumbnailUrl",
        "kind",
        "nestedItemCount",
        "durationMode",
        "durationSeconds",
        "loopCount",
        "loopDurationMs",
        "mediaDurationSec",
        "fit",
        "assetFit",
        "assetStartsAt",
        "assetExpiresAt",
        "assetActive",
        "fullscreen",
        "playOnlyWhenTapped",
        "withheld",
        "allocationId",
        "position"
      ],
      "description": "One item in a playlist, with its display fields resolved. Items whose content was deleted are left out."
    }
  }
}