{
 "openapi": "3.1.0",
 "info": {
  "title": "Configurator · Rules (Supply Chain)",
  "version": "20261030b",
  "description": "Two kinds of rule in one list. CONSTRAINT rules say what may be chosen, as explicit pairs, because a rule has to be explicable to a salesperson standing in front of a customer. PROCESS rules say what the choice MEANS — which component, in what quantity, through which operation, with which inspection — and carry a condition written in the ordinary expression language."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "config-rules": {
    "type": "object",
    "required": [
     "model_id",
     "code",
     "name",
     "rule_type"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "model_id": {
      "type": "string",
      "format": "uuid",
      "description": "Model"
     },
     "code": {
      "type": "string",
      "description": "Code"
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "rule_type": {
      "type": "string",
      "description": "Kind",
      "enum": [
       "requires",
       "excludes",
       "implies",
       "recommends",
       "min_quantity",
       "max_quantity",
       "forces_eto",
       "calculates",
       "selects_component",
       "selects_operation",
       "selects_routing",
       "selects_inspection",
       "selects_submodel",
       "sets_parameter",
       "defaults_value",
       "propagates_value",
       "excludes_component",
       "replaces_component",
       "sets_component_qty",
       "selects_bom",
       "removes_operation",
       "sets_operation_time",
       "sets_work_center",
       "validates"
      ]
     },
     "when_option_id": {
      "type": "string",
      "format": "uuid",
      "description": "When this option is chosen"
     },
     "when_class_id": {
      "type": "string",
      "format": "uuid",
      "description": "When class id"
     },
     "then_option_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then this option"
     },
     "then_class_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then class id"
     },
     "quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity"
     },
     "message": {
      "type": "string",
      "description": "What the person is told"
     },
     "severity": {
      "type": "string",
      "description": "Severity",
      "enum": [
       "error",
       "warning",
       "info"
      ]
     },
     "sort_order": {
      "type": "integer",
      "description": "Order"
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "effective_from": {
      "type": "string",
      "format": "date",
      "description": "In force from"
     },
     "effective_to": {
      "type": "string",
      "format": "date",
      "description": "Until"
     },
     "condition_expr": {
      "type": "string",
      "description": "When (a condition)"
     },
     "output_name": {
      "type": "string",
      "description": "Name of the value it computes"
     },
     "output_label": {
      "type": "string",
      "description": "How to show that value"
     },
     "output_uom": {
      "type": "string",
      "description": "Unit of that value"
     },
     "value_formula": {
      "type": "string",
      "description": "Formula"
     },
     "then_item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then select this part"
     },
     "component_qty": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity (a constant)"
     },
     "qty_formula": {
      "type": "string",
      "description": "Quantity (a formula)"
     },
     "component_uom": {
      "type": "string",
      "description": "Unit of the quantity"
     },
     "scrap_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Scrap %"
     },
     "alternate_item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Alternative part"
     },
     "component_kind": {
      "type": "string",
      "description": "What kind of part",
      "enum": [
       "raw",
       "component",
       "subassembly",
       "consumable",
       "packaging",
       "purchased"
      ]
     },
     "consumed_at_op_no": {
      "type": "integer",
      "description": "Consumed at operation"
     },
     "operation_no": {
      "type": "integer",
      "description": "Operation number"
     },
     "operation_name": {
      "type": "string",
      "description": "Operation"
     },
     "then_work_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "On this work centre"
     },
     "setup_minutes": {
      "type": "string",
      "format": "decimal",
      "description": "Setup (minutes)"
     },
     "run_minutes_per_unit": {
      "type": "string",
      "format": "decimal",
      "description": "Run per one (minutes)"
     },
     "time_formula": {
      "type": "string",
      "description": "Run time (a formula)"
     },
     "is_subcontracted": {
      "type": "boolean",
      "description": "Performed outside"
     },
     "subcontract_supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Subcontractor"
     },
     "subcontract_cost": {
      "type": "string",
      "format": "decimal",
      "description": "What they charge (a constant)"
     },
     "cost_formula": {
      "type": "string",
      "description": "What they charge (a formula)"
     },
     "subcontract_lead_days": {
      "type": "integer",
      "description": "How long they keep it (days)"
     },
     "predecessor_op_no": {
      "type": "integer",
      "description": "After operation"
     },
     "then_routing_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then routing id"
     },
     "then_inspection_plan_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then inspect to this plan"
     },
     "inspection_stage": {
      "type": "string",
      "description": "At which stage",
      "enum": [
       "incoming",
       "in_process",
       "final",
       "first_article",
       "pre_ship",
       "periodic",
       "audit",
       "returned"
      ]
     },
     "then_submodel_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then configure this sub-assembly"
     },
     "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
     },
     "then_bom_id": {
      "type": "string",
      "format": "uuid",
      "description": "Then use this bill of material"
     },
     "replace_item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Part it replaces"
     },
     "target_code": {
      "type": "string",
      "description": "Sub-assembly question"
     },
     "is_locked": {
      "type": "boolean",
      "description": "Locked"
     },
     "replaces_base": {
      "type": "boolean",
      "description": "Instead of the base routing"
     },
     "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
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/scm/config-rules": {
   "get": {
    "summary": "list config-rules",
    "operationId": "list_config_rules_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create config-rules",
    "operationId": "create_config_rules_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/config-rules/{id}": {
   "get": {
    "summary": "get config-rules",
    "operationId": "get_config_rules_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change config-rules",
    "operationId": "change_config_rules_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete config-rules",
    "operationId": "delete_config_rules_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "patch": {
    "summary": "Patch configurator · rules",
    "operationId": "action_config_rules_3_5",
    "description": "Body keys: model_id, rule_type, condition_expr, then_option_id, value_formula, then_submodel_id, target_code",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/config-rules/parse-text": {
   "post": {
    "summary": "Parse text",
    "operationId": "action_config_rules_0_5",
    "description": "Body keys: modelId, model, text",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/config-rules/save-text": {
   "post": {
    "summary": "Save text",
    "operationId": "action_config_rules_0_5",
    "description": "Body keys: modelId, model, text",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/config-rules/as-text": {
   "get": {
    "summary": "As text",
    "operationId": "action_config_rules_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/config-rules/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_config_rules_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/scm/config-rules/{parentId}/components": {
   "get": {
    "summary": "Components",
    "operationId": "action_config_rules_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Components",
    "operationId": "action_config_rules_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/config-rules/{parentId}/components/{lineId}": {
   "put": {
    "summary": "Components",
    "operationId": "action_config_rules_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Components",
    "operationId": "action_config_rules_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}