{
  "openapi": "3.1.0",
  "info": {
    "title": "CNC HUB România — Industrial Digital Park & B2B Subcontracting API",
    "version": "2.8.0",
    "description": "Specificația OpenAPI 3.1.0 a platformei CNC HUB România (https://cnchub.ro), operată de New Basara Consult S.R.L. Oferă modelelor AI (ChatGPT, Claude, Gemini, Perplexity, LangChain) acces direct la registrul național de ateliere CNC și confecții tablă (cu gabaritele exacte ale fiecărui utilaj), analiza geometrică B-Rep 3D CAD, auditul DFM, estimarea CAM/Laser și transmiterea cererilor de ofertă (RFQ).",
    "contact": {
      "name": "CNC HUB România — New Basara Consult S.R.L.",
      "url": "https://cnchub.ro/contact",
      "email": "contact@cnchub.ro"
    }
  },
  "servers": [
    {
      "url": "https://cnchub.ro",
      "description": "Serverul de producție CNC HUB România"
    },
    {
      "url": "http://localhost:3000",
      "description": "Serverul local de dezvoltare și analiză FreeCAD B-Rep"
    }
  ],
  "paths": {
    "/llms.txt": {
      "get": {
        "operationId": "getLlmsIndex",
        "summary": "Obține indexul structurat llms.txt al platformei CNC HUB România",
        "responses": {
          "200": {
            "description": "Document Markdown conform standardului llmstxt.org",
            "content": {
              "text/plain": {
                "schema": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "/llms-full.txt": {
      "get": {
        "operationId": "getLlmsFullDocumentation",
        "summary": "Obține documentația tehnică completă llms-full.txt (divizii, formule calcul, parc complet utilaje parteneri)",
        "responses": {
          "200": {
            "description": "Document Markdown extins pentru sisteme RAG și agenți AI",
            "content": {
              "text/plain": {
                "schema": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "/cad-viewer/plugins/cnc-partners-registry.json": {
      "get": {
        "operationId": "getStaticPartnersMachineRegistry",
        "summary": "Returnează registrul complet JSON al atelierelor partenere CNC HUB și parcul lor de utilaje cu gabarite",
        "responses": {
          "200": {
            "description": "Lista atelierelor partenere și a echipamentelor industriale",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/PartnerWorkshop" }
                }
              }
            }
          }
        }
      }
    },
    "/api/partners": {
      "get": {
        "operationId": "getPartnersRegistry",
        "summary": "Endpoint API pentru interogarea parcului de utilaje al partenerilor CNC HUB România",
        "responses": {
          "200": {
            "description": "Lista atelierelor partenere și a echipamentelor industriale",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/PartnerWorkshop" }
                }
              }
            }
          }
        }
      }
    },
    "/api/freecad/status": {
      "get": {
        "operationId": "getFreecadEngineStatus",
        "summary": "Verifică starea motorului de analiză geometrică 3D B-Rep (OpenCASCADE / FreeCAD Core)",
        "responses": {
          "200": {
            "description": "Statusul motorului B-Rep",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "example": "online" },
                    "version": { "type": "string", "example": "1.0.2" },
                    "engine": { "type": "string", "example": "OpenCASCADE B-Rep / FreeCAD Core" },
                    "capabilities": {
                      "type": "array",
                      "items": { "type": "string" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/freecad/analyze": {
      "post": {
        "operationId": "analyzeCadModel",
        "summary": "Analizează un fișier 3D CAD (STEP, IGES, STL) și returnează topologia B-Rep, găurile, PCD flanșă, auditul DFM și estimarea de cost/timp",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": { "type": "string", "example": "flansa_industriala_pcd.stp" },
                  "fileData": { "type": "string", "description": "Conținutul fișierului CAD codificat Base64" },
                  "material": {
                    "type": "string",
                    "enum": ["otel", "inox", "aluminiu", "alama", "titan", "plastic"],
                    "default": "otel"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rezultatul complet al analizei B-Rep, DFM și CAM",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/BRepAnalysisResult" }
              }
            }
          }
        }
      }
    },
    "/api/rfq/submit": {
      "post": {
        "operationId": "submitB2bRfq",
        "summary": "Transmite o cerere de cotație (RFQ) către 1–5 furnizori selectați din rețeaua CNC HUB România",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/RfqSubmissionRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirmarea înregistrării cererii RFQ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "example": "success" },
                    "rfqCode": { "type": "string", "example": "RFQ-CNC-20261023-4821" },
                    "partnerCount": { "type": "integer", "example": 3 },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PartnerWorkshop": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "example": "wingsrom" },
          "name": { "type": "string", "example": "Wingsrom" },
          "legalName": { "type": "string", "example": "Wingsrom Flying Quality Products SRL" },
          "city": { "type": "string", "example": "Ploiești" },
          "county": { "type": "string", "example": "Prahova" },
          "ovr": { "type": "integer", "example": 92 },
          "ovrBadge": { "type": "string", "example": "AERO-5AX" },
          "ratingLabel": { "type": "string" },
          "description": { "type": "string" },
          "machines": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CncMachine" }
          }
        }
      },
      "CncMachine": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "type": { "type": "string", "example": "Freză CNC 5 Axe" },
          "brand": { "type": "string", "example": "Okuma" },
          "model": { "type": "string", "example": "MU-4000V (5 Axe Simultan)" },
          "axes": { "type": "string", "example": "5 Axe Simultan" },
          "capacityDisplay": { "type": "string", "example": "Ø500 x 400 mm (X:600 Y:460 Z:460 mm)" },
          "operation": { "type": "string" },
          "envelope": {
            "type": "object",
            "properties": {
              "type": { "type": "string", "enum": ["prismatic", "cylindrical", "gear"] },
              "x": { "type": "number", "description": "Cursa X în mm" },
              "y": { "type": "number", "description": "Cursa Y în mm" },
              "z": { "type": "number", "description": "Cursa Z / Grosime maximă în mm" },
              "diamMax": { "type": "number", "description": "Diametrul maxim de prelucrare în mm" },
              "lengthMax": { "type": "number", "description": "Lungimea maximă de prelucrare în mm" },
              "moduleMax": { "type": "number", "description": "Modulul maxim la danturare" }
            }
          }
        }
      },
      "BRepAnalysisResult": {
        "type": "object",
        "properties": {
          "bbox": {
            "type": "object",
            "properties": {
              "x": { "type": "number" },
              "y": { "type": "number" },
              "z": { "type": "number" }
            }
          },
          "volumeCm3": { "type": "number" },
          "areaMm2": { "type": "number" },
          "massKg": { "type": "number" },
          "holes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "diameter": { "type": "number" },
                "depth": { "type": "number" },
                "count": { "type": "integer" }
              }
            }
          }
        }
      },
      "RfqSubmissionRequest": {
        "type": "object",
        "properties": {
          "client": {
            "type": "object",
            "properties": {
              "name": { "type": "string" },
              "company": { "type": "string" },
              "email": { "type": "string" },
              "phone": { "type": "string" },
              "quantity": { "type": "integer" },
              "notes": { "type": "string" }
            }
          },
          "partInfo": {
            "type": "object",
            "properties": {
              "filename": { "type": "string" },
              "operationType": { "type": "string" },
              "material": { "type": "string" },
              "dimensionsMm": { "type": "string" }
            }
          },
          "selectedPartners": {
            "type": "array",
            "items": { "type": "string" }
          }
        }
      }
    }
  }
}
