{
 "openapi": "3.1.0",
 "info": {
  "title": "Leave Types (HRMS)",
  "version": "20261030b",
  "description": "What a day off can be called, how entitlement to it accrues, and what it costs. Every leave request and every balance is against one of these."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "leave-types": {
    "type": "object",
    "required": [
     "code",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "code": {
      "type": "string",
      "description": "Code"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "annual_accrual_days": {
      "type": "string",
      "format": "decimal",
      "description": "Days a year"
     },
     "paid": {
      "type": "boolean",
      "description": "Paid leave"
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "category": {
      "type": "string",
      "description": "Category",
      "enum": [
       "vacation",
       "sick",
       "personal",
       "parental",
       "bereavement",
       "jury",
       "military",
       "unpaid",
       "sabbatical",
       "study",
       "carer",
       "public_holiday",
       "time_off_in_lieu"
      ]
     },
     "unit": {
      "type": "string",
      "description": "Unit",
      "enum": [
       "days",
       "hours"
      ]
     },
     "accrual_method": {
      "type": "string",
      "description": "Accrues",
      "enum": [
       "annual",
       "monthly",
       "per_pay_period",
       "hours_worked",
       "anniversary",
       "none"
      ]
     },
     "accrual_rate": {
      "type": "string",
      "format": "decimal",
      "description": "Accrual a year"
     },
     "accrual_per_hours_worked": {
      "type": "string",
      "format": "decimal",
      "description": "Accrual per hours worked"
     },
     "max_balance": {
      "type": "string",
      "format": "decimal",
      "description": "Balance cap"
     },
     "max_carryover": {
      "type": "string",
      "format": "decimal",
      "description": "Max carryover"
     },
     "carryover_expires_on": {
      "type": "string",
      "description": "Carried days expire on"
     },
     "waiting_period_days": {
      "type": "integer",
      "description": "Waiting period (days)"
     },
     "requires_approval": {
      "type": "boolean",
      "description": "Needs approval"
     },
     "allows_negative": {
      "type": "boolean",
      "description": "Can go negative"
     },
     "requires_certificate_after": {
      "type": "integer",
      "description": "Requires certificate after"
     },
     "earning_code": {
      "type": "string",
      "description": "Earning code"
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     },
     "accrual_basis": {
      "type": "string",
      "description": "Accrual runs counted from",
      "enum": [
       "A fixed number a year",
       "The pay calendar"
      ]
     },
     "accrual_periods_per_year": {
      "type": "integer",
      "description": "Runs a year (fixed)"
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/hrms/leave-types": {
   "get": {
    "summary": "list leave-types",
    "operationId": "list_leave_types_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create leave-types",
    "operationId": "create_leave_types_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/hrms/leave-types/{id}": {
   "get": {
    "summary": "get leave-types",
    "operationId": "get_leave_types_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change leave-types",
    "operationId": "change_leave_types_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete leave-types",
    "operationId": "delete_leave_types_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/hrms/leave-types/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_leave_types_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}