{
  "openapi": "3.1.0",
  "info": {
    "title": "Focus Journal API",
    "version": "1.4.1",
    "description": "Manage a personal focus journal with a token issued in the web UI. See https://focus.parklab.work/docs for the browser workflow and usage examples."
  },
  "servers": [
    {
      "url": "https://focus.parklab.work"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/api/journal": {
      "get": {
        "operationId": "getJournal",
        "summary": "Read the account journal",
        "description": "Accepts read and write tokens. An empty journal starts at revision 0.",
        "responses": {
          "200": {
            "description": "Current journal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Journal"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, revoked or expired token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Database unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "replaceJournal",
        "summary": "Save the complete journal",
        "description": "Write token required. Read the latest revision, preserve unchanged records and send the complete state. On conflict, reapply the intended change to the returned current journal.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Journal"
                  },
                  {
                    "properties": {
                      "revision": {
                        "maximum": 2147483646
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "New revision",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "revision"
                  ],
                  "properties": {
                    "revision": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 2147483647
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Revision conflict. This is the current journal.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Journal"
                }
              }
            }
          },
          "400": {
            "description": "Invalid journal format or time range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, revoked or expired token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Insufficient write permission or invalid content type",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Size limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Database unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/reports": {
      "get": {
        "operationId": "listReportPresets",
        "summary": "List built-in and saved report presets",
        "responses": {
          "200": {
            "description": "Account report presets",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "presets",
                    "defaultTimezone"
                  ],
                  "properties": {
                    "presets": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ReportPreset"
                      }
                    },
                    "defaultTimezone": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Report unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/reports/{id}": {
      "get": {
        "operationId": "getReport",
        "summary": "Compute an analysis report from the latest journal",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-]{1,64}$"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "description": "Optional IANA timezone override",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Analysis data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Report"
                }
              }
            }
          },
          "400": {
            "description": "Invalid timezone",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown report preset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Report unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/reports/{id}.pdf": {
      "get": {
        "operationId": "downloadReportPdf",
        "summary": "Download the analysis report as PDF",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-]{1,64}$"
            }
          },
          {
            "name": "timezone",
            "in": "query",
            "description": "Optional IANA timezone override",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PDF attachment",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid timezone",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid token",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown report preset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Report unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Issue a personal API token in the focus journal web UI."
      }
    },
    "schemas": {
      "Active": {
        "type": "object",
        "required": [
          "id",
          "project",
          "start",
          "task",
          "note",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "project": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "start": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Unix time in milliseconds, no more than one minute ahead of the server clock."
          },
          "task": {
            "type": "string",
            "maxLength": 120
          },
          "note": {
            "type": "string",
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "enum": [
              "other",
              "meeting",
              "review"
            ]
          }
        },
        "additionalProperties": false
      },
      "Entry": {
        "type": "object",
        "required": [
          "id",
          "project",
          "start",
          "task",
          "note",
          "type",
          "end",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "project": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "start": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Unix time in milliseconds, no more than one minute ahead of the server clock."
          },
          "task": {
            "type": "string",
            "maxLength": 120
          },
          "note": {
            "type": "string",
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "enum": [
              "other",
              "meeting",
              "review"
            ]
          },
          "end": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Unix time in milliseconds, no more than one minute ahead of the server clock."
          },
          "status": {
            "type": "string",
            "enum": [
              "continue",
              "done",
              "waiting"
            ]
          }
        },
        "additionalProperties": false
      },
      "State": {
        "type": "object",
        "required": [
          "projects",
          "active",
          "entries"
        ],
        "properties": {
          "projects": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9-]{1,64}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60,
                  "pattern": "\\S"
                },
                "parentId": {
                  "oneOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-zA-Z0-9-]{1,64}$"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Parent project in this journal. Omit or use null for a top-level project. Cycles are rejected."
                },
                "tags": {
                  "type": "array",
                  "maxItems": 20,
                  "uniqueItems": true,
                  "items": {
                    "type": "string",
                    "maxLength": 40,
                    "pattern": "^(?=[^,]*\\S)[^,]+$"
                  }
                }
              },
              "additionalProperties": false
            }
          },
          "active": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Active"
              },
              {
                "type": "null"
              }
            ]
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Entry"
            }
          },
          "delegations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Delegation"
            }
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimePlan"
            }
          },
          "dailyPlans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DailyPlan"
            }
          },
          "reportPresets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SavedReportPreset"
            },
            "maxItems": 30
          }
        },
        "description": "Project IDs are unique. Active and completed record IDs are unique across both. Project references must exist. Completed records cannot overlap, and the active record starts at or after the latest completed end. Maximum encoded state size is 200,000 UTF-8 bytes. Project parent references cannot form cycles. Delegation record IDs must also be unique across all records.",
        "additionalProperties": false
      },
      "Journal": {
        "type": "object",
        "required": [
          "revision",
          "state"
        ],
        "properties": {
          "revision": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2147483647
          },
          "state": {
            "$ref": "#/components/schemas/State"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "Delegation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "project": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "start": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "description": "Unix time in milliseconds, no more than one minute ahead of the server clock."
          },
          "task": {
            "type": "string",
            "maxLength": 120
          },
          "note": {
            "type": "string",
            "maxLength": 200
          },
          "type": {
            "type": "string",
            "enum": [
              "other",
              "meeting",
              "review"
            ]
          },
          "agent": {
            "type": "string",
            "maxLength": 80,
            "pattern": "\\S"
          },
          "end": {
            "oneOf": [
              {
                "type": "integer",
                "format": "int64",
                "minimum": 1,
                "description": "Unix time in milliseconds, no more than one minute ahead of the server clock."
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "continue",
                  "done",
                  "waiting"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "project",
          "start",
          "task",
          "note",
          "type",
          "agent",
          "end",
          "status"
        ],
        "description": "Independent timer. Set both end and status to null while running. Delegations can overlap other timers.",
        "additionalProperties": false
      },
      "TimePlan": {
        "type": "object",
        "required": [
          "project",
          "start",
          "end"
        ],
        "properties": {
          "project": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "start": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 8640000000000000,
            "description": "Unix milliseconds. Future timestamps are allowed."
          },
          "end": {
            "type": "integer",
            "format": "int64",
            "minimum": 1,
            "maximum": 8640000000000000,
            "description": "Unix milliseconds. Future timestamps are allowed."
          }
        },
        "description": "End must be later than start. Time plan intervals cannot overlap.",
        "additionalProperties": false
      },
      "DailyPlan": {
        "type": "object",
        "required": [
          "date",
          "projects"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date in the user\u2019s calendar timezone. Only one daily plan per date."
          },
          "projects": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9-]{1,64}$"
            }
          }
        },
        "additionalProperties": false
      },
      "ReportPreset": {
        "type": "object",
        "required": [
          "id",
          "name",
          "days",
          "sections"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "days": {
            "type": "integer",
            "enum": [
              7,
              28,
              90
            ]
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "trend",
                "projects",
                "rhythm",
                "plans",
                "delegations",
                "surges",
                "planGaps",
                "categoryShifts",
                "timeOfDay",
                "weekdays"
              ]
            },
            "uniqueItems": true,
            "minItems": 1
          },
          "project": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^[a-zA-Z0-9-]{1,64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "tag": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "type": "string",
            "maxLength": 80,
            "example": "Asia/Seoul"
          },
          "builtin": {
            "type": "boolean"
          }
        }
      },
      "SavedReportPreset": {
        "type": "object",
        "required": [
          "id",
          "name",
          "days",
          "sections",
          "timezone"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9-]{1,64}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "days": {
            "type": "integer",
            "enum": [
              7,
              28,
              90
            ]
          },
          "sections": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "trend",
                "projects",
                "rhythm",
                "plans",
                "delegations",
                "surges",
                "planGaps",
                "categoryShifts",
                "timeOfDay",
                "weekdays"
              ]
            },
            "uniqueItems": true,
            "minItems": 1
          },
          "project": {
            "oneOf": [
              {
                "type": "string",
                "pattern": "^[a-zA-Z0-9-]{1,64}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "tag": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "type": "string",
            "maxLength": 80,
            "example": "Asia/Seoul"
          }
        },
        "additionalProperties": false
      },
      "Report": {
        "type": "object",
        "required": [
          "preset",
          "timezone",
          "from",
          "until",
          "startDate",
          "endDate",
          "generatedAt",
          "filters",
          "totals"
        ],
        "properties": {
          "preset": {
            "$ref": "#/components/schemas/ReportPreset"
          },
          "timezone": {
            "type": "string"
          },
          "from": {
            "type": "integer",
            "format": "int64"
          },
          "until": {
            "type": "integer",
            "format": "int64"
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "endDate": {
            "type": "string",
            "format": "date"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "filters": {
            "type": "object",
            "required": [
              "project",
              "tag"
            ],
            "properties": {
              "project": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tag": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "totals": {
            "type": "object",
            "required": [
              "totalMs",
              "sessions",
              "activeDays"
            ],
            "properties": {
              "totalMs": {
                "type": "integer",
                "minimum": 0
              },
              "sessions": {
                "type": "integer",
                "minimum": 0
              },
              "activeDays": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "trend": {
            "type": "object",
            "required": [
              "days",
              "previousMs"
            ],
            "properties": {
              "days": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "date",
                    "ms"
                  ],
                  "properties": {
                    "date": {
                      "type": "string",
                      "format": "date"
                    },
                    "ms": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              },
              "previousMs": {
                "type": "integer",
                "minimum": 0
              }
            }
          },
          "projects": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "ms",
                "percentage"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9-]{1,64}$"
                },
                "name": {
                  "type": "string"
                },
                "ms": {
                  "type": "integer",
                  "minimum": 0
                },
                "percentage": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "rhythm": {
            "type": "object",
            "required": [
              "medianMs",
              "switches",
              "startsByHour",
              "peakHours"
            ],
            "properties": {
              "medianMs": {
                "oneOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "switches": {
                "type": "integer",
                "minimum": 0
              },
              "startsByHour": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0
                }
              },
              "peakHours": {
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          },
          "plans": {
            "type": "object",
            "required": [
              "plannedMs",
              "followedMs",
              "percentage"
            ],
            "properties": {
              "plannedMs": {
                "type": "integer",
                "minimum": 0
              },
              "followedMs": {
                "type": "integer",
                "minimum": 0
              },
              "percentage": {
                "oneOf": [
                  {
                    "type": "integer",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "delegations": {
            "type": "object",
            "required": [
              "running",
              "agents"
            ],
            "properties": {
              "running": {
                "type": "integer",
                "minimum": 0
              },
              "agents": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "name",
                    "ms",
                    "sessions"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "ms": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "sessions": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "surges": {
            "type": "object",
            "required": [
              "days",
              "previousHasRecords",
              "minimumIncreaseMs",
              "minimumIncreasePercent",
              "projects"
            ],
            "properties": {
              "days": {
                "type": "integer",
                "minimum": 0
              },
              "previousHasRecords": {
                "type": "boolean"
              },
              "minimumIncreaseMs": {
                "type": "integer",
                "minimum": 0
              },
              "minimumIncreasePercent": {
                "type": "integer",
                "minimum": 0
              },
              "projects": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "name",
                    "recentMs",
                    "previousMs",
                    "increaseMs",
                    "increasePercent"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "recentMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "previousMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "increaseMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "increasePercent": {
                      "oneOf": [
                        {
                          "type": "integer",
                          "minimum": 0
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "planGaps": {
            "type": "object",
            "required": [
              "plannedProjects",
              "projects"
            ],
            "properties": {
              "plannedProjects": {
                "type": "integer",
                "minimum": 0
              },
              "projects": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "name",
                    "plannedMs",
                    "followedMs",
                    "gapMs",
                    "coveragePercent",
                    "slots"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "plannedMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "followedMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "gapMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "coveragePercent": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "slots": {
                      "type": "integer",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "categoryShifts": {
            "type": "object",
            "required": [
              "recentTotalMs",
              "previousTotalMs",
              "minimumDropPoints",
              "categories"
            ],
            "properties": {
              "recentTotalMs": {
                "type": "integer",
                "minimum": 0
              },
              "previousTotalMs": {
                "type": "integer",
                "minimum": 0
              },
              "minimumDropPoints": {
                "type": "integer",
                "minimum": 0
              },
              "categories": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "name",
                    "previousMs",
                    "recentMs",
                    "previousSharePercent",
                    "recentSharePercent",
                    "dropPoints"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "previousMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "recentMs": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "previousSharePercent": {
                      "type": "number",
                      "minimum": 0
                    },
                    "recentSharePercent": {
                      "type": "number",
                      "minimum": 0
                    },
                    "dropPoints": {
                      "type": "number",
                      "minimum": 0
                    }
                  }
                }
              }
            }
          },
          "timeOfDay": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "hours",
                "totalMs",
                "projects"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "daytime",
                    "evening",
                    "night"
                  ]
                },
                "hours": {
                  "type": "string"
                },
                "totalMs": {
                  "type": "integer",
                  "minimum": 0
                },
                "projects": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "id",
                      "name",
                      "ms"
                    ],
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "ms": {
                        "type": "integer",
                        "minimum": 0
                      }
                    }
                  }
                }
              }
            }
          },
          "weekdays": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "weekday",
                "dates",
                "totalMs",
                "averageMs"
              ],
              "properties": {
                "weekday": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 7,
                  "description": "ISO weekday, Monday is 1."
                },
                "dates": {
                  "type": "integer",
                  "minimum": 0
                },
                "totalMs": {
                  "type": "integer",
                  "minimum": 0
                },
                "averageMs": {
                  "type": "integer",
                  "minimum": 0
                }
              }
            }
          }
        }
      }
    }
  }
}
