{
    "openapi": "3.0.3",
    "info": {
        "title": "Shipment API",
        "description": "The Shipment API provides endpoints to manage shipments in Scope.",
        "termsOfService": "https://legal.riege.com/en-de/terms",
        "version": "1.0.0"
    },
    "tags": [
        {
            "name": "Shipments endpoint",
            "description": "Endpoint for managing shipments"
        }
    ],
    "components": {
        "securitySchemes": {
            "basicAuth": {
                "type": "http",
                "scheme": "basic"
            }
        }
    },
    "security": [
        {
            "basicAuth": []
        }
    ],
    "servers": [
        {
            "url": "https://{server}/scope/rest",
            "description": "The base URL",
            "variables": {
                "server": {
                    "default": "example.riege.com",
                    "description": "The server may vary depending on the Scope tenant."
                }
            }
        }
    ],
    "paths": {
        "/shipments/v1/{shipmentId}/bookings": {
            "get": {
                "tags": ["Shipment bookings endpoint"],
                "summary": "Lists the IDs of bookings consolidated on the shipment identified by shipmentId",
                "parameters": [
                    {
                        "name": "shipmentId",
                        "in": "path",
                        "description": "The shipment identifier (USI) in Scope",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden. User is not allowed to perform the operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Shipment not found"
                    },
                    "409": {
                        "description": "Functional errors preventing booking conversion",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal server error"
                    }
                }
            },
            "post": {
                "tags": ["Shipment bookings endpoint"],
                "summary": "Assigns bookings to the shipment identified by shipmentId",
                "parameters": [
                    {
                        "name": "shipmentId",
                        "in": "path",
                        "description": "The shipment identifier (USI) in Scope",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "description": "The booking identifiers to assign to the shipment.",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "array",
                                "items": {
                                    "type": "string",
                                    "description": "A booking identifier (USI) in Scope"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "Bookings assigned successfully"
                    },
                    "403": {
                        "description": "Forbidden. User is not allowed to perform the operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Shipment or booking not found"
                    },
                    "409": {
                        "description": "Functional errors preventing booking assignment",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal server error"
                    }
                }
            },
            "delete": {
                "tags": ["Shipment bookings endpoint"],
                "summary": "Unassigns booking from the shipment identified by shipmentId",
                "parameters": [
                    {
                        "name": "shipmentId",
                        "in": "path",
                        "description": "The shipment identifier (USI) in Scope",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "description": "The booking identifier (USI) to unassign from the shipment.",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "string",
                                "description": "The booking identifier (USI) in Scope"
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "Booking unassigned successfully"
                    },
                    "403": {
                        "description": "Forbidden. User is not allowed to perform the operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Shipment or booking not found"
                    },
                    "409": {
                        "description": "Functional errors preventing booking unassignment",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal server error"
                    }
                }
            }
        }
    }
}
