{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-location-schema.json",
  "title": "Location",
  "description": "A location in the workspace tree (an org node).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-org-nodes-api-openapi.yml#/components/schemas/Location",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Location (org node) id."
    },
    "name": {
      "type": "string"
    },
    "parentId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Parent location; null for the workspace root."
    },
    "externalId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Your own location code (store number, region code). Unique in the workspace."
    },
    "timezone": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "IANA zone screens here inherit, e.g. `America/Chicago`."
    },
    "tier": {
      "type": "integer",
      "description": "Depth: 1 = the workspace root."
    },
    "isSpace": {
      "type": "boolean",
      "description": "True for a workspace (Space) boundary: the root, or a franchise child workspace."
    },
    "payment": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "awaiting",
            "live"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "A location that pays for itself: `awaiting` (its screens wait on the hold card for its card), `live` (its own payer pays). Null when the account pays."
    },
    "paymentTrial": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "card_added",
            "no_card"
          ]
        },
        {
          "type": "null"
        }
      ],
      "description": "While the account is in its free trial the location plays like any trial location: `card_added` (its year starts when the trial ends) or `no_card` (it waits on the hold card from then). Null outside the trial."
    },
    "screenCount": {
      "type": "integer",
      "description": "Screens placed directly at this location (not its children)."
    },
    "members": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string"
          },
          "userName": {
            "type": "string"
          },
          "roleId": {
            "type": "string"
          },
          "roleName": {
            "type": "string"
          },
          "roleColor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "`sso:<connectionId>` when an identity provider granted this; null when granted in Brix."
          }
        },
        "required": [
          "userId",
          "userName",
          "roleId",
          "roleName",
          "roleColor",
          "source"
        ]
      },
      "description": "People granted a role at this location."
    },
    "featureOverrides": {
      "description": "Owner-set feature overrides, as stored (normally an array)."
    },
    "approval": {
      "$ref": "#/$defs/ApprovalPolicy"
    },
    "billing": {
      "description": "Owner-set billing metadata as stored, or null."
    },
    "prefs": {
      "$ref": "#/$defs/LocationPrefs"
    }
  },
  "required": [
    "id",
    "name",
    "parentId",
    "externalId",
    "timezone",
    "tier",
    "isSpace",
    "payment",
    "paymentTrial",
    "screenCount",
    "members",
    "featureOverrides",
    "approval",
    "billing",
    "prefs"
  ],
  "$defs": {
    "ApprovalPolicy": {
      "type": "object",
      "properties": {
        "required": {
          "type": "boolean"
        },
        "inheritFromParent": {
          "type": "boolean"
        },
        "escalateUpTiers": {
          "type": "boolean"
        },
        "allowSharedExemptions": {
          "type": "boolean"
        },
        "approvers": {
          "description": "User ids named as approvers.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": {},
      "description": "The location's content-approval policy, as stored. New locations inherit `{required:false, inheritFromParent:true, …}`."
    },
    "LocationPrefs": {
      "type": "object",
      "properties": {
        "location": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "lat": {
                  "type": "number"
                },
                "lng": {
                  "type": "number"
                }
              },
              "required": [
                "label",
                "lat",
                "lng"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "Physical place screens here inherit (drives weather and other location-aware apps)."
        },
        "language": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "BCP 47 tag screens here inherit, e.g. `de-DE`."
        },
        "defaultContent": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string",
                  "enum": [
                    "playlist",
                    "schedule",
                    "layout",
                    "creative",
                    "app",
                    "media",
                    "signage"
                  ]
                },
                "id": {
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "id"
              ]
            },
            {
              "type": "null"
            }
          ],
          "description": "What screens here play when they have no content of their own."
        }
      },
      "required": [
        "location",
        "language",
        "defaultContent"
      ],
      "description": "Inheritable per-location settings (nearest ancestor wins)."
    }
  }
}