{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/taktovka-com/json-schema/taktovka-com-shift-schema.json",
  "title": "Shift",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/taktovka-com-openapi.json#/components/schemas/Shift",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "schedule_id": {
      "type": "string",
      "format": "uuid"
    },
    "version": {
      "type": "integer",
      "description": "The published version the shift is read from"
    },
    "location_id": {
      "type": "string",
      "format": "uuid"
    },
    "position_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ]
    },
    "date": {
      "type": "string",
      "format": "date",
      "description": "Local date the shift starts on"
    },
    "start_local": {
      "type": "string",
      "pattern": "^\\d{2}:\\d{2}$",
      "description": "Wall-clock time at the location, HH:MM"
    },
    "end_local": {
      "type": "string",
      "pattern": "^\\d{2}:\\d{2}$",
      "description": "Wall-clock end; not after start_local means the next day"
    },
    "tz": {
      "type": "string",
      "description": "IANA time zone of the location when the version was published"
    },
    "starts_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 instant with the location's offset at that moment"
    },
    "ends_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 instant with the location's offset at that moment"
    },
    "break_min": {
      "type": "integer",
      "description": "Unpaid break, minutes"
    },
    "minutes": {
      "type": "integer",
      "description": "Elapsed minutes from start to end"
    },
    "paid_minutes": {
      "type": "integer",
      "description": "Elapsed minutes less the break"
    },
    "headcount": {
      "type": "integer",
      "description": "People the shift needs"
    },
    "assignments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "employee_id": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "assigned",
              "confirmed",
              "swap_requested",
              "declined"
            ],
            "description": "declined: the person gave the seat back and does not work it"
          }
        },
        "required": [
          "employee_id",
          "state"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "id",
    "schedule_id",
    "version",
    "location_id",
    "position_id",
    "date",
    "start_local",
    "end_local",
    "tz",
    "starts_at",
    "ends_at",
    "break_min",
    "minutes",
    "paid_minutes",
    "headcount",
    "assignments"
  ],
  "additionalProperties": false
}