{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/tinybird/main/json-schema/tinybird-data-source-schema.json",
  "title": "Tinybird Data Source",
  "description": "Schema for a Tinybird Data Source resource representing an ingested dataset",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the data source"
    },
    "name": {
      "type": "string",
      "description": "Name of the data source"
    },
    "cluster": {
      "type": "string",
      "description": "Cluster the data source belongs to"
    },
    "tags": {
      "type": "object",
      "description": "Key-value tags for the data source",
      "additionalProperties": {
        "type": "string"
      }
    },
    "schema": {
      "type": "string",
      "description": "ClickHouse-compatible schema definition for the data source columns"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the data source was created"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the data source was last updated"
    },
    "row_count": {
      "type": "integer",
      "minimum": 0,
      "description": "Total number of rows in the data source"
    },
    "disk_bytes": {
      "type": "integer",
      "minimum": 0,
      "description": "Disk storage usage in bytes"
    },
    "replicated": {
      "type": "boolean",
      "description": "Whether the data source is replicated across nodes"
    },
    "ttl_expression": {
      "type": "string",
      "description": "Time-to-live expression for automatic data expiration"
    },
    "statistics": {
      "type": "object",
      "description": "Runtime statistics for the data source",
      "properties": {
        "row_count": {
          "type": "integer"
        },
        "disk_bytes": {
          "type": "integer"
        },
        "compressed_bytes": {
          "type": "integer"
        }
      }
    }
  },
  "required": ["id", "name"],
  "additionalProperties": false
}
