{
 "openapi": "3.1.0",
 "info": {
  "title": "Risk Cases (Accounting)",
  "version": "20261030b",
  "description": "A person’s queue, with an outcome. The outcome is what closes the loop: confirmed fraud and dismissed noise are both training data, and a system that does not record which cannot improve."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "risk-cases": {
    "type": "object",
    "required": [
     "title"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "case_no": {
      "type": "string",
      "description": "Case no",
      "readOnly": true
     },
     "title": {
      "type": "string",
      "description": "Title"
     },
     "domain": {
      "type": "string",
      "description": "Domain"
     },
     "case_type": {
      "type": "string",
      "description": "Type"
     },
     "severity": {
      "type": "string",
      "description": "Severity",
      "enum": [
       "critical",
       "high",
       "medium",
       "low",
       "info"
      ]
     },
     "priority": {
      "type": "integer",
      "description": "Priority"
     },
     "amount_at_risk": {
      "type": "string",
      "format": "decimal",
      "description": "Amount at risk"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "subject_type": {
      "type": "string",
      "description": "Subject type"
     },
     "subject_id": {
      "type": "string",
      "format": "uuid",
      "description": "Subject id"
     },
     "supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier"
     },
     "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer"
     },
     "employee_id": {
      "type": "string",
      "format": "uuid",
      "description": "Employee"
     },
     "assigned_to": {
      "type": "string",
      "format": "uuid",
      "description": "Assigned to"
     },
     "assigned_at": {
      "type": "string",
      "format": "date-time",
      "description": "Assigned at",
      "readOnly": true
     },
     "due_date": {
      "type": "string",
      "format": "date",
      "description": "Due"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "outcome": {
      "type": "string",
      "description": "Outcome"
     },
     "outcome_notes": {
      "type": "string",
      "description": "Outcome notes"
     },
     "recovered_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Recovered amount"
     },
     "loss_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Loss amount"
     },
     "remediation": {
      "type": "string",
      "description": "Remediation"
     },
     "deficiency_id": {
      "type": "string",
      "format": "uuid",
      "description": "Deficiency id"
     },
     "reported_externally": {
      "type": "boolean",
      "description": "Reported externally"
     },
     "reported_to": {
      "type": "string",
      "description": "Reported to"
     },
     "opened_at": {
      "type": "string",
      "format": "date-time",
      "description": "Opened at",
      "readOnly": true
     },
     "resolved_at": {
      "type": "string",
      "format": "date-time",
      "description": "Resolved at",
      "readOnly": true
     },
     "closed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Closed at",
      "readOnly": true
     },
     "closed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Closed by",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "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/accounting/risk-cases": {
   "get": {
    "summary": "list risk-cases",
    "operationId": "list_risk_cases_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create risk-cases",
    "operationId": "create_risk_cases_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/risk-cases/{id}": {
   "get": {
    "summary": "get risk-cases",
    "operationId": "get_risk_cases_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change risk-cases",
    "operationId": "change_risk_cases_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete risk-cases",
    "operationId": "delete_risk_cases_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/risk-cases/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_risk_cases_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/risk-cases/{parentId}/actions": {
   "get": {
    "summary": "Actions",
    "operationId": "action_risk_cases_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Actions",
    "operationId": "action_risk_cases_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/risk-cases/{parentId}/actions/{lineId}": {
   "put": {
    "summary": "Actions",
    "operationId": "action_risk_cases_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Actions",
    "operationId": "action_risk_cases_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}