{
 "openapi": "3.1.0",
 "info": {
  "title": "Allocation Segments (Accounting)",
  "version": "20261030b",
  "description": "Who sends, who receives, and what splits between them. Anything less than a 100% sender share leaves a residue on the sender, which is sometimes right and usually a mistake."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "allocation-segments": {
    "type": "object",
    "required": [
     "cycle_id",
     "segment_no",
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "cycle_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cycle"
     },
     "segment_no": {
      "type": "integer",
      "description": "Segment"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "sender_type": {
      "type": "string",
      "description": "Sender type",
      "enum": [
       "cost_center",
       "profit_center",
       "order",
       "project",
       "activity"
      ]
     },
     "sender_pattern": {
      "type": "string",
      "description": "Sender pattern"
     },
     "sender_group": {
      "type": "string",
      "description": "Sender group"
     },
     "cost_element_pattern": {
      "type": "string",
      "description": "Cost element pattern"
     },
     "sender_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Sender sends %"
     },
     "sender_rule": {
      "type": "string",
      "description": "Sender rule",
      "enum": [
       "posted_amount",
       "fixed_amount",
       "fixed_rate",
       "fixed_price"
      ]
     },
     "fixed_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Fixed amount"
     },
     "receiver_type": {
      "type": "string",
      "description": "Receiver type",
      "enum": [
       "cost_center",
       "profit_center",
       "order",
       "project",
       "wbs_element",
       "profitability_segment",
       "item",
       "customer"
      ]
     },
     "receiver_pattern": {
      "type": "string",
      "description": "Receiver pattern"
     },
     "receiver_group": {
      "type": "string",
      "description": "Receiver group"
     },
     "driver_id": {
      "type": "string",
      "format": "uuid",
      "description": "Driver"
     },
     "basis": {
      "type": "string",
      "description": "Basis",
      "enum": [
       "driver",
       "fixed_percentage",
       "fixed_portion",
       "posted_amount",
       "equal"
      ]
     },
     "assessment_element_id": {
      "type": "string",
      "format": "uuid",
      "description": "Assessment element"
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "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
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/accounting/allocation-segments": {
   "get": {
    "summary": "list allocation-segments",
    "operationId": "list_allocation_segments_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create allocation-segments",
    "operationId": "create_allocation_segments_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/allocation-segments/{id}": {
   "get": {
    "summary": "get allocation-segments",
    "operationId": "get_allocation_segments_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change allocation-segments",
    "operationId": "change_allocation_segments_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete allocation-segments",
    "operationId": "delete_allocation_segments_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/allocation-segments/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_allocation_segments_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"
     }
    }
   }
  },
  "/api/accounting/allocation-segments/{parentId}/receivers": {
   "get": {
    "summary": "Receivers",
    "operationId": "action_allocation_segments_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Receivers",
    "operationId": "action_allocation_segments_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/allocation-segments/{parentId}/receivers/{lineId}": {
   "put": {
    "summary": "Receivers",
    "operationId": "action_allocation_segments_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Receivers",
    "operationId": "action_allocation_segments_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}