{
  "openapi": "3.0.1",
  "info": {
    "title": "Repetito Public API",
    "version": "1.0",
    "description": "Public API for e-shop integrations with Repetito reusable packaging service"
  },
  "paths": {
    "/api/version": {
      "get": {
        "tags": [
          "public"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetApiVersionResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/integration/status": {
      "post": {
        "tags": [
          "client"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ClientReportIntegrationStatusRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/orders": {
      "post": {
        "tags": [
          "client"
        ],
        "parameters": [
          {
            "name": "x-Api-Key",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ClientCreateShopOrderRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientCreateShopOrderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/refs/package-types": {
      "get": {
        "tags": [
          "ListReferences"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RefPackageType"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "GetApiVersionResponse": {
        "required": [
          "name",
          "version"
        ],
        "type": "object",
        "properties": {
          "version": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          }
        },
        "additionalProperties": {}
      },
      "ClientReportIntegrationStatusRequest": {
        "required": [
          "platformType",
          "version"
        ],
        "type": "object",
        "properties": {
          "platformType": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ShopPlatformType"
              }
            ]
          },
          "version": {
            "type": "string"
          },
          "lastOrderSent": {
            "type": "string",
            "format": "date-time"
          },
          "lastError": {
            "type": "string"
          },
          "metadata": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ValidationProblemDetails": {
        "required": [
          "errors"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "additionalProperties": {}
      },
      "ClientCreateShopOrderRequest": {
        "required": [
          "emailAddress",
          "orderNumber"
        ],
        "type": "object",
        "properties": {
          "orderNumber": {
            "type": "string"
          },
          "emailAddress": {
            "maxLength": 256,
            "type": "string"
          },
          "phoneNumber": {
            "type": "string"
          },
          "billingAddress": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ]
          },
          "shippingAddress": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Address"
              }
            ]
          },
          "timeCreated": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "ClientCreateShopOrderResponse": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "maxLength": 12,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "RefPackageType": {
        "required": [
          "id",
          "name"
        ],
        "type": "object",
        "properties": {
          "id": {
            "maxLength": 2,
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "ShopPlatformType": {
        "enum": [
          "wordpress",
          "prestashop",
          "shoptet",
          "shopify",
          "custom"
        ],
        "type": "string"
      },
      "Address": {
        "type": "object",
        "properties": {
          "street": {
            "maxLength": 256,
            "type": "string"
          },
          "town": {
            "maxLength": 256,
            "type": "string"
          },
          "postCode": {
            "maxLength": 256,
            "type": "string"
          },
          "country": {
            "maxLength": 256,
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    }
  }
}