{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/taktovka-com/json-schema/taktovka-com-hours-schema.json",
  "title": "Hours",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/taktovka-com-openapi.json#/components/schemas/Hours",
  "type": "object",
  "properties": {
    "employee_id": {
      "type": "string",
      "format": "uuid"
    },
    "month": {
      "type": "string",
      "pattern": "^(20\\d\\d|2100)-(0[1-9]|1[0-2])$",
      "description": "Calendar month, YYYY-MM, years 2000–2100"
    },
    "planned_minutes": {
      "type": "integer",
      "description": "Elapsed minutes of the published shifts starting in the month"
    },
    "paid_planned_minutes": {
      "type": "integer",
      "description": "The same less the breaks"
    },
    "counted_minutes": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "description": "Counted time from the door scan and manual entries, matched to the roster the way the app counts it (rounding, the plan, the break the law requires, a minor's break); null when attendance is off at every place of the person and nothing was clocked"
    },
    "fund": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "weekly_hours": {
              "type": "number"
            },
            "fund_minutes": {
              "type": "integer",
              "description": "Weekdays of the month that are not a day-off holiday, times a fifth of the weekly hours"
            },
            "holiday_minutes": {
              "type": "integer",
              "description": "Day-off holidays on weekdays of the month"
            },
            "absence_minutes": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Weekdays covered by an approved absence; only with absences:read, null without it"
            },
            "target_minutes": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "The fund less approved absences: what the plan should reach; only with absences:read, null without it"
            }
          },
          "required": [
            "weekly_hours",
            "fund_minutes",
            "holiday_minutes",
            "absence_minutes",
            "target_minutes"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Only for an employment contract (SK TPP, CZ HPP) with agreed weekly hours"
    },
    "confirmed": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "confirmed_at": {
              "type": "string",
              "format": "date-time",
              "description": "ISO 8601 instant"
            },
            "counted_minutes": {
              "type": "integer",
              "description": "Counted minutes at the moment of the signature"
            },
            "stale": {
              "type": "boolean",
              "description": "The month was corrected or counts differently since the signature"
            }
          },
          "required": [
            "confirmed_at",
            "counted_minutes",
            "stale"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "The person confirmed the month in the app"
    },
    "meals": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "count": {
              "type": "integer",
              "description": "Shifts that give a meal under the company's policy: more than 4 h of work in Slovakia, at least 3 h in Czechia, the break not counted"
            },
            "second": {
              "type": "integer",
              "description": "Second meals, on shifts longer than 11 h including the break, when the policy gives them"
            },
            "absence_days": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Working days of approved absences that give a meal when the policy includes absences; only with absences:read and without `location`, null otherwise"
            },
            "source": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "attendance",
                    "plan",
                    "both"
                  ]
                },
                {
                  "type": "null"
                }
              ],
              "description": "Where the shifts were read: counted time where the person clocked in that day at that place, the published plan elsewhere; null without a meal from work"
            },
            "form": {
              "type": "string",
              "enum": [
                "kitchen",
                "voucher",
                "allowance",
                "choice"
              ],
              "description": "How the company gives meals at the end of the month"
            },
            "choice": {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "voucher",
                    "allowance"
                  ]
                },
                {
                  "type": "null"
                }
              ],
              "description": "With form `choice` (Slovakia): what the person picked, null until they pick"
            }
          },
          "required": [
            "count",
            "second",
            "absence_days",
            "source",
            "form",
            "choice"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Meals of the month for the payroll accountant, who applies the amounts; null when the company has set no meal policy in the app or the person's contract is outside it"
    }
  },
  "required": [
    "employee_id",
    "month",
    "planned_minutes",
    "paid_planned_minutes",
    "counted_minutes",
    "fund",
    "confirmed",
    "meals"
  ],
  "additionalProperties": false
}