{
  "openapi": "3.1.0",
  "info": {
    "title": "Kettlewhin Coffee Roasters agent API",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://agents.rapidbronze.shop"
    }
  ],
  "paths": {
    "/orders": {
      "post": {
        "operationId": "createOrder",
        "summary": "Order coffee",
        "description": "Sends a request. Nothing is charged or confirmed until the request is answered by email.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "offer": {
                    "type": "string",
                    "enum": [
                      "ridgeline",
                      "cinder",
                      "guji-natural",
                      "kiambu-peaberry",
                      "huila-decaf",
                      "tasting-box"
                    ]
                  },
                  "grind": {
                    "type": "string",
                    "enum": [
                      "whole-bean",
                      "espresso",
                      "filter",
                      "cafetiere"
                    ]
                  },
                  "size": {
                    "type": "string",
                    "enum": [
                      "250g",
                      "1kg",
                      "3x125g"
                    ]
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99
                  },
                  "interval": {
                    "type": "string",
                    "enum": [
                      "once",
                      "2-weeks",
                      "4-weeks"
                    ]
                  },
                  "country": {
                    "type": "string",
                    "enum": [
                      "IE",
                      "AT",
                      "BE",
                      "DK",
                      "FR",
                      "DE",
                      "IT",
                      "LU",
                      "NL",
                      "PT",
                      "ES",
                      "BG",
                      "HR",
                      "CY",
                      "CZ",
                      "EE",
                      "FI",
                      "GR",
                      "HU",
                      "LV",
                      "LT",
                      "MT",
                      "PL",
                      "RO",
                      "SK",
                      "SI",
                      "SE"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": [
                  "offer",
                  "quantity",
                  "interval",
                  "country",
                  "name",
                  "email"
                ]
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "properties": {
                  "offer": {
                    "type": "string",
                    "enum": [
                      "ridgeline",
                      "cinder",
                      "guji-natural",
                      "kiambu-peaberry",
                      "huila-decaf",
                      "tasting-box"
                    ]
                  },
                  "grind": {
                    "type": "string",
                    "enum": [
                      "whole-bean",
                      "espresso",
                      "filter",
                      "cafetiere"
                    ]
                  },
                  "size": {
                    "type": "string",
                    "enum": [
                      "250g",
                      "1kg",
                      "3x125g"
                    ]
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 99
                  },
                  "interval": {
                    "type": "string",
                    "enum": [
                      "once",
                      "2-weeks",
                      "4-weeks"
                    ]
                  },
                  "country": {
                    "type": "string",
                    "enum": [
                      "IE",
                      "AT",
                      "BE",
                      "DK",
                      "FR",
                      "DE",
                      "IT",
                      "LU",
                      "NL",
                      "PT",
                      "ES",
                      "BG",
                      "HR",
                      "CY",
                      "CZ",
                      "EE",
                      "FI",
                      "GR",
                      "HU",
                      "LV",
                      "LT",
                      "MT",
                      "PL",
                      "RO",
                      "SK",
                      "SI",
                      "SE"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                },
                "required": [
                  "offer",
                  "quantity",
                  "interval",
                  "country",
                  "name",
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Request received",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "received"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Fields missing or invalid; send the request again with them",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "missing": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "invalid": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
