{
 "openapi": "3.1.0",
 "info": {
  "title": "Subgroups (Manufacturing)",
  "version": "20261030b",
  "description": "Every subgroup with its readings, its mean and range, and which control rules it broke. A point that breaks a rule while every part is in tolerance is the whole reason the chart exists."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "spc-samples": {
    "type": "object",
    "required": [],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "chart_id": {
      "type": "string",
      "format": "uuid",
      "description": "Chart id",
      "readOnly": true
     },
     "subgroup_no": {
      "type": "integer",
      "description": "Subgroup no",
      "readOnly": true
     },
     "taken_at": {
      "type": "string",
      "format": "date-time",
      "description": "Taken at",
      "readOnly": true
     },
     "production_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Production order id",
      "readOnly": true
     },
     "batch_record_id": {
      "type": "string",
      "format": "uuid",
      "description": "Batch record id",
      "readOnly": true
     },
     "lot_no": {
      "type": "string",
      "description": "Lot no",
      "readOnly": true
     },
     "shift_id": {
      "type": "string",
      "format": "uuid",
      "description": "Shift id",
      "readOnly": true
     },
     "operator_id": {
      "type": "string",
      "format": "uuid",
      "description": "Operator id",
      "readOnly": true
     },
     "values": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Values",
      "readOnly": true
     },
     "mean": {
      "type": "string",
      "format": "decimal",
      "description": "Mean",
      "readOnly": true
     },
     "range_value": {
      "type": "string",
      "format": "decimal",
      "description": "Range value",
      "readOnly": true
     },
     "std_dev": {
      "type": "string",
      "format": "decimal",
      "description": "Std dev",
      "readOnly": true
     },
     "min_value": {
      "type": "string",
      "format": "decimal",
      "description": "Min value",
      "readOnly": true
     },
     "max_value": {
      "type": "string",
      "format": "decimal",
      "description": "Max value",
      "readOnly": true
     },
     "violated_rules": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Violated rules",
      "readOnly": true
     },
     "is_out_of_control": {
      "type": "boolean",
      "description": "Is out of control",
      "readOnly": true
     },
     "is_out_of_spec": {
      "type": "boolean",
      "description": "Is out of spec",
      "readOnly": true
     },
     "capture_source": {
      "type": "string",
      "description": "Capture source",
      "readOnly": true
     },
     "action_taken": {
      "type": "string",
      "description": "Action taken",
      "readOnly": true
     },
     "nonconformance_id": {
      "type": "string",
      "format": "uuid",
      "description": "Nonconformance id",
      "readOnly": true
     },
     "notes": {
      "type": "string",
      "description": "Notes",
      "readOnly": true
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "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/mfg/spc-samples": {
   "get": {
    "summary": "list spc-samples",
    "operationId": "list_spc_samples_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post subgroups",
    "operationId": "action_spc_samples_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/spc-samples/{id}": {
   "get": {
    "summary": "get spc-samples",
    "operationId": "get_spc_samples_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put subgroups",
    "operationId": "action_spc_samples_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete subgroups",
    "operationId": "action_spc_samples_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/spc-samples/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_spc_samples_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/mfg/spc-samples/record": {
   "post": {
    "summary": "Record",
    "operationId": "action_spc_samples_0_5",
    "description": "Body keys: values, chartId, takenAt, productionOrderId, batchRecordId, lotNo, shiftId, source, notes; source one of internal|supplier|customer|regulatory|audit",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}