{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://dashremix.com/spec/travel/1.1.0/travel@1.schema.json",
 "title": "travel@1 v1.1.0",
 "description": "One property per table (an array of rows). Generated from schema.sql by spec/build.py. Extension tables (x_<owner>_*) belong to forks and board-derived tables (d_*) to the board that rebuilds them; both are allowed as additional properties.",
 "type": "object",
 "properties": {
  "meta": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "key": {
      "type": [
       "string",
       "null"
      ]
     },
     "value": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [],
    "additionalProperties": false
   }
  },
  "countries": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "country_code": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{2}$"
     },
     "name": {
      "type": "string"
     },
     "source_label": {
      "type": "string"
     },
     "region": {
      "type": "string"
     },
     "schengen": {
      "type": "integer"
     },
     "is_region": {
      "type": "integer"
     },
     "is_home": {
      "type": "integer"
     },
     "color_idx": {
      "type": "integer"
     }
    },
    "required": [
     "name",
     "source_label",
     "region",
     "schengen",
     "is_region",
     "is_home",
     "color_idx"
    ],
    "additionalProperties": false
   }
  },
  "stays": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "stay_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "start_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "end_date": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "nights": {
      "type": "integer"
     },
     "country_code": {
      "type": "string",
      "pattern": "^[A-Z]{2}$"
     },
     "sheet_year": {
      "type": [
       "integer",
       "null"
      ]
     },
     "sheet_days": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source_tab": {
      "type": "string"
     },
     "source_row": {
      "type": "integer"
     },
     "adjusted": {
      "type": [
       "string",
       "null"
      ]
     },
     "city": {
      "type": [
       "string",
       "null"
      ]
     },
     "source": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "imported_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     }
    },
    "required": [
     "start_date",
     "end_date",
     "nights",
     "country_code",
     "source_tab",
     "source_row"
    ],
    "additionalProperties": false
   }
  },
  "stay_days": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "day": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "country_code": {
      "type": [
       "string",
       "null"
      ]
     },
     "stay_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "year": {
      "type": "integer"
     },
     "month": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}$"
     },
     "doy": {
      "type": "integer"
     }
    },
    "required": [
     "year",
     "month",
     "doy"
    ],
    "additionalProperties": false
   }
  },
  "thresholds": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "rule_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "label": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "rolling",
       "calendar_year",
       "us_spt",
       "schengen"
      ]
     },
     "country_code": {
      "type": [
       "string",
       "null"
      ]
     },
     "window_days": {
      "type": [
       "integer",
       "null"
      ]
     },
     "limit_days": {
      "type": "integer"
     },
     "min_days": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source": {
      "type": "string"
     },
     "source_note": {
      "type": [
       "string",
       "null"
      ]
     },
     "ord": {
      "type": "integer"
     }
    },
    "required": [
     "label",
     "kind",
     "limit_days",
     "source",
     "ord"
    ],
    "additionalProperties": false
   }
  },
  "plan_slots": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "tab": {
      "type": "string"
     },
     "year": {
      "type": "integer"
     },
     "slot": {
      "type": "integer"
     },
     "month": {
      "type": "integer"
     },
     "location": {
      "type": [
       "string",
       "null"
      ]
     },
     "country_code": {
      "type": [
       "string",
       "null"
      ]
     },
     "note": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "tab",
     "year",
     "slot",
     "month"
    ],
    "additionalProperties": false
   }
  },
  "sheet_summaries": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "tab": {
      "type": "string"
     },
     "year": {
      "type": "integer"
     },
     "measure": {
      "type": "string"
     },
     "label": {
      "type": "string"
     },
     "value": {
      "type": [
       "number",
       "null"
      ]
     },
     "source_cell": {
      "type": "string"
     }
    },
    "required": [
     "tab",
     "year",
     "measure",
     "label",
     "source_cell"
    ],
    "additionalProperties": false
   }
  },
  "data_issues": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "issue_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "severity": {
      "type": "string",
      "enum": [
       "info",
       "warn",
       "error"
      ]
     },
     "kind": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "detail": {
      "type": "string"
     },
     "source_tab": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_cell": {
      "type": [
       "string",
       "null"
      ]
     },
     "handling": {
      "type": "string"
     }
    },
    "required": [
     "severity",
     "kind",
     "title",
     "detail",
     "handling"
    ],
    "additionalProperties": false
   }
  },
  "annotations": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "target": {
      "type": [
       "string",
       "null"
      ]
     },
     "body": {
      "type": [
       "string",
       "null"
      ]
     },
     "annotation_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "kind": {
      "type": [
       "string",
       "null"
      ]
     },
     "author": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ]
     },
     "data_hash": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [],
    "additionalProperties": false
   }
  },
  "metric_registry": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "metric_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "version": {
      "type": [
       "integer",
       "null"
      ]
     },
     "unit": {
      "type": [
       "string",
       "null"
      ]
     },
     "params": {
      "type": [
       "string",
       "null"
      ]
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     },
     "sql": {
      "type": [
       "string",
       "null"
      ]
     },
     "test": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [],
    "additionalProperties": false
   }
  }
 },
 "required": [
  "meta",
  "countries",
  "stays",
  "stay_days",
  "thresholds"
 ],
 "patternProperties": {
  "^x_[a-z0-9_]+$": {
   "type": "array"
  },
  "^d_[a-z0-9_]+$": {
   "type": "array"
  }
 },
 "additionalProperties": false
}
