{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$",
      "not": {
        "enum": [
          "id",
          "trackerId",
          "recordId",
          "version",
          "schemaRevision",
          "schemaRevisionId",
          "lifecycle",
          "archived",
          "orderKey",
          "auditActor",
          "acceptance",
          "acceptanceReceipt",
          "acceptanceReceipts",
          "decision",
          "decisionReceipt",
          "verification",
          "verified",
          "humanApproval",
          "__proto__",
          "prototype",
          "constructor"
        ]
      }
    },
    "type": {
      "type": "string",
      "enum": [
        "text",
        "markdown",
        "number",
        "boolean",
        "enum",
        "multiselect",
        "date",
        "datetime",
        "actor_ref",
        "actor_refs",
        "status",
        "priority",
        "url",
        "artifact_ref",
        "artifact_refs",
        "resource_ref",
        "resource_refs",
        "record_ref",
        "record_refs",
        "metadata"
      ]
    },
    "label": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "required": {
      "type": "boolean"
    },
    "default": {},
    "options": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          }
        },
        "required": [
          "id",
          "label"
        ]
      }
    },
    "schema": {
      "$ref": "#/components/schemas/ProjectAgentTrackerContract_valueSchema"
    },
    "ui": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "placeholder": {
          "type": "string",
          "maxLength": 32768
        },
        "helpMarkdown": {
          "type": "string",
          "maxLength": 32768
        },
        "multiline": {
          "type": "boolean"
        },
        "width": {
          "type": "string",
          "enum": [
            "compact",
            "normal",
            "wide"
          ]
        }
      },
      "required": []
    }
  },
  "required": [
    "id",
    "type",
    "label"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "enum": [
              "enum",
              "multiselect",
              "status",
              "priority"
            ]
          }
        }
      },
      "then": {
        "required": [
          "options"
        ]
      },
      "else": {
        "not": {
          "required": [
            "options"
          ]
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "text"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minLength": {
                "type": "integer",
                "minimum": 0
              },
              "maxLength": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "markdown"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minLength": {
                "type": "integer",
                "minimum": 0
              },
              "maxLength": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "number"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minimum": {
                "type": "number"
              },
              "maximum": {
                "type": "number"
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "boolean"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "enum"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "multiselect"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minItems": {
                "type": "integer",
                "minimum": 0
              },
              "maxItems": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "date"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "datetime"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "actor_ref"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "actor_refs"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minItems": {
                "type": "integer",
                "minimum": 0
              },
              "maxItems": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "status"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "priority"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "url"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minLength": {
                "type": "integer",
                "minimum": 0
              },
              "maxLength": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "artifact_ref"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "artifact_refs"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minItems": {
                "type": "integer",
                "minimum": 0
              },
              "maxItems": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "resource_ref"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "resource_refs"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minItems": {
                "type": "integer",
                "minimum": 0
              },
              "maxItems": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "record_ref"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {},
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "record_refs"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "minItems": {
                "type": "integer",
                "minimum": 0
              },
              "maxItems": {
                "type": "integer",
                "minimum": 0
              }
            },
            "required": []
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "metadata"
          }
        }
      },
      "then": {
        "properties": {
          "schema": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProjectAgentTrackerContract_valueSchema"
              },
              {
                "required": [
                  "type"
                ],
                "properties": {
                  "type": {
                    "const": "object"
                  }
                }
              }
            ]
          }
        }
      }
    }
  ]
}