{
 "openapi": "3.1.0",
 "info": {
  "title": "Variance Analysis (Accounting)",
  "version": "20261030b",
  "description": "Six categories, because each names a different department: price is purchasing, quantity is production, rate is the cost center, efficiency is the routing. A single \"manufacturing variance\" tells nobody what to do."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "cost-variances": {
    "type": "object",
    "required": [],
    "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
     },
     "order_type": {
      "type": "string",
      "description": "Order type",
      "readOnly": true
     },
     "order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Order id",
      "readOnly": true
     },
     "order_ref": {
      "type": "string",
      "description": "Order ref",
      "readOnly": true
     },
     "item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Item id",
      "readOnly": true
     },
     "cost_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cost center id",
      "readOnly": true
     },
     "period_code": {
      "type": "string",
      "description": "Period code",
      "readOnly": true
     },
     "variance_type": {
      "type": "string",
      "description": "Variance type",
      "readOnly": true
     },
     "component_code": {
      "type": "string",
      "description": "Component code",
      "readOnly": true
     },
     "cost_element_id": {
      "type": "string",
      "format": "uuid",
      "description": "Cost element id",
      "readOnly": true
     },
     "target_cost": {
      "type": "string",
      "format": "decimal",
      "description": "Target cost",
      "readOnly": true
     },
     "actual_cost": {
      "type": "string",
      "format": "decimal",
      "description": "Actual cost",
      "readOnly": true
     },
     "variance_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Variance amount",
      "readOnly": true
     },
     "target_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Target quantity",
      "readOnly": true
     },
     "actual_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Actual quantity",
      "readOnly": true
     },
     "target_price": {
      "type": "string",
      "format": "decimal",
      "description": "Target price",
      "readOnly": true
     },
     "actual_price": {
      "type": "string",
      "format": "decimal",
      "description": "Actual price",
      "readOnly": true
     },
     "currency": {
      "type": "string",
      "description": "Currency",
      "readOnly": true
     },
     "is_favourable": {
      "type": "boolean",
      "description": "Is favourable",
      "readOnly": true
     },
     "explanation": {
      "type": "string",
      "description": "Explanation",
      "readOnly": true
     },
     "journal_id": {
      "type": "string",
      "format": "uuid",
      "description": "Journal id",
      "readOnly": true
     },
     "run_id": {
      "type": "string",
      "format": "uuid",
      "description": "Run id",
      "readOnly": true
     },
     "calculated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Calculated 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_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/cost-variances": {
   "get": {
    "summary": "list cost-variances",
    "operationId": "list_cost_variances_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create cost-variances",
    "operationId": "create_cost_variances_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/cost-variances/{id}": {
   "get": {
    "summary": "get cost-variances",
    "operationId": "get_cost_variances_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change cost-variances",
    "operationId": "change_cost_variances_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete cost-variances",
    "operationId": "delete_cost_variances_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/accounting/cost-variances/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_cost_variances_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"
     }
    }
   }
  }
 }
}