{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "ResourcesSpec",
  "type": "object",
  "properties": {
    "basins": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/BasinSpec"
      }
    }
  },
  "definitions": {
    "BasinConfigSpec": {
      "type": "object",
      "properties": {
        "create_stream_on_append": {
          "description": "Create stream on append if it doesn't exist, using the default stream configuration.",
          "default": null,
          "type": [
            "boolean",
            "null"
          ]
        },
        "create_stream_on_read": {
          "description": "Create stream on read if it doesn't exist, using the default stream configuration.",
          "default": null,
          "type": [
            "boolean",
            "null"
          ]
        },
        "default_stream_config": {
          "anyOf": [
            {
              "$ref": "#/definitions/StreamConfigSpec"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "BasinSpec": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "config": {
          "anyOf": [
            {
              "$ref": "#/definitions/BasinConfigSpec"
            },
            {
              "type": "null"
            }
          ]
        },
        "name": {
          "type": "string"
        },
        "streams": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/StreamSpec"
          }
        }
      },
      "additionalProperties": false
    },
    "DeleteOnEmptySpec": {
      "type": "object",
      "properties": {
        "min_age": {
          "description": "Minimum age before an empty stream can be deleted. Set to 0 (default) to disable delete-on-empty (don't delete automatically).",
          "anyOf": [
            {
              "$ref": "#/definitions/HumanDuration"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "HumanDuration": {
      "description": "A duration string in humantime format, e.g. \"1day\", \"2h 30m\"",
      "examples": [
        "1day",
        "2h 30m"
      ],
      "type": "string"
    },
    "RetentionPolicySpec": {
      "description": "Retain records unless explicitly trimmed (\"infinite\"), or automatically trim records older than the given duration (e.g. \"7days\", \"1week\").",
      "examples": [
        "infinite",
        "7days",
        "1week"
      ],
      "type": "string"
    },
    "StorageClassSpec": {
      "description": "Storage class for recent writes.",
      "type": "string",
      "enum": [
        "standard",
        "express"
      ]
    },
    "StreamConfigSpec": {
      "type": "object",
      "properties": {
        "delete_on_empty": {
          "description": "Delete-on-empty configuration.",
          "anyOf": [
            {
              "$ref": "#/definitions/DeleteOnEmptySpec"
            },
            {
              "type": "null"
            }
          ]
        },
        "retention_policy": {
          "description": "Retention policy for the stream. If unspecified, the default is to retain records for 7 days.",
          "anyOf": [
            {
              "$ref": "#/definitions/RetentionPolicySpec"
            },
            {
              "type": "null"
            }
          ]
        },
        "storage_class": {
          "description": "Storage class for recent writes.",
          "default": null,
          "anyOf": [
            {
              "$ref": "#/definitions/StorageClassSpec"
            },
            {
              "type": "null"
            }
          ]
        },
        "timestamping": {
          "description": "Timestamping behavior.",
          "anyOf": [
            {
              "$ref": "#/definitions/TimestampingSpec"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "StreamSpec": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "config": {
          "anyOf": [
            {
              "$ref": "#/definitions/StreamConfigSpec"
            },
            {
              "type": "null"
            }
          ]
        },
        "name": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "TimestampingModeSpec": {
      "description": "Timestamping mode for appends that influences how timestamps are handled.",
      "type": "string",
      "enum": [
        "client-prefer",
        "client-require",
        "arrival"
      ]
    },
    "TimestampingSpec": {
      "type": "object",
      "properties": {
        "mode": {
          "description": "Timestamping mode for appends that influences how timestamps are handled.",
          "default": null,
          "anyOf": [
            {
              "$ref": "#/definitions/TimestampingModeSpec"
            },
            {
              "type": "null"
            }
          ]
        },
        "uncapped": {
          "description": "Allow client-specified timestamps to exceed the arrival time. If this is `false` or not set, client timestamps will be capped at the arrival time.",
          "default": null,
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "additionalProperties": false
    }
  }
}