{
  "openapi": "3.1.0",
  "info": {
    "title": "Agentic Wine Constructor API",
    "version": "1.0.0",
    "description": "Creates a decision-ready custom and private-label wine commission dossier for a brand, event, institution or private allocation. Vineyard and cellar evidence remain subject to producer review."
  },
  "servers": [{ "url": "https://vin-q.com" }],
  "externalDocs": {
    "description": "Agentic Wine machine instructions",
    "url": "https://vin-q.com/agentic-wine.md"
  },
  "tags": [
    {
      "name": "Agentic Wine",
      "description": "Custom regenerative wine concepts, construction routes and producer-ready commission dossiers."
    }
  ],
  "paths": {
    "/api/constructor/dossier": {
      "get": {
        "operationId": "getConstructorOptions",
        "summary": "List custom-wine constructor options and workflow",
        "description": "Returns the wine formats, sensory targets, geographic constraints and four production gates used to prepare a commission.",
        "tags": ["Agentic Wine"],
        "responses": { "200": { "description": "Constructor options" } }
      },
      "post": {
        "operationId": "createWineCommissionDossier",
        "summary": "Create a producer-ready custom wine commission dossier",
        "description": "Turns a brand or event brief and wine target into a structured feasibility draft. The response does not reserve grapes, certify availability or create a purchase.",
        "tags": ["Agentic Wine"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CommissionBrief" }
            }
          }
        },
        "responses": {
          "201": { "description": "Decision-ready draft created" },
          "422": { "description": "Brief failed validation" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CommissionBrief": {
        "type": "object",
        "required": ["intent", "target"],
        "properties": {
          "intent": {
            "type": "object",
            "required": ["projectName", "organization", "occasion", "bottleCount", "targetRelease", "producerSharingConsent"],
            "properties": {
              "projectName": { "type": "string" },
              "organization": { "type": "string" },
              "occasion": { "type": "string" },
              "audience": { "type": "string" },
              "bottleCount": { "type": "string" },
              "targetRelease": { "type": "string" },
              "labelDirection": { "type": "string" }
              ,"producerSharingConsent": { "type": "boolean", "description": "Explicit authorization to share the dossier and contact identity with registered producers." }
            }
          },
          "target": {
            "type": "object",
            "required": ["format", "color", "aroma", "structure", "geographicDesignation"],
            "properties": {
              "format": { "enum": ["still", "sparkling"] },
              "color": { "enum": ["red", "white", "rose"] },
              "aroma": { "type": "string" },
              "structure": { "type": "string" },
              "geographicDesignation": { "enum": ["none", "dop-cava", "do-penedes", "doq-priorat"] },
              "organicRequired": { "type": "boolean" }
            }
          },
          "candidateLots": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "variety": { "type": "string" },
                "origin": { "type": "string" },
                "role": { "type": "string" },
                "compatibilityState": { "type": "string" }
              }
            }
          }
        }
      }
    }
  }
}
