{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/office-settings.schema.json",
  "title": "Office settings",
  "description": "What GET /v1/settings returns and POST /v1/settings returns after a change: the output language, the fable rung and model routing. A preview (the first POST) adds the change it would make and a confirmToken.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion", "language", "model", "route"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "language": {
      "enum": ["en", "tr"],
      "x-sensitivity": "none"
    },
    "model": {
      "enum": ["on", "off"],
      "x-sensitivity": "none",
      "description": "Whether the fable rung is in play."
    },
    "route": {
      "enum": ["on", "off"],
      "x-sensitivity": "none",
      "description": "Whether model routing is on."
    },
    "change": {
      "type": "object",
      "additionalProperties": false,
      "required": ["setting", "from", "to"],
      "x-sensitivity": "none",
      "properties": {
        "setting": {
          "enum": ["language", "model", "route"]
        },
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "freeChain": {
          "type": "object",
          "additionalProperties": false,
          "required": ["enabled", "allowTraining"],
          "description": "Present when turning routing on brings back a saved free provider chain: the confirmation names it.",
          "properties": {
            "enabled": { "const": true },
            "allowTraining": { "type": "boolean" }
          }
        }
      }
    },
    "confirmToken": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{16,128}$",
      "x-sensitivity": "none"
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time",
      "x-sensitivity": "none"
    }
  }
}
