{
  "$id": "https://opendatafabric.org/schemas/data/v1alpha1/DataType",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Defines a logical type of the field. Logical type determines the semantics and boudaries of a type and how it can be operated on, without a concern about encoding and physical layout of the data in chunks.",
  "$defs": {
    "Binary": {
      "description": "A sequence of bytes. Used for arbitrary binary data.",
      "type": "object",
      "required": [],
      "properties": {
        "fixedLength": {
          "type": "integer",
          "format": "uint64",
          "description": "Number of bytes per value for fixed-size binary. If omitted, the binary is variable-length."
        }
      }
    },
    "Bool": {
      "description": "A boolean value representing true or false.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Date": {
      "description": "A calendar date.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Decimal": {
      "description": "A fixed-point decimal number with a specified precision and scale.",
      "type": "object",
      "required": [
        "precision",
        "scale"
      ],
      "properties": {
        "precision": {
          "type": "integer",
          "format": "uint32",
          "description": "Total number of decimal digits that can be stored."
        },
        "scale": {
          "type": "integer",
          "format": "int32",
          "description": "Number of digits after the decimal point. In certain situations, scale could be negative number. For negative scale, it is the number of padding 0 to the right of the digits.\n\nFor example the number 12300 could be treated as a decimal has precision 3 and scale -2."
        }
      }
    },
    "Duration": {
      "description": "An elapsed time interval with a specified time unit.",
      "type": "object",
      "required": [],
      "properties": {
        "unit": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/TimeUnit",
          "description": "The unit of the duration measurement.",
          "default": "Millisecond",
          "unevaluatedProperties": false
        }
      }
    },
    "Float16": {
      "description": "A floating-point number.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Float32": {
      "description": "A floating-point number.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Float64": {
      "description": "A floating-point number.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Int8": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Int16": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Int32": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Int64": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "UInt8": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "UInt16": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "UInt32": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "UInt64": {
      "description": "An integer value.",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "List": {
      "description": "A list of values, all having the same data type.",
      "type": "object",
      "required": [
        "itemType"
      ],
      "properties": {
        "itemType": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/DataType",
          "description": "Data type of list items.",
          "unevaluatedProperties": false,
          "codegen": {
            "rust": {
              "container": "Box"
            }
          }
        },
        "fixedLength": {
          "type": "integer",
          "format": "uint64",
          "description": "Number of list items per value for fixed-size lists. If omitted, the list is variable-length."
        }
      }
    },
    "Map": {
      "description": "A map of key-value pairs, represented as a list of entries (structs with key and value fields).",
      "type": "object",
      "required": [
        "keyType",
        "valueType"
      ],
      "properties": {
        "keyType": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/DataType",
          "description": "Data type of the map's keys.",
          "unevaluatedProperties": false,
          "codegen": {
            "rust": {
              "container": "Box"
            }
          }
        },
        "valueType": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/DataType",
          "description": "Data type of the map's values.",
          "unevaluatedProperties": false,
          "codegen": {
            "rust": {
              "container": "Box"
            }
          }
        },
        "keysSorted": {
          "type": "boolean",
          "description": "Set to true if the keys within each value are sorted."
        }
      }
    },
    "Null": {
      "description": "A type representing the absence of a value (null).",
      "type": "object",
      "required": [],
      "properties": {}
    },
    "Option": {
      "description": "A type representing an optional (nullable) value of another data type.",
      "type": "object",
      "required": [
        "inner"
      ],
      "properties": {
        "inner": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/DataType",
          "description": "Inner data type for the optional value.",
          "unevaluatedProperties": false,
          "codegen": {
            "rust": {
              "container": "Box"
            }
          }
        }
      }
    },
    "Struct": {
      "description": "A collection of named fields, each with its own data type.",
      "type": "object",
      "required": [
        "fields"
      ],
      "properties": {
        "fields": {
          "type": "array",
          "items": {
            "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/DataField",
            "unevaluatedProperties": false
          },
          "description": "Fields that make up the struct."
        }
      }
    },
    "Time": {
      "description": "A time of day value, without a date, with a specified unit of granularity.",
      "type": "object",
      "required": [],
      "properties": {
        "unit": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/TimeUnit",
          "default": "Millisecond",
          "description": "The unit of the time value.",
          "unevaluatedProperties": false
        }
      }
    },
    "Timestamp": {
      "description": "A point in time, represented as an offset from the Unix epoch in a specific timezone.",
      "type": "object",
      "required": [],
      "properties": {
        "unit": {
          "$ref": "https://opendatafabric.org/schemas/data/v1alpha1/TimeUnit",
          "default": "Millisecond",
          "description": "The unit of the timestamp value that determines its precision.",
          "unevaluatedProperties": false
        },
        "timezone": {
          "type": "string",
          "default": "UTC",
          "description": "The timezone is an optional string indicating the name of a timezone\none of\n\n* As used in the Olson timezone database (the \"tz database\" or\n  \"tzdata\"), such as \"America/New_York\".\n* An absolute timezone offset of the form \"+XX:XX\" or \"-XX:XX\",\n  such as \"+07:30\"."
        }
      }
    },
    "String": {
      "description": "A Unicode string.",
      "type": "object",
      "required": [],
      "properties": {}
    }
  },
  "format": "union-or-string",
  "oneOf": [
    {
      "type": "string",
      "enum": [
        "Binary",
        "Bool",
        "Date",
        "Decimal",
        "Duration",
        "Float16",
        "Float32",
        "Float64",
        "Int8",
        "Int16",
        "Int32",
        "Int64",
        "UInt8",
        "UInt16",
        "UInt32",
        "UInt64",
        "List",
        "Map",
        "Null",
        "Option",
        "Struct",
        "Time",
        "Timestamp",
        "String"
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Binary"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Binary"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Bool"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Bool"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Date"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Date"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Decimal"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Decimal"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Duration"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Duration"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Float16"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Float16"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Float32"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Float32"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Float64"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Float64"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Int8"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Int8"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Int16"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Int16"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Int32"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Int32"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Int64"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Int64"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "UInt8"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/UInt8"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "UInt16"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/UInt16"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "UInt32"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/UInt32"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "UInt64"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/UInt64"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "List"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/List"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Map"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Map"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Null"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Null"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Option"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Option"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Struct"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Struct"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Time"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Time"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "Timestamp"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/Timestamp"
        }
      ]
    },
    {
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "const": "String"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "$ref": "#/$defs/String"
        }
      ]
    }
  ]
}
