{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://dashremix.com/spec/calendar/1.1.0/calendar@1.schema.json",
 "title": "calendar@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
   }
  },
  "calendars": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "calendar_id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "owner_self": {
      "type": [
       "integer",
       "null"
      ]
     },
     "kind": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "work",
       "personal",
       "shared",
       "subscribed",
       null
      ]
     },
     "color_idx": {
      "type": [
       "integer",
       "null"
      ]
     },
     "tz": {
      "type": [
       "string",
       "null"
      ]
     },
     "source": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "ics-google",
       "ics-apple",
       "ics-outlook",
       "ics",
       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": [
     "calendar_id",
     "name"
    ],
    "additionalProperties": false
   }
  },
  "categories": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "category": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "meeting",
       "focus",
       "personal",
       "other",
       "time_off"
      ]
     },
     "color_idx": {
      "type": [
       "integer",
       "null"
      ]
     },
     "ord": {
      "type": [
       "integer",
       "null"
      ]
     },
     "description": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "category",
     "kind"
    ],
    "additionalProperties": false
   }
  },
  "event_rules": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "rule_id": {
      "type": "string"
     },
     "ord": {
      "type": "integer"
     },
     "match": {
      "type": "string"
     },
     "category": {
      "type": [
       "string",
       "null"
      ]
     },
     "focus": {
      "type": [
       "integer",
       "null"
      ]
     },
     "ignore": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "rule_id",
     "ord",
     "match"
    ],
    "additionalProperties": false
   }
  },
  "events": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "event_id": {
      "type": "string"
     },
     "calendar_id": {
      "type": "string"
     },
     "uid": {
      "type": [
       "string",
       "null"
      ]
     },
     "recurrence_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "start_utc": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "end_utc": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "tz": {
      "type": "string"
     },
     "all_day": {
      "type": "integer"
     },
     "title": {
      "type": [
       "string",
       "null"
      ]
     },
     "location": {
      "type": [
       "string",
       "null"
      ]
     },
     "is_online": {
      "type": [
       "integer",
       "null"
      ]
     },
     "organizer_self": {
      "type": [
       "integer",
       "null"
      ]
     },
     "attendees_n": {
      "type": [
       "integer",
       "null"
      ]
     },
     "declined_n": {
      "type": [
       "integer",
       "null"
      ]
     },
     "response": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "accepted",
       "tentative",
       "declined",
       "needs_action",
       "none",
       null
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "confirmed",
       "tentative",
       "cancelled",
       null
      ]
     },
     "transparency": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "busy",
       "free",
       null
      ]
     },
     "recurring": {
      "type": "integer"
     },
     "series_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "category": {
      "type": [
       "string",
       "null"
      ]
     },
     "focus": {
      "type": [
       "integer",
       "null"
      ]
     },
     "rule_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "duplicate_of": {
      "type": [
       "string",
       "null"
      ]
     },
     "excluded": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "cancelled",
       "declined",
       "duplicate",
       "all_day",
       "free",
       "ignored",
       null
      ]
     },
     "source": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "ics-google",
       "ics-apple",
       "ics-outlook",
       "ics",
       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$"
     },
     "confidence": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "event_id",
     "calendar_id",
     "start_utc",
     "end_utc",
     "tz",
     "all_day",
     "recurring"
    ],
    "additionalProperties": false
   }
  },
  "event_days": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "event_id": {
      "type": "string"
     },
     "day": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "start_s": {
      "type": "integer"
     },
     "end_s": {
      "type": "integer"
     },
     "duration_s": {
      "type": "integer"
     }
    },
    "required": [
     "event_id",
     "day",
     "start_s",
     "end_s",
     "duration_s"
    ],
    "additionalProperties": false
   }
  },
  "time_entries": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "entry_id": {
      "type": "string"
     },
     "day": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "duration_s": {
      "type": "integer"
     },
     "start_utc": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "end_utc": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "tz": {
      "type": [
       "string",
       "null"
      ]
     },
     "client_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "client": {
      "type": [
       "string",
       "null"
      ]
     },
     "project_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "project": {
      "type": [
       "string",
       "null"
      ]
     },
     "task_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "task": {
      "type": [
       "string",
       "null"
      ]
     },
     "person_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "billable": {
      "type": [
       "integer",
       "null"
      ]
     },
     "billed": {
      "type": [
       "integer",
       "null"
      ]
     },
     "hourly_rate": {
      "type": [
       "number",
       "null"
      ]
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{3}$"
     },
     "source": {
      "type": "string",
      "enum": [
       "toggl-csv",
       "harvest-csv",
       "clockify-csv",
       "project-csv",
       "sheet-csv"
      ]
     },
     "source_account": {
      "type": "string"
     },
     "source_ref": {
      "type": "string"
     },
     "imported_at": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "confidence": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "entry_id",
     "day",
     "duration_s",
     "source",
     "source_account",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "data_issues": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "issue_id": {
      "type": "string"
     },
     "severity": {
      "type": "string",
      "enum": [
       "info",
       "warn",
       "error"
      ]
     },
     "kind": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "detail": {
      "type": "string"
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "handling": {
      "type": "string"
     }
    },
    "required": [
     "issue_id",
     "severity",
     "kind",
     "title",
     "detail",
     "handling"
    ],
    "additionalProperties": false
   }
  },
  "annotations": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "annotation_id": {
      "type": "string"
     },
     "target": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "body": {
      "type": "string"
     },
     "author": {
      "type": [
       "string",
       "null"
      ]
     },
     "source_ref": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ]
     },
     "data_hash": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": [
       "string",
       "null"
      ]
     }
    },
    "required": [
     "annotation_id",
     "target",
     "kind",
     "body"
    ],
    "additionalProperties": false
   }
  },
  "metric_registry": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "metric_id": {
      "type": "string"
     },
     "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": [
     "metric_id"
    ],
    "additionalProperties": false
   }
  }
 },
 "required": [
  "meta",
  "calendars",
  "events",
  "event_days"
 ],
 "patternProperties": {
  "^x_[a-z0-9_]+$": {
   "type": "array"
  },
  "^d_[a-z0-9_]+$": {
   "type": "array"
  }
 },
 "additionalProperties": false
}
