{
 "openapi": "3.0.3",
 "info": {
  "title": "EPR EU Rep API",
  "version": "1.1.0",
  "description": "Public API for EPR in France, Germany and Spain. No key. /sandbox/ is simulated: it creates no order, mandate, payment or registration."
 },
 "servers": [
  {
   "url": "https://epreurep.com/api/v1"
  }
 ],
 "components": {
  "schemas": {
   "Order": {
    "type": "object",
    "properties": {
     "france": {
      "type": "object",
      "properties": {
       "streams": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "sells_to": {
        "type": "string",
        "enum": [
         "consumers",
         "mixed",
         "businesses"
        ]
       },
       "tonnes": {
        "type": "string",
        "enum": [
         "up_to_1",
         "1_to_10",
         "over_10"
        ]
       }
      },
      "required": [
       "streams",
       "sells_to",
       "tonnes"
      ]
     },
     "germany": {
      "type": "object",
      "properties": {
       "packaging_kg": {
        "type": "object",
        "description": "This year's kilos by material. Optional: they prefill the client's portal.",
        "properties": {
         "paper": {
          "type": "number"
         },
         "plastic": {
          "type": "number"
         },
         "glass": {
          "type": "number"
         },
         "ferrous": {
          "type": "number"
         },
         "alu": {
          "type": "number"
         },
         "bevcarton": {
          "type": "number"
         },
         "composite": {
          "type": "number"
         },
         "other": {
          "type": "number"
         }
        },
        "additionalProperties": false
       },
       "already_licensed": {
        "type": "boolean",
        "description": "Another dual system already licenses all of it."
       },
       "weee": {
        "type": "boolean"
       },
       "batteries": {
        "type": "boolean"
       }
      }
     },
     "spain": {
      "type": "object",
      "properties": {
       "plan": {
        "type": "string",
        "enum": [
         "essential",
         "standard"
        ]
       },
       "nif": {
        "type": "boolean"
       }
      }
     }
    }
   }
  }
 },
 "paths": {
  "/france/questionnaire": {
   "get": {
    "summary": "The France questionnaire, streams and plan rules",
    "responses": {
     "200": {
      "description": "Questions, streams, plans"
     }
    }
   }
  },
  "/check": {
   "post": {
    "summary": "Countries covered and likely streams",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "countries"
        ],
        "properties": {
         "countries": {
          "type": "array",
          "items": {
           "type": "string"
          }
         },
         "products": {
          "type": "array",
          "items": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result"
     },
     "400": {
      "description": "Invalid request"
     }
    }
   }
  },
  "/quote": {
   "post": {
    "summary": "Yearly price from live prices; custom_quote is true for Enterprise",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Order"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Quote"
     },
     "400": {
      "description": "Invalid request"
     }
    }
   }
  },
  "/onboarding-links": {
   "post": {
    "summary": "Checkout link tied to a partner code; for Enterprise it opens the quote request",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "allOf": [
         {
          "$ref": "#/components/schemas/Order"
         },
         {
          "type": "object",
          "required": [
           "partner"
          ],
          "properties": {
           "partner": {
            "type": "string"
           },
           "company": {
            "type": "string"
           },
           "email": {
            "type": "string"
           }
          }
         }
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Link"
     },
     "400": {
      "description": "Invalid request or unknown partner"
     }
    }
   }
  },
  "/sandbox/onboardings": {
   "post": {
    "summary": "Start a simulated onboarding",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "countries"
        ],
        "properties": {
         "countries": {
          "type": "array",
          "items": {
           "type": "string",
           "enum": [
            "FR",
            "DE",
            "ES"
           ]
          }
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Simulated status"
     },
     "400": {
      "description": "Invalid request"
     }
    }
   }
  },
  "/sandbox/onboardings/{id}": {
   "get": {
    "summary": "Simulated status",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Simulated status"
     },
     "404": {
      "description": "Unknown id"
     }
    }
   }
  }
 }
}