{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.paycaptain.com/schemas/shift.schema.json",
  "title": "PayCaptain Shift",
  "description": "Single-record rules for POST /shift. Cross-field and cross-record rules are at https://developer.paycaptain.com/rules.",
  "type": "object",
  "properties": {
    "shiftId": {
      "type": "string",
      "minLength": 1,
      "description": "Your identifier for the shift record. Unique in your system. Resubmitting the same shiftId updates the record.",
      "examples": [
        "SH-000481"
      ]
    },
    "company": {
      "type": "string",
      "description": "Company code issued by the PayCaptain team. Must match your PayCaptain company code exactly.",
      "examples": [
        "ABC"
      ]
    },
    "hrEmployeeId": {
      "type": "string",
      "description": "The person who worked the shift. Must match an employee already sent to PayCaptain.",
      "examples": [
        "9876543210"
      ]
    },
    "payrollCode": {
      "type": "string",
      "description": "The employment the shift belongs to. Must match that person's active employment.",
      "examples": [
        "123"
      ]
    },
    "date": {
      "type": "string",
      "format": "date",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Date of the shift.",
      "examples": [
        "2026-11-02"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "Working",
        "Holiday",
        "Sickness",
        "Unpaid Leave"
      ],
      "description": "What the record represents. Exactly one of the allowed values.",
      "examples": [
        "Working"
      ]
    },
    "payBasis": {
      "type": "string",
      "enum": [
        "Hourly",
        "Daily"
      ],
      "description": "How the shift is paid. Exactly one of the allowed values. Decides whether units are hours or days.",
      "examples": [
        "Hourly"
      ]
    },
    "units": {
      "type": "number",
      "minimum": 0,
      "description": "Quantity worked. Hours when payBasis is \"Hourly\", days when \"Daily\".",
      "examples": [
        7.5
      ]
    },
    "rate": {
      "type": "number",
      "minimum": 0,
      "description": "Rate of pay for this shift. Per hour or per day, matching payBasis.",
      "examples": [
        15.25
      ]
    },
    "sicknessDayType": {
      "type": "string",
      "enum": [
        "Qualifying",
        "Q",
        "Y",
        "Non Qualifying",
        "N"
      ],
      "description": "Whether a sickness day is a qualifying day. Only meaningful when type is \"Sickness\". \"Qualifying\", \"Q\" and \"Y\" mean a qualifying day; \"Non Qualifying\" and \"N\" mean it is not.",
      "examples": [
        "Qualifying"
      ]
    },
    "reason": {
      "type": "string",
      "description": "Reason for an absence, mainly for sickness records.",
      "examples": [
        "Flu"
      ]
    },
    "archived": {
      "type": "boolean",
      "default": false,
      "description": "Archive the shift so it is not paid. Send true with the same shiftId to remove the shift from payroll. Records are archived, never deleted.",
      "examples": [
        false
      ]
    },
    "location": {
      "type": "string",
      "description": "Location worked.",
      "examples": [
        "Baker Street"
      ]
    },
    "department": {
      "type": "string",
      "description": "Department worked.",
      "examples": [
        "Marketing"
      ]
    },
    "team": {
      "type": "string",
      "description": "Team worked.",
      "examples": [
        "Content"
      ]
    },
    "job": {
      "type": "string",
      "description": "Job worked.",
      "examples": [
        "Content Marketing"
      ]
    }
  },
  "required": [
    "shiftId",
    "company",
    "hrEmployeeId",
    "payrollCode",
    "date",
    "type",
    "payBasis",
    "units",
    "rate"
  ]
}
