{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "object_registry input",
  "description": "object_registry input: list, show, validate, reload.",
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "list",
        "show",
        "validate",
        "reload"
      ],
      "description": "Choose list, show, validate, reload."
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "action": {
            "type": "string",
            "const": "list"
          }
        },
        "required": [
          "action"
        ]
      },
      "then": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "const": "list"
          },
          "domain": {
            "type": "string",
            "description": "Filter to objects in a specific domain (e.g. 'core.identity', 'saas.billing')"
          },
          "maturity": {
            "type": "string",
            "enum": [
              "draft",
              "alpha",
              "beta",
              "stable"
            ],
            "description": "Filter by metadata maturity level"
          },
          "trait": {
            "type": "string",
            "description": "Filter to objects composing a given trait (e.g. 'Priceable', 'lifecycle/Stateful')"
          },
          "includeInternal": {
            "type": "boolean",
            "default": false,
            "description": "Also list OODS Foundry's internal (non-business) objects, after the business objects. Without it they are left out and hiddenInternal counts them."
          }
        },
        "additionalProperties": false
      }
    },
    {
      "if": {
        "properties": {
          "action": {
            "type": "string",
            "const": "show"
          }
        },
        "required": [
          "action"
        ]
      },
      "then": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "const": "show"
          },
          "name": {
            "type": "string",
            "description": "Object name to look up (e.g. 'User', 'Product', 'Invoice')"
          },
          "context": {
            "type": "string",
            "description": "Optional: filter view_extensions to a single context (e.g. 'detail', 'list', 'form', 'timeline', 'card', 'inline')"
          }
        },
        "required": [
          "name"
        ],
        "additionalProperties": false
      }
    },
    {
      "if": {
        "properties": {
          "action": {
            "type": "string",
            "const": "validate"
          }
        },
        "required": [
          "action"
        ]
      },
      "then": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "const": "validate"
          },
          "yaml": {
            "type": "string",
            "minLength": 1,
            "description": "The whole definition as YAML: an object file starts with \"object:\", a trait file with \"trait:\" (the same format as OODS Foundry's own objects/ and traits/). Validate and register require semantic object.version or trait.version (for example 1.2.3), refuse declared conflicts between unbound traits (bound charts are exempt), and warn on unknown top-level keys with the nearest known spelling. Definitions already on disk keep loading as before."
          }
        },
        "required": [
          "yaml"
        ],
        "additionalProperties": false
      }
    },
    {
      "if": {
        "properties": {
          "action": {
            "type": "string",
            "const": "reload"
          }
        },
        "required": [
          "action"
        ]
      },
      "then": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "const": "reload"
          }
        },
        "additionalProperties": false
      }
    }
  ]
}
