{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gm.mctl.ai/a2ui/v1/catalog.json",
  "protocolVersion": "1.0",
  "title": "IT job feed dashboard",
  "description": "Read-only dashboard components over a parsed job feed. No inputs, links, images or HTML.",
  "catalogId": "https://gm.mctl.ai/a2ui/v1/catalog.json",
  "instructions": "Compose a dashboard from these components. Every component needs a unique UAX #31 id; one has id root. Give new titles in both languages with localize. View state (filters, sort, host style) is data model /ui, not components.",
  "components": {
    "Column": {
      "type": "object",
      "description": "Vertical stack of children.",
      "properties": {
        "component": {
          "const": "Column"
        },
        "children": {
          "type": "array",
          "items": {
            "$ref": "common_types.json#/$defs/ComponentId"
          },
          "maxItems": 24
        },
        "gap": {
          "type": "string",
          "enum": [
            "s",
            "m",
            "l"
          ]
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "children"
      ],
      "additionalProperties": false
    },
    "Row": {
      "type": "object",
      "description": "Horizontal row of children; wraps on narrow screens. Child `weight` sets relative width.",
      "properties": {
        "component": {
          "const": "Row"
        },
        "children": {
          "type": "array",
          "items": {
            "$ref": "common_types.json#/$defs/ComponentId"
          },
          "maxItems": 24
        },
        "gap": {
          "type": "string",
          "enum": [
            "s",
            "m",
            "l"
          ]
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "children"
      ],
      "additionalProperties": false
    },
    "Card": {
      "type": "object",
      "description": "Bordered panel around one child, optional title.",
      "properties": {
        "component": {
          "const": "Card"
        },
        "child": {
          "$ref": "common_types.json#/$defs/Child"
        },
        "title": {
          "$ref": "#/$defs/TextValue"
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "child"
      ],
      "additionalProperties": false
    },
    "Text": {
      "type": "object",
      "description": "Text. variant picks the style.",
      "properties": {
        "component": {
          "const": "Text"
        },
        "text": {
          "$ref": "#/$defs/TextValue"
        },
        "variant": {
          "type": "string",
          "enum": [
            "h1",
            "h2",
            "h3",
            "body",
            "caption"
          ]
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "text"
      ],
      "additionalProperties": false
    },
    "Divider": {
      "type": "object",
      "description": "Horizontal rule.",
      "properties": {
        "component": {
          "const": "Divider"
        }
      },
      "required": [
        "component"
      ],
      "additionalProperties": false
    },
    "Callout": {
      "type": "object",
      "description": "Highlighted note.",
      "properties": {
        "component": {
          "const": "Callout"
        },
        "text": {
          "$ref": "#/$defs/TextValue"
        },
        "tone": {
          "type": "string",
          "enum": [
            "info",
            "accent",
            "warning"
          ]
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "text"
      ],
      "additionalProperties": false
    },
    "KpiTile": {
      "type": "object",
      "description": "One big number computed from the filtered vacancies.",
      "properties": {
        "component": {
          "const": "KpiTile"
        },
        "metric": {
          "type": "string",
          "enum": [
            "count",
            "companies",
            "medianSalaryEUR",
            "medianSalaryRUB",
            "maxSalaryEUR",
            "relocationShare",
            "remoteShare",
            "topStack",
            "topLocation",
            "otherPosts",
            "lastPostAge",
            "newThisWeek",
            "openNow"
          ]
        },
        "label": {
          "$ref": "#/$defs/TextValue"
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "metric"
      ],
      "additionalProperties": false
    },
    "BarChart": {
      "type": "object",
      "description": "Bar chart of vacancy counts grouped by a dataset.",
      "properties": {
        "component": {
          "const": "BarChart"
        },
        "dataset": {
          "type": "string",
          "enum": [
            "byStack",
            "byLocation",
            "byCompany",
            "byFormat",
            "byCurrency",
            "byMonth",
            "byEnglish",
            "bySeniority"
          ]
        },
        "title": {
          "$ref": "#/$defs/TextValue"
        },
        "limit": {
          "type": "integer",
          "minimum": 3,
          "maximum": 20
        },
        "orientation": {
          "type": "string",
          "enum": [
            "horizontal",
            "vertical"
          ]
        },
        "size": {
          "type": "string",
          "enum": [
            "s",
            "m",
            "l"
          ]
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "dataset"
      ],
      "additionalProperties": false
    },
    "Histogram": {
      "type": "object",
      "description": "Salary distribution (monthly, converted to EUR), optionally split by currency or work format.",
      "properties": {
        "component": {
          "const": "Histogram"
        },
        "title": {
          "$ref": "#/$defs/TextValue"
        },
        "groupBy": {
          "type": "string",
          "enum": [
            "none",
            "currency",
            "format"
          ]
        },
        "bins": {
          "type": "integer",
          "minimum": 4,
          "maximum": 20
        },
        "size": {
          "type": "string",
          "enum": [
            "s",
            "m",
            "l"
          ]
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component"
      ],
      "additionalProperties": false
    },
    "TagCloud": {
      "type": "object",
      "description": "Weighted tags for a dataset.",
      "properties": {
        "component": {
          "const": "TagCloud"
        },
        "dataset": {
          "type": "string",
          "enum": [
            "byStack",
            "byLocation",
            "byCompany",
            "byFormat",
            "byCurrency",
            "byMonth",
            "byEnglish",
            "bySeniority"
          ]
        },
        "title": {
          "$ref": "#/$defs/TextValue"
        },
        "limit": {
          "type": "integer",
          "minimum": 3,
          "maximum": 40
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component",
        "dataset"
      ],
      "additionalProperties": false
    },
    "VacancyList": {
      "type": "object",
      "description": "The filtered, sorted vacancies.",
      "properties": {
        "component": {
          "const": "VacancyList"
        },
        "title": {
          "$ref": "#/$defs/TextValue"
        },
        "layout": {
          "type": "string",
          "enum": [
            "cards",
            "table",
            "compact"
          ]
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 50
        },
        "fields": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "salary",
              "location",
              "format",
              "stack",
              "english",
              "tasks",
              "about",
              "date",
              "relocation",
              "company"
            ]
          },
          "uniqueItems": true,
          "minItems": 1,
          "maxItems": 10
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component"
      ],
      "additionalProperties": false
    },
    "FilterBar": {
      "type": "object",
      "description": "Clickable filter chips (viewer-local, not saved).",
      "properties": {
        "component": {
          "const": "FilterBar"
        },
        "fields": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "stack",
              "location",
              "format",
              "company",
              "currency"
            ]
          },
          "uniqueItems": true,
          "minItems": 1,
          "maxItems": 5
        },
        "weight": {
          "description": "Relative width inside a Row.",
          "type": "integer",
          "minimum": 1,
          "maximum": 4
        }
      },
      "required": [
        "component"
      ],
      "additionalProperties": false
    }
  },
  "functions": {
    "localize": {
      "type": "object",
      "description": "Bilingual text; the renderer picks the viewer's language.",
      "returnType": "string",
      "allowedCallers": "rendererOnly",
      "properties": {
        "@call": {
          "const": "localize"
        },
        "args": {
          "type": "object",
          "properties": {
            "en": {
              "type": "string",
              "maxLength": 160
            },
            "ru": {
              "type": "string",
              "maxLength": 160
            }
          },
          "required": [
            "en",
            "ru"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "@call",
        "args"
      ],
      "unevaluatedProperties": false
    }
  },
  "$defs": {
    "anyComponent": {
      "oneOf": [
        {
          "$ref": "#/components/Column"
        },
        {
          "$ref": "#/components/Row"
        },
        {
          "$ref": "#/components/Card"
        },
        {
          "$ref": "#/components/Text"
        },
        {
          "$ref": "#/components/Divider"
        },
        {
          "$ref": "#/components/Callout"
        },
        {
          "$ref": "#/components/KpiTile"
        },
        {
          "$ref": "#/components/BarChart"
        },
        {
          "$ref": "#/components/Histogram"
        },
        {
          "$ref": "#/components/TagCloud"
        },
        {
          "$ref": "#/components/VacancyList"
        },
        {
          "$ref": "#/components/FilterBar"
        }
      ],
      "discriminator": {
        "propertyName": "component"
      }
    },
    "anyFunction": {
      "oneOf": [
        {
          "$ref": "#/functions/localize"
        }
      ]
    },
    "TextValue": {
      "description": "A string, a binding to /feed/source, /feed/status, /feed/fetchedAt, or a localize call.",
      "oneOf": [
        {
          "type": "string",
          "maxLength": 160
        },
        {
          "type": "object",
          "properties": {
            "@path": {
              "type": "string",
              "enum": [
                "/feed/source",
                "/feed/status",
                "/feed/fetchedAt"
              ]
            }
          },
          "required": [
            "@path"
          ],
          "additionalProperties": false
        },
        {
          "$ref": "common_types.json#/$defs/FunctionCall",
          "description": "Only localize is accepted."
        }
      ]
    }
  }
}