{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "ShardJsonOutput",
  "description": "JSON output for single-tenant shard command",
  "type": "object",
  "properties": {
    "dialect": {
      "type": "string"
    },
    "dry_run": {
      "type": "boolean"
    },
    "input_file": {
      "type": "string"
    },
    "output_file": {
      "type": ["string", "null"]
    },
    "statistics": {
      "$ref": "#/$defs/ShardStatistics"
    },
    "tables": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TableShardJson"
      }
    },
    "tenant": {
      "$ref": "#/$defs/TenantInfo"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "input_file",
    "dialect",
    "dry_run",
    "tenant",
    "statistics",
    "tables"
  ],
  "$defs": {
    "ShardStatistics": {
      "type": "object",
      "properties": {
        "fk_orphans_skipped": {
          "type": "integer",
          "minimum": 0
        },
        "reduction_percent": {
          "type": "number"
        },
        "rows_selected": {
          "type": "integer",
          "minimum": 0
        },
        "rows_total": {
          "type": "integer",
          "minimum": 0
        },
        "tables_processed": {
          "type": "integer",
          "minimum": 0
        },
        "tables_skipped": {
          "type": "integer",
          "minimum": 0
        },
        "tables_with_data": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "tables_processed",
        "tables_with_data",
        "tables_skipped",
        "rows_selected",
        "rows_total",
        "reduction_percent",
        "fk_orphans_skipped"
      ]
    },
    "TableShardJson": {
      "type": "object",
      "properties": {
        "classification": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "rows_selected": {
          "type": "integer",
          "minimum": 0
        },
        "rows_total": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": ["name", "classification", "rows_selected", "rows_total"]
    },
    "TenantInfo": {
      "type": "object",
      "properties": {
        "auto_detected": {
          "type": "boolean"
        },
        "column": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "required": ["column", "value", "auto_detected"]
    }
  }
}
