{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://a2ui.dev/specification/0.9/standard_catalog_definition.json",
  "title": "A2UI Component Catalog",
  "description": "Definitions for the standard catalog of A2UI components.",
  "$defs": {
    "Theme": {
      "type": "object",
      "description": "Theming information for the UI.",
      "properties": {
        "font": {
          "type": "string",
          "description": "The primary font for the UI."
        },
        "primaryColor": {
          "type": "string",
          "description": "The primary UI color as a hexadecimal code (e.g., '#00BFFF').",
          "pattern": "^#[0-9a-fA-F]{6}$"
        }
      },
      "additionalProperties": false
    },
    "anyComponent": {
      "oneOf": [
        { "$ref": "#/$defs/Text" },
        { "$ref": "#/$defs/Image" },
        { "$ref": "#/$defs/Icon" },
        { "$ref": "#/$defs/Video" },
        { "$ref": "#/$defs/AudioPlayer" },
        { "$ref": "#/$defs/Row" },
        { "$ref": "#/$defs/Column" },
        { "$ref": "#/$defs/List" },
        { "$ref": "#/$defs/Card" },
        { "$ref": "#/$defs/Tabs" },
        { "$ref": "#/$defs/Divider" },
        { "$ref": "#/$defs/Modal" },
        { "$ref": "#/$defs/Button" },
        { "$ref": "#/$defs/CheckBox" },
        { "$ref": "#/$defs/TextField" },
        { "$ref": "#/$defs/DateTimeInput" },
        { "$ref": "#/$defs/ChoicePicker" },
        { "$ref": "#/$defs/Slider" }
      ],
      "discriminator": {
        "propertyName": "component"
      }
    },
    "Text": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Text" },
            "text": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The text content to display. While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation."
            },
            "usageHint": {
              "type": "string",
              "description": "A hint for the base text style.",
              "enum": ["h1", "h2", "h3", "h4", "h5", "caption", "body"]
            }
          },
          "required": ["component", "text"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Image": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Image" },
            "url": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The URL of the image to display."
            },
            "fit": {
              "type": "string",
              "description": "Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.",
              "enum": ["contain", "cover", "fill", "none", "scale-down"]
            },
            "usageHint": {
              "type": "string",
              "description": "A hint for the image size and style.",
              "enum": [
                "icon",
                "avatar",
                "smallFeature",
                "mediumFeature",
                "largeFeature",
                "header"
              ]
            }
          },
          "required": ["component", "url"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Icon": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Icon" },
            "name": {
              "description": "The name of the icon to display.",
              "oneOf": [
                {
                  "type": "string",
                  "enum": [
                    "accountCircle",
                    "add",
                    "arrowBack",
                    "arrowForward",
                    "attachFile",
                    "calendarToday",
                    "call",
                    "camera",
                    "check",
                    "close",
                    "delete",
                    "download",
                    "edit",
                    "event",
                    "error",
                    "fastForward",
                    "favorite",
                    "favoriteOff",
                    "folder",
                    "help",
                    "home",
                    "info",
                    "locationOn",
                    "lock",
                    "lockOpen",
                    "mail",
                    "menu",
                    "moreVert",
                    "moreHoriz",
                    "notificationsOff",
                    "notifications",
                    "pause",
                    "payment",
                    "person",
                    "phone",
                    "photo",
                    "play",
                    "print",
                    "refresh",
                    "rewind",
                    "search",
                    "send",
                    "settings",
                    "share",
                    "shoppingCart",
                    "skipNext",
                    "skipPrevious",
                    "star",
                    "starHalf",
                    "starOff",
                    "stop",
                    "upload",
                    "visibility",
                    "visibilityOff",
                    "volumeDown",
                    "volumeMute",
                    "volumeOff",
                    "volumeUp",
                    "warning"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "path": { "type": "string" }
                  },
                  "required": ["path"],
                  "additionalProperties": false
                }
              ]
            }
          },
          "required": ["component", "name"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Video": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Video" },
            "url": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The URL of the video to display."
            }
          },
          "required": ["component", "url"]
        }
      ],
      "unevaluatedProperties": false
    },
    "AudioPlayer": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "AudioPlayer" },
            "url": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The URL of the audio to be played."
            },
            "description": {
              "description": "A description of the audio, such as a title or summary.",
              "$ref": "common_types.json#/$defs/stringOrPath"
            }
          },
          "required": ["component", "url"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Row": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "description": "A layout component that arranges its children horizontally. To create a grid layout, nest Columns within this Row.",
          "properties": {
            "component": { "const": "Row" },
            "children": {
              "description": "Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID.",
              "$ref": "common_types.json#/$defs/childrenProperty"
            },
            "distribution": {
              "type": "string",
              "description": "Defines the arrangement of children along the main axis (horizontally). Use 'spaceBetween' to push items to the edges, or 'start'/'end'/'center' to pack them together.",
              "enum": [
                "center",
                "end",
                "spaceAround",
                "spaceBetween",
                "spaceEvenly",
                "start",
                "stretch"
              ]
            },
            "alignment": {
              "type": "string",
              "description": "Defines the alignment of children along the cross axis (vertically). This is similar to the CSS 'align-items' property, but uses camelCase values (e.g., 'start').",
              "enum": ["start", "center", "end", "stretch"]
            }
          },
          "required": ["component", "children"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Column": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "description": "A layout component that arranges its children vertically. To create a grid layout, nest Rows within this Column.",
          "properties": {
            "component": { "const": "Column" },
            "children": {
              "description": "Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID.",
              "$ref": "common_types.json#/$defs/childrenProperty"
            },
            "distribution": {
              "type": "string",
              "description": "Defines the arrangement of children along the main axis (vertically). Use 'spaceBetween' to push items to the edges (e.g. header at top, footer at bottom), or 'start'/'end'/'center' to pack them together.",
              "enum": [
                "start",
                "center",
                "end",
                "spaceBetween",
                "spaceAround",
                "spaceEvenly",
                "stretch"
              ]
            },
            "alignment": {
              "type": "string",
              "description": "Defines the alignment of children along the cross axis (horizontally). This is similar to the CSS 'align-items' property.",
              "enum": ["center", "end", "start", "stretch"]
            }
          },
          "required": ["component", "children"]
        }
      ],
      "unevaluatedProperties": false
    },
    "List": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "List" },
            "children": {
              "description": "Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list.",
              "$ref": "common_types.json#/$defs/childrenProperty"
            },
            "direction": {
              "type": "string",
              "description": "The direction in which the list items are laid out.",
              "enum": ["vertical", "horizontal"]
            },
            "alignment": {
              "type": "string",
              "description": "Defines the alignment of children along the cross axis.",
              "enum": ["start", "center", "end", "stretch"]
            }
          },
          "required": ["component", "children"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Card": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Card" },
            "child": {
              "type": "string",
              "description": "The ID of the single child component to be rendered inside the card. To display multiple elements, you MUST wrap them in a layout component (like Column or Row) and pass that container's ID here. Do NOT pass multiple IDs or a non-existent ID. Do NOT define the child component inline."
            }
          },
          "required": ["component", "child"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Tabs": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Tabs" },
            "tabItems": {
              "type": "array",
              "description": "An array of objects, where each object defines a tab with a title and a child component.",
              "items": {
                "type": "object",
                "properties": {
                  "title": {
                    "description": "The tab title.",
                    "$ref": "common_types.json#/$defs/stringOrPath"
                  },
                  "child": {
                    "type": "string",
                    "description": "The ID of the child component. Do NOT define the component inline."
                  }
                },
                "required": ["title", "child"],
                "additionalProperties": false
              }
            }
          },
          "required": ["component", "tabItems"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Divider": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Divider" },
            "axis": {
              "type": "string",
              "description": "The orientation of the divider.",
              "enum": ["horizontal", "vertical"]
            }
          },
          "required": ["component"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Modal": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Modal" },
            "entryPointChild": {
              "type": "string",
              "description": "The ID of the component that opens the modal when interacted with (e.g., a button). Do NOT define the component inline."
            },
            "contentChild": {
              "type": "string",
              "description": "The ID of the component to be displayed inside the modal. Do NOT define the component inline."
            }
          },
          "required": ["component", "entryPointChild", "contentChild"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Button": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "Button" },
            "child": {
              "type": "string",
              "description": "The ID of the child component. Use a 'Text' component for a labeled button. Only use an 'Icon' if the requirements explicitly ask for an icon-only button. Do NOT define the child component inline."
            },
            "primary": {
              "type": "boolean",
              "description": "Indicates if this button should be styled as the primary action."
            },
            "action": {
              "type": "object",
              "description": "The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.",
              "properties": {
                "name": { "type": "string" },
                "context": {
                  "type": "object",
                  "description": "A JSON object containing the key-value pairs for the action context. Values can be literals or paths. Use literal values unless the value must be dynamically bound to the data model. Do NOT use paths for static IDs.",
                  "additionalProperties": {
                    "$ref": "common_types.json#/$defs/contextValue"
                  }
                }
              },
              "required": ["name"],
              "additionalProperties": false
            }
          },
          "required": ["component", "child", "action"]
        }
      ],
      "unevaluatedProperties": false
    },
    "CheckBox": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "CheckBox" },
            "label": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The text to display next to the checkbox."
            },
            "value": {
              "$ref": "common_types.json#/$defs/booleanOrPath",
              "description": "The current state of the checkbox (true for checked, false for unchecked)."
            }
          },
          "required": ["component", "label", "value"]
        }
      ],
      "unevaluatedProperties": false
    },
    "TextField": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "TextField" },
            "label": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The text label for the input field."
            },
            "text": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The value of the text field."
            },
            "usageHint": {
              "type": "string",
              "description": "The type of input field to display.",
              "enum": ["longText", "number", "shortText", "obscured"]
            },
            "validationRegexp": {
              "type": "string",
              "description": "A regular expression used for client-side validation of the input."
            }
          },
          "required": ["component", "label"]
        }
      ],
      "unevaluatedProperties": false
    },
    "DateTimeInput": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": { "const": "DateTimeInput" },
            "value": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The selected date and/or time value in ISO 8601 format. If not yet set, initialize with an empty string."
            },
            "enableDate": {
              "type": "boolean",
              "description": "If true, allows the user to select a date."
            },
            "enableTime": {
              "type": "boolean",
              "description": "If true, allows the user to select a time."
            },
            "outputFormat": {
              "type": "string",
              "description": "The desired format for the output string after a date or time is selected."
            },
            "label": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The text label for the input field."
            }
          },
          "required": ["component", "value"]
        }
      ],
      "unevaluatedProperties": false
    },
    "ChoicePicker": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "description": "A component that allows selecting one or more options from a list.",
          "properties": {
            "component": {
              "const": "ChoicePicker"
            },
            "label": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The label for the group of options."
            },
            "usageHint": {
              "type": "string",
              "description": "A hint for how the choice picker should be displayed and behave.",
              "enum": ["multipleSelection", "mutuallyExclusive"]
            },
            "options": {
              "type": "array",
              "description": "The list of available options to choose from.",
              "items": {
                "type": "object",
                "properties": {
                  "label": {
                    "description": "The text to display for this option.",
                    "$ref": "common_types.json#/$defs/stringOrPath"
                  },
                  "value": {
                    "type": "string",
                    "description": "The stable value associated with this option."
                  }
                },
                "required": ["label", "value"],
                "additionalProperties": false
              }
            },
            "value": {
              "$ref": "common_types.json#/$defs/stringArrayOrPath",
              "description": "The list of currently selected values. This should be bound to a string array in the data model."
            }
          },
          "required": ["component", "options", "value", "usageHint"]
        }
      ],
      "unevaluatedProperties": false
    },
    "Slider": {
      "type": "object",
      "allOf": [
        { "$ref": "common_types.json#/$defs/ComponentCommon" },
        {
          "type": "object",
          "properties": {
            "component": {
              "const": "Slider"
            },
            "label": {
              "$ref": "common_types.json#/$defs/stringOrPath",
              "description": "The label for the slider."
            },
            "min": {
              "type": "number",
              "description": "The minimum value of the slider."
            },
            "max": {
              "type": "number",
              "description": "The maximum value of the slider."
            },
            "value": {
              "$ref": "common_types.json#/$defs/numberOrPath",
              "description": "The current value of the slider."
            }
          },
          "required": ["component", "value"]
        }
      ],
      "unevaluatedProperties": false
    }
  }
}
