{
  "swagger": "2.0",
  "info": {
    "title": "Gardenality Plant Finder (fixture pilot)",
    "version": "1.0.0",
    "description": "Search a bounded synthetic plant catalog using zone, light, and soil."
  },
  "host": "plant-finder-pilot.example.invalid",
  "basePath": "/v1",
  "schemes": ["https"],
  "consumes": ["application/json"],
  "produces": ["application/json", "application/problem+json"],
  "securityDefinitions": {
    "plantFinderKey": {
      "type": "apiKey", "in": "header", "name": "X-Plant-Finder-Key",
      "description": "Per-caller fixture connection credential. Enter the 64-character lowercase hexadecimal key when creating the connection."
    }
  },
  "security": [{"plantFinderKey": []}],
  "paths": {
    "/plants/find": {
      "post": {
        "operationId": "FindPlants",
        "summary": "Find catalog plants",
        "description": "Return at most three evidence-backed matches for complete required inputs. Optional preferences affect rank only. Reuse the request key only for a retry of the same search.",
        "x-ms-summary": "Find catalog plants",
        "parameters": [
          {
            "name": "Idempotency-Key", "in": "header", "type": "string", "required": true,
            "minLength": 8, "maxLength": 128, "pattern": "^[A-Za-z0-9_.:-]+$",
            "x-ms-summary": "Request key", "x-ms-visibility": "important",
            "description": "Opaque request identifier generated once for this search."
          },
          {"name": "criteria", "in": "body", "required": true, "schema": {"$ref": "#/definitions/PlantCriteria"}}
        ],
        "responses": {
          "200": {
            "description": "Catalog result",
            "headers": {
              "Idempotency-Replayed": {"type": "string", "enum": ["true"], "description": "Present when a stored result was reused."},
              "X-Request-Id": {"type": "string", "description": "Request correlation ID."}
            },
            "schema": {"$ref": "#/definitions/PlantResult"}
          },
          "400": {"description": "Invalid criteria or request key", "schema": {"$ref": "#/definitions/Problem"}},
          "401": {
            "description": "Missing or unknown connection credential",
            "headers": {"WWW-Authenticate": {"type": "string", "enum": ["PlantFinderKey"]}},
            "schema": {"$ref": "#/definitions/Problem"}
          },
          "403": {"description": "HTTPS required for remote requests", "schema": {"$ref": "#/definitions/Problem"}},
          "409": {"description": "Idempotency conflict", "schema": {"$ref": "#/definitions/Problem"}},
          "413": {"description": "Request body exceeds 4096 bytes", "schema": {"$ref": "#/definitions/Problem"}},
          "415": {"description": "Request body needs a JSON media type", "schema": {"$ref": "#/definitions/Problem"}},
          "429": {
            "description": "Rate limit or quota reached",
            "headers": {
              "Retry-After": {"type": "integer", "format": "int32", "description": "Seconds until the applicable UTC window resets."},
              "X-Request-Id": {"type": "string", "description": "Request correlation ID."}
            },
            "schema": {"$ref": "#/definitions/Problem"}
          },
          "503": {
            "description": "Action disabled or catalog unavailable",
            "headers": {"Idempotency-Replayed": {"type": "string", "enum": ["true"], "description": "Present when a stored catalog failure was reused."}},
            "schema": {"$ref": "#/definitions/Problem"}
          },
          "default": {"description": "Request failed", "schema": {"$ref": "#/definitions/Problem"}}
        }
      }
    }
  },
  "definitions": {
    "PlantCriteria": {
      "type": "object", "required": ["zone", "light", "soil"], "additionalProperties": false,
      "properties": {
        "zone": {"type": "integer", "format": "int32", "minimum": 1, "maximum": 13, "x-ms-summary": "Hardiness zone"},
        "light": {"type": "string", "enum": ["sun", "shade"], "x-ms-summary": "Light"},
        "soil": {"type": "string", "enum": ["dry", "wet"], "x-ms-summary": "Soil moisture"},
        "size": {"type": "number", "format": "double", "minimum": 1, "maximum": 200, "x-ms-summary": "Preferred maximum height in feet"},
        "native": {"type": "boolean", "x-ms-summary": "Prefer native tag"},
        "fall": {"type": "boolean", "x-ms-summary": "Prefer fall interest"}
      }
    },
    "PlantResult": {
      "type": "object", "required": ["kind", "message", "matches"], "additionalProperties": false,
      "properties": {
        "kind": {"type": "string", "enum": ["match", "no-match"]},
        "message": {"type": "string"},
        "matches": {"type": "array", "maxItems": 3, "items": {"$ref": "#/definitions/PlantMatch"}}
      }
    },
    "PlantMatch": {
      "type": "object", "required": ["id", "name", "source", "reason"], "additionalProperties": false,
      "properties": {
        "id": {"type": "string"}, "name": {"type": "string"},
        "source": {"type": "string", "description": "Offline fixture reference, such as #G-103."},
        "reason": {"type": "string"}
      }
    },
    "Problem": {
      "type": "object", "required": ["title", "status", "detail", "code", "traceId"],
      "description": "Plant Finder error returned as application/problem+json.",
      "properties": {
        "type": {"type": "string"},
        "title": {"type": "string"}, "status": {"type": "integer", "format": "int32"},
        "detail": {"type": "string"}, "code": {"type": "string"},
        "traceId": {"type": "string", "description": "Matches the X-Request-Id response header."}
      }
    }
  }
}
