{
    "openapi": "3.0.3",
    "info": {
        "title": "Booking API",
        "description": "The Booking API provides endpoints to manage bookings in Scope. A booking represents a customer shipment request.",
        "termsOfService": "https://legal.riege.com/en-de/terms",
        "version": "1.0.0"
    },
    "tags": [
        {
            "name": "Bookings endpoint",
            "description": "Endpoint for managing bookings"
        }
    ],
    "components": {
        "securitySchemes": {
            "basicAuth": {
                "type": "http",
                "scheme": "basic"
            }
        },
        "schemas": {
            "BookingConversionParameters": {
                "properties": {
                    "module": {
                        "enum": [
                            "EXPORT_SHIPMENT",
                            "IMPORT_SHIPMENT",
                            "SIMPLE_SHIPMENT",
                            "FORWARDING_ORDER"
                        ]
                    },
                    "typeChange": {
                        "enum": [
                            "TO_BACK_TO_BACK",
                            "TO_COLOAD_IN",
                            "TO_COLOAD_OUT",
                            "TO_DIRECT",
                            "TO_HOUSE_FCL",
                            "TO_HOUSE",
                            "TO_MASTER_WITH_HOUSE_FCL",
                            "TO_MASTER_WITH_HOUSE",
                            "TO_SINGLE_FCL",
                            "TO_SINGLE_LCL",
                            "TO_SUBMASTER_FCL",
                            "TO_SUBMASTER"
                        ]
                    }
                }
            }
        }
    },
    "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": {
        "/v1/bookings/{bookingId}/convert": {
            "post": {
                "tags": ["Bookings endpoint"],
                "summary": "Converts the booking with the given identifier to a shipment",
                "parameters": [
                    {
                        "name": "bookingId",
                        "in": "path",
                        "description": "The booking identifier (USI) in Scope",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "description": "The parameters for booking conversion.",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#components/schemas/BookingConversionParameters"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Forbidden. User is not allowed to perform the operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Booking not found"
                    },
                    "409": {
                        "description": "Functional errors preventing booking conversion",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Internal server error"
                    }
                }
            }
        }
    }
}
