{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://barncleuth.com/schema/board-setup-v1.json",
  "title": "Barncleuth board setup, version 1",
  "description": "One file that sets up a Barncleuth Workstation board: brands with their channel links and profile pictures, departments, each bot's name, description, department and logo, alert timing, and trading on or off. The owner pastes it into Settings (or their AI sends it with the setup key), sees every change, then applies it. It only adds and changes: anything the file leaves out stays as it is, and nothing is deleted. It never holds passwords, keys, sign-in details or payment details.",
  "type": "object",
  "required": [
    "version"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Optional: this schema's address."
    },
    "version": {
      "const": "board-setup/v1",
      "description": "Always \"board-setup/v1\"."
    },
    "brands": {
      "type": "array",
      "maxItems": 40,
      "description": "Brands, matched to the board's brands by name (capitals don't matter). A name the board doesn't have yet is added; an archived brand with that name is shown again.",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 40,
            "description": "The brand's name, as people know it. Plain text: no web addresses or tags."
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[A-Za-z0-9]{1,8}$",
            "description": "Optional short code, up to 8 letters and digits, such as HI60. Bots' reports can use it instead of the name. Unique among the owner's brands."
          },
          "colour": {
            "type": "string",
            "pattern": "^#[0-9A-Fa-f]{6}$",
            "description": "Optional accent colour, as a hex value like #3462F0."
          },
          "audience": {
            "enum": [
              "general",
              "kids"
            ],
            "description": "Optional. \"kids\" marks it Made for kids: its card shows no outbound links."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "description": "The brand's channels. Each takes the full https address or the handle, and only its own platform's address. An empty string removes that link.",
            "properties": {
              "youtube": {
                "type": "string",
                "maxLength": 300,
                "description": "https://www.youtube.com/channel/UC… (best: YouTube's numbers then come by the channel id), https://www.youtube.com/@handle, or @handle."
              },
              "instagram": {
                "type": "string",
                "maxLength": 300,
                "description": "https://www.instagram.com/handle/ or @handle."
              },
              "tiktok": {
                "type": "string",
                "maxLength": 300,
                "description": "https://www.tiktok.com/@handle or @handle."
              },
              "facebook": {
                "type": "string",
                "maxLength": 300,
                "description": "https://www.facebook.com/page-name or the page's number."
              },
              "x": {
                "type": "string",
                "maxLength": 300,
                "description": "https://x.com/handle or @handle."
              },
              "web": {
                "type": "string",
                "maxLength": 300,
                "description": "The brand's own website, https only."
              }
            }
          },
          "picture": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2900000,
            "description": "The brand's profile picture. A picture: \"data:image/png;base64,…\" (PNG, JPG or WebP, 2 MB at most, never SVG) or an https address the board fetches once. It's re-encoded as a 256x256 square. null removes it. For many pictures, use https addresses: the whole file is 4 MB at most."
          }
        }
      }
    },
    "departments": {
      "type": "array",
      "maxItems": 20,
      "description": "Department names to have on the board (up to 30 characters each). Ones that already exist are left as they are.",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 30
      }
    },
    "bots": {
      "type": "array",
      "maxItems": 60,
      "description": "The board's name, description and department for bots your hub reports. Each is matched by its desk id; a bot shows on the board once its hub reports it.",
      "items": {
        "type": "object",
        "required": [
          "desk"
        ],
        "additionalProperties": false,
        "properties": {
          "desk": {
            "type": "string",
            "pattern": "^[a-z0-9-]{1,40}$",
            "description": "The bot's id, exactly as its hub reports it (lower case letters, digits and dashes)."
          },
          "displayName": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 40,
            "description": "The name the board shows. null goes back to the bot's own name."
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 160,
            "description": "One line on what the bot does. null clears it."
          },
          "department": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 30,
            "description": "Its department's name. A name the board doesn't have yet is added. null takes it out of any department."
          },
          "logo": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": false,
            "required": [
              "kind",
              "color"
            ],
            "description": "The bot's logo on the board, as Customise sets it: its own picture, one of the icons, or its initials, in one of the logo colours. null goes back to its initials in its own colour.",
            "properties": {
              "kind": {
                "enum": [
                  "initials",
                  "icon",
                  "upload"
                ],
                "description": "initials, an icon, or upload (its own picture, given in picture)."
              },
              "color": {
                "enum": [
                  "teal",
                  "green",
                  "violet",
                  "magenta",
                  "coral",
                  "plum",
                  "slate",
                  "olive"
                ],
                "description": "One of the eight logo colours."
              },
              "icon": {
                "enum": [
                  "pen",
                  "film",
                  "scissors",
                  "chart",
                  "chat",
                  "spark",
                  "bolt",
                  "eye",
                  "book",
                  "mic",
                  "globe",
                  "compass"
                ],
                "description": "With kind icon: which icon."
              },
              "picture": {
                "type": "string",
                "maxLength": 2900000,
                "description": "With kind upload: the picture, as \"data:image/png;base64,…\" (PNG, JPG or WebP, 2 MB at most, never SVG) or an https address. Re-encoded as a 256x256 square."
              }
            }
          }
        }
      }
    },
    "alerts": {
      "type": "object",
      "additionalProperties": false,
      "description": "When the board alerts the owner. The push topic isn't set here: the owner sets it in Team.",
      "properties": {
        "blockedAfterMinutes": {
          "enum": [
            15,
            60,
            240,
            1440
          ],
          "description": "How long a bot can stay blocked before an alert."
        },
        "morningDigest": {
          "type": "boolean",
          "description": "A morning summary of the night: on or off."
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 254,
          "description": "Where email alerts go. null switches email alerts off."
        }
      }
    },
    "trading": {
      "type": "object",
      "required": [
        "on"
      ],
      "additionalProperties": false,
      "description": "The paper-trading features: the Trading tab, trading desks and their alerts. Paper only: no real money is held or traded.",
      "properties": {
        "on": {
          "type": "boolean"
        }
      }
    }
  }
}
