{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://dashremix.com/spec/people/1.0.0/people@1.schema.json",
 "title": "people@1 v1.0.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"
     },
     "value": {
      "type": "string"
     }
    },
    "required": [
     "key",
     "value"
    ],
    "additionalProperties": false
   }
  },
  "teams": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "team_id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     }
    },
    "required": [
     "team_id",
     "name"
    ],
    "additionalProperties": false
   }
  },
  "roles": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "role_id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     }
    },
    "required": [
     "role_id",
     "name"
    ],
    "additionalProperties": false
   }
  },
  "staffing_snapshots": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "month_start": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "team_id": {
      "type": "string"
     },
     "role_id": {
      "type": "string"
     },
     "actual_headcount": {
      "type": [
       "integer",
       "null"
      ]
     },
     "planned_headcount": {
      "type": [
       "integer",
       "null"
      ]
     },
     "actual_fte": {
      "type": [
       "number",
       "null"
      ]
     },
     "planned_fte": {
      "type": [
       "number",
       "null"
      ]
     },
     "actual_cost": {
      "type": [
       "number",
       "null"
      ]
     },
     "planned_cost": {
      "type": [
       "number",
       "null"
      ]
     },
     "currency": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[A-Z]{3}$"
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "month_start",
     "team_id",
     "role_id",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "hiring_openings": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "opening_id": {
      "type": "string"
     },
     "team_id": {
      "type": "string"
     },
     "role_id": {
      "type": "string"
     },
     "opened_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "closed_on": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "status": {
      "type": "string",
      "enum": [
       "open",
       "paused",
       "filled",
       "cancelled"
      ]
     },
     "seats": {
      "type": "integer"
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "opening_id",
     "team_id",
     "role_id",
     "opened_on",
     "status",
     "seats",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "hiring_stage_counts": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "opening_id": {
      "type": "string"
     },
     "cohort_month": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "stage": {
      "type": "string",
      "enum": [
       "applied",
       "screened",
       "interview",
       "offer",
       "hired"
      ]
     },
     "current_count": {
      "type": [
       "integer",
       "null"
      ]
     },
     "reached_count": {
      "type": [
       "integer",
       "null"
      ]
     },
     "hire_duration_count": {
      "type": [
       "integer",
       "null"
      ]
     },
     "hire_duration_seconds": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "opening_id",
     "cohort_month",
     "stage",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "leave_coverage": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "team_id": {
      "type": "string"
     },
     "week_start": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "scheduled_headcount": {
      "type": "integer"
     },
     "scheduled_seconds": {
      "type": "integer"
     },
     "leave_seconds": {
      "type": "integer"
     },
     "peak_simultaneous_away": {
      "type": [
       "integer",
       "null"
      ]
     },
     "min_available_headcount": {
      "type": [
       "integer",
       "null"
      ]
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "team_id",
     "week_start",
     "scheduled_headcount",
     "scheduled_seconds",
     "leave_seconds",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "leave_balances": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "team_id": {
      "type": "string"
     },
     "balance_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "leave_kind": {
      "type": "string",
      "enum": [
       "annual",
       "personal",
       "compensatory",
       "other"
      ]
     },
     "eligible_count": {
      "type": "integer"
     },
     "remaining_seconds": {
      "type": "integer"
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "team_id",
     "balance_on",
     "leave_kind",
     "eligible_count",
     "remaining_seconds",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "survey_waves": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "wave_id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "opened_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "closed_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "wave_id",
     "name",
     "opened_on",
     "closed_on",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "survey_questions": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "question_id": {
      "type": "string"
     },
     "label": {
      "type": "string"
     },
     "scale_min": {
      "type": "number"
     },
     "scale_max": {
      "type": "number"
     }
    },
    "required": [
     "question_id",
     "label",
     "scale_min",
     "scale_max"
    ],
    "additionalProperties": false
   }
  },
  "survey_scores": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "wave_id": {
      "type": "string"
     },
     "team_id": {
      "type": "string"
     },
     "question_id": {
      "type": "string"
     },
     "response_count": {
      "type": "integer"
     },
     "score_sum": {
      "type": "number"
     },
     "source": {
      "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$"
     }
    },
    "required": [
     "wave_id",
     "team_id",
     "question_id",
     "response_count",
     "score_sum",
     "source",
     "source_ref",
     "imported_at"
    ],
    "additionalProperties": false
   }
  },
  "import_issues": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "issue_id": {
      "type": "string"
     },
     "severity": {
      "type": "string",
      "enum": [
       "info",
       "warn",
       "error"
      ]
     },
     "kind": {
      "type": "string"
     },
     "affected_rows": {
      "type": "integer"
     },
     "source": {
      "type": "string"
     },
     "source_ref": {
      "type": "string"
     },
     "detail": {
      "type": "string"
     },
     "handling": {
      "type": "string"
     }
    },
    "required": [
     "issue_id",
     "severity",
     "kind",
     "affected_rows",
     "source",
     "source_ref",
     "detail",
     "handling"
    ],
    "additionalProperties": false
   }
  },
  "overrides": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "override_id": {
      "type": "string"
     },
     "target": {
      "type": "string"
     },
     "field": {
      "type": [
       "string",
       "null"
      ]
     },
     "old_value": {
      "type": [
       "string",
       "null"
      ]
     },
     "new_value": {
      "type": [
       "string",
       "null"
      ]
     },
     "reason": {
      "type": "string"
     },
     "evidence": {
      "type": [
       "string",
       "null"
      ]
     },
     "author": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     }
    },
    "required": [
     "override_id",
     "target",
     "reason"
    ],
    "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"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?Z$"
     },
     "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",
  "teams"
 ],
 "patternProperties": {
  "^x_[a-z0-9_]+$": {
   "type": "array"
  },
  "^d_[a-z0-9_]+$": {
   "type": "array"
  }
 },
 "additionalProperties": false
}
