{
  "openapi": "3.0.3",
  "info": {
    "title": "Mollie Ship Order API",
    "description": "API for shipping orders via Mollie.",
    "version": "1.0.0"
  },
  "paths": {
    "/mollie/ship/order": {
      "post": {
        "summary": "Ship Order via Mollie",
        "description": "Ships an order via Mollie with tracking information.",
        "operationId": "shipOrderViaMollie",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderNumber": {
                    "type": "string",
                    "description": "The number of the order."
                  },
                  "trackingCarrier": {
                    "type": "string",
                    "description": "The carrier name for tracking."
                  },
                  "trackingCode": {
                    "type": "string",
                    "description": "The tracking code for the shipment."
                  },
                  "trackingUrl": {
                    "type": "string",
                    "description": "The tracking URL for the shipment."
                  }
                },
                "required": ["orderNumber", "trackingCarrier", "trackingCode", "trackingUrl"],
                "example": {
                  "orderNumber": "ORD-12345",
                  "trackingCarrier": "UPS",
                  "trackingCode": "123456789",
                  "trackingUrl": "https://example.com/tracking/123456789"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Order shipped successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "The ID of the shipment."
                    },
                    "orderId": {
                      "type": "string",
                      "description": "The ID of the order."
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "The date and time when the shipment was created."
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "The ID of the order line item."
                          },
                          "orderId": {
                            "type": "string",
                            "description": "The ID of the order."
                          },
                          "name": {
                            "type": "string",
                            "description": "The name of the order line item."
                          },
                          "sku": {
                            "type": "string",
                            "description": "The SKU of the order line item."
                          },
                          "type": {
                            "type": "string",
                            "description": "The type of the order line item."
                          },
                          "status": {
                            "type": "string",
                            "description": "The status of the order line item."
                          },
                          "quantity": {
                            "type": "integer",
                            "description": "The quantity of the order line item."
                          },
                          "unitPrice": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "description": "The currency of the unit price."
                              },
                              "value": {
                                "type": "number",
                                "format": "float",
                                "description": "The value of the unit price."
                              }
                            },
                            "required": ["currency", "value"]
                          },
                          "vatRate": {
                            "type": "number",
                            "format": "float",
                            "description": "The VAT rate of the order line item."
                          },
                          "vatAmount": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "description": "The currency of the VAT amount."
                              },
                              "value": {
                                "type": "number",
                                "format": "float",
                                "description": "The value of the VAT amount."
                              }
                            },
                            "required": ["currency", "value"]
                          },
                          "totalAmount": {
                            "type": "object",
                            "properties": {
                              "currency": {
                                "type": "string",
                                "description": "The currency of the total amount."
                              },
                              "value": {
                                "type": "number",
                                "format": "float",
                                "description": "The value of the total amount."
                              }
                            },
                            "required": ["currency", "value"]
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "description": "The date and time when the order line item was created."
                          }
                        },
                        "required": ["id", "orderId", "name", "sku", "type", "status", "quantity", "unitPrice", "vatRate", "vatAmount", "totalAmount", "createdAt"]
                      }
                    },
                    "tracking": {
                      "type": "object",
                      "properties": {
                        "carrier": {
                          "type": "string",
                          "description": "The carrier name for tracking."
                        },
                        "code": {
                          "type": "string",
                          "description": "The tracking code for the shipment."
                        },
                        "url": {
                          "type": "string",
                          "description": "The tracking URL for the shipment."
                        }
                      },
                      "required": ["carrier", "code", "url"]
                    }
                  },
                  "required": ["id", "orderId", "createdAt", "lines", "tracking"]
                },
                "example": {
                  "id": "shipment_123",
                  "orderId": "ORD-12345",
                  "createdAt": "2024-06-20T12:00:00Z",
                  "lines": [
                    {
                      "id": "line_1",
                      "orderId": "ORD-12345",
                      "name": "Product A",
                      "sku": "SKU-123",
                      "type": "physical",
                      "status": "shipped",
                      "quantity": 2,
                      "unitPrice": {
                        "currency": "USD",
                        "value": 25.0
                      },
                      "vatRate": 20.0,
                      "vatAmount": {
                        "currency": "USD",
                        "value": 5.0
                      },
                      "totalAmount": {
                        "currency": "USD",
                        "value": 50.0
                      },
                      "createdAt": "2024-06-18T10:00:00Z"
                    }
                  ],
                  "tracking": {
                    "carrier": "UPS",
                    "code": "123456789",
                    "url": "https://example.com/tracking/123456789"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "InvalidArgumentException"
                    },
                    "message": {
                      "type": "string",
                      "example": "Invalid tracking information."
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "orderNumber": {
                          "type": "string",
                          "description": "The number of the order."
                        },
                        "trackingCarrier": {
                          "type": "string",
                          "description": "The carrier name for tracking."
                        },
                        "trackingCode": {
                          "type": "string",
                          "description": "The tracking code for the shipment."
                        },
                        "trackingUrl": {
                          "type": "string",
                          "description": "The tracking URL for the shipment."
                        }
                      },
                      "required": ["orderNumber", "trackingCarrier", "trackingCode", "trackingUrl"],
                      "example": {
                        "orderNumber": "ORD-12345",
                        "trackingCarrier": "UPS",
                        "trackingCode": "123456789",
                        "trackingUrl": "https://example.com/tracking/123456789"
                      }
                    }
                  }
                },
                "example": {
                  "error": "InvalidArgumentException",
                  "message": "Invalid tracking information.",
                  "data": {
                    "orderNumber": "ORD-12345",
                    "trackingCarrier": "UPS",
                    "trackingCode": "123456789",
                    "trackingUrl": "https://example.com/tracking/123456789"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}