{
 "openapi": "3.1.0",
 "info": {
  "title": "Work Relationships (HRMS)",
  "version": "20261030b",
  "description": "The layer between a person and their assignments. A rehire is a new relationship and the same person — which is what keeps continuous service right."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "work-relationships": {
    "type": "object",
    "required": [
     "person_id",
     "start_date"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "person_id": {
      "type": "string",
      "format": "uuid",
      "description": "Person"
     },
     "employee_id": {
      "type": "string",
      "format": "uuid",
      "description": "Employee record"
     },
     "relationship_no": {
      "type": "string",
      "description": "Relationship no",
      "readOnly": true
     },
     "legal_employer_org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Legal employer"
     },
     "worker_type": {
      "type": "string",
      "description": "Worker type",
      "enum": [
       "employee",
       "contractor",
       "agency",
       "intern",
       "consultant",
       "volunteer",
       "apprentice",
       "pensioner"
      ]
     },
     "is_primary": {
      "type": "boolean",
      "description": "Primary relationship"
     },
     "start_date": {
      "type": "string",
      "format": "date",
      "description": "Start date"
     },
     "end_date": {
      "type": "string",
      "format": "date",
      "description": "End date"
     },
     "original_hire_date": {
      "type": "string",
      "format": "date",
      "description": "Original hire date"
     },
     "continuous_service_date": {
      "type": "string",
      "format": "date",
      "description": "Continuous service from"
     },
     "service_break_days": {
      "type": "integer",
      "description": "Service break (days)"
     },
     "employment_basis": {
      "type": "string",
      "description": "Basis",
      "enum": [
       "permanent",
       "fixed_term",
       "casual",
       "zero_hours",
       "seasonal",
       "probationary"
      ]
     },
     "contract_end_date": {
      "type": "string",
      "format": "date",
      "description": "Contract ends"
     },
     "probation_end_date": {
      "type": "string",
      "format": "date",
      "description": "Probation ends"
     },
     "notice_period_days": {
      "type": "integer",
      "description": "Notice from the employee (days)"
     },
     "notice_period_days_employer": {
      "type": "integer",
      "description": "Notice from the employer (days)"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "enum": [
       "pending",
       "active",
       "suspended",
       "on_leave",
       "notice",
       "ended"
      ]
     },
     "termination_reason": {
      "type": "string",
      "description": "Termination reason"
     },
     "termination_type": {
      "type": "string",
      "description": "Termination type"
     },
     "is_rehire_eligible": {
      "type": "boolean",
      "description": "Is rehire eligible"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "effective_from": {
      "type": "string",
      "format": "date",
      "description": "In force from"
     },
     "effective_to": {
      "type": "string",
      "format": "date",
      "description": "Until"
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "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_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
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/hrms/work-relationships": {
   "get": {
    "summary": "list work-relationships",
    "operationId": "list_work_relationships_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create work-relationships",
    "operationId": "create_work_relationships_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/hrms/work-relationships/{id}": {
   "get": {
    "summary": "get work-relationships",
    "operationId": "get_work_relationships_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change work-relationships",
    "operationId": "change_work_relationships_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete work-relationships",
    "operationId": "delete_work_relationships_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "patch": {
    "summary": "Patch work relationships",
    "operationId": "action_work_relationships_3_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/hrms/work-relationships/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_work_relationships_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"
     }
    }
   }
  }
 }
}