{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-ad-slot-schema.json",
  "title": "AdSlot",
  "description": "A slot that fills airtime from a programmatic ad server.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-ad-slots-api-openapi.yml#/components/schemas/AdSlot",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "spaceId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "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)."
    },
    "config": {
      "anyOf": [
        {
          "$ref": "#/$defs/AdSlotConfig"
        },
        {
          "type": "null"
        }
      ],
      "description": "Null when the stored settings cannot be read."
    },
    "secretRefs": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Secret names that hold a value. Values are never returned. The single-slot reads fill this; the list answers `[]`."
    }
  },
  "required": [
    "id",
    "spaceId",
    "name",
    "enabled",
    "nodeId",
    "createdAt",
    "updatedAt",
    "config",
    "secretRefs"
  ],
  "$defs": {
    "AdSlotConfig": {
      "type": "object",
      "properties": {
        "provider": {
          "type": "string",
          "enum": [
            "vast",
            "vistar",
            "broadsign",
            "hivestack"
          ]
        },
        "endpoint": {
          "type": "string",
          "description": "The ad server URL (http or https, a public host)."
        },
        "credsRef": {
          "type": "string",
          "description": "The name of the secret (set with `PUT /v1/ad-slots/:id/secrets`) that holds the ad server credential."
        },
        "venueId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "deviceTypeId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "minSeconds": {
          "type": "integer",
          "description": "Shortest ad to accept, 1–300 (default 5)."
        },
        "maxSeconds": {
          "type": "integer",
          "description": "Longest ad to accept, at least `minSeconds`."
        },
        "podSeconds": {
          "type": "integer",
          "description": "Seconds of ads per break, at least `maxSeconds`."
        },
        "allowAudio": {
          "type": "boolean"
        },
        "vistar": {
          "description": "Vistar settings. Only for `provider` = `vistar`. The endpoint is fixed by `environment`.",
          "type": "object",
          "properties": {
            "environment": {
              "type": "string",
              "enum": [
                "staging",
                "production"
              ],
              "description": "Which Vistar network the slot talks to. Staging and production use separate credentials."
            },
            "spots": {
              "type": "integer",
              "description": "Open spots requested per visit to the pod, 1–12. Each spot is one request and at most one ad."
            },
            "staticSeconds": {
              "type": "integer",
              "description": "Seconds a still image plays, 1–60."
            }
          },
          "required": [
            "environment",
            "spots",
            "staticSeconds"
          ]
        }
      },
      "required": [
        "provider",
        "endpoint",
        "credsRef",
        "minSeconds",
        "maxSeconds",
        "podSeconds",
        "allowAudio"
      ]
    }
  }
}