{
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the field."
        },
        "data_type": {
          "type": "string",
          "description": "The field's data type.",
          "enum": [
            "text",
            "number",
            "date"
          ]
        }
      },
      "required": [
        "name",
        "data_type"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the field."
        },
        "data_type": {
          "type": "string",
          "description": "The field's data type.",
          "const": "single_select"
        },
        "single_select_options": {
          "type": "array",
          "description": "The options available for single select fields. At least one option must be provided when creating a single select field.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The display name of the option."
              },
              "color": {
                "type": "string",
                "description": "The color associated with the option.",
                "enum": [
                  "BLUE",
                  "GRAY",
                  "GREEN",
                  "ORANGE",
                  "PINK",
                  "PURPLE",
                  "RED",
                  "YELLOW"
                ]
              },
              "description": {
                "type": "string",
                "description": "The description of the option."
              }
            },
            "additionalProperties": false
          }
        }
      },
      "required": [
        "name",
        "data_type",
        "single_select_options"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the field."
        },
        "data_type": {
          "type": "string",
          "description": "The field's data type.",
          "const": "iteration"
        },
        "iteration_configuration": {
          "type": "object",
          "description": "The configuration for iteration fields.",
          "properties": {
            "start_date": {
              "type": "string",
              "format": "date",
              "description": "The start date of the first iteration."
            },
            "duration": {
              "type": "integer",
              "description": "The default duration for iterations in days. Individual iterations can override this value."
            },
            "iterations": {
              "type": "array",
              "description": "Zero or more iterations for the field.",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "title": {
                    "type": "string",
                    "description": "The title of the iteration."
                  },
                  "start_date": {
                    "type": "string",
                    "format": "date",
                    "description": "The start date of the iteration."
                  },
                  "duration": {
                    "type": "integer",
                    "description": "The duration of the iteration in days."
                  }
                }
              }
            }
          }
        }
      },
      "required": [
        "name",
        "data_type",
        "iteration_configuration"
      ],
      "additionalProperties": false
    }
  ],
  "$schema": "https://json-schema.org/draft/2019-09/schema"
}