{
  "openapi": "3.0.0",
  "paths": {
    "/shipments/{spaceId}": {
      "post": {
        "operationId": "createShipment",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-pipeline-id",
            "required": false,
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateShipmentDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentInformationDto"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "get": {
        "operationId": "getShipments",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "take",
            "required": false,
            "in": "query",
            "schema": {
              "default": 25,
              "type": "number"
            }
          },
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "schema": {
              "default": 0,
              "type": "number"
            }
          },
          {
            "name": "cursor",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "providerId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "new",
                "in-transit",
                "completed",
                "returned",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "name": "trackingNumber",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "data",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "phrase",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "createdAt_gte",
            "required": false,
            "in": "query",
            "description": "Created at greater than or equal",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "createdAt_lte",
            "required": false,
            "in": "query",
            "description": "Created at less than or equal",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "modifiedAt_gte",
            "required": false,
            "in": "query",
            "description": "Modified at greater than or equal",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "name": "modifiedAt_lte",
            "required": false,
            "in": "query",
            "description": "Modified at less than or equal",
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentListDto"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/create-with-tracking-number": {
      "post": {
        "operationId": "createShipmentWithTrackingNumber",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-pipeline-id",
            "required": false,
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddShipmentWithTrackingNumberDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentInformationDto"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/search": {
      "post": {
        "operationId": "searchShipments",
        "summary": "Search shipments",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FindManyShipmentDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentListDto"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{id}": {
      "get": {
        "operationId": "getShipment",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentWithStatusEntriesDto"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteShipments",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{id}/events": {
      "get": {
        "operationId": "getShipmentEvents",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Maximum number of events to return",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "required": false,
            "in": "query",
            "description": "Number of events to skip",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "category",
            "required": false,
            "in": "query",
            "description": "Filter by event category",
            "schema": {
              "enum": [
                "Order",
                "Shipment",
                "Provider",
                "Webhook"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentEventListDto"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{id}/tracking": {
      "get": {
        "operationId": "trackingPage",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackingUrlResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{trackingNumber}/tracking-with-tracking-number": {
      "get": {
        "operationId": "trackingPageWithTrackingNumber",
        "summary": "",
        "parameters": [
          {
            "name": "trackingNumber",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrackingUrlResponse"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{id}/label": {
      "get": {
        "operationId": "getShipmentLabel",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "description": ""
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{id}/transition/{transition}": {
      "put": {
        "operationId": "transitionShipment",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transition",
            "required": true,
            "in": "path",
            "schema": {
              "enum": [
                "CANCEL",
                "START_TRANSIT",
                "COMPLETE",
                "RETURN"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{id}/resend-status-updates": {
      "post": {
        "operationId": "resendShipmentStatusUpdates",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{providerId}/{trackingNumber}/resend-status-updates": {
      "post": {
        "operationId": "resendShipmentStatusUpdatesWithProviderTrackingNumber",
        "summary": "",
        "parameters": [
          {
            "name": "providerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trackingNumber",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/shipments/{spaceId}/{trackingNumber}/resend-status-updates-with-tracking-number": {
      "post": {
        "operationId": "resendShipmentStatusUpdatesWithTrackingNumber",
        "summary": "",
        "parameters": [
          {
            "name": "trackingNumber",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "boolean"
                }
              }
            }
          }
        },
        "tags": [
          "Shipments"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/webhooks/{spaceId}": {
      "post": {
        "operationId": "createWebhook",
        "summary": "",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateWebhookDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDto"
                }
              }
            }
          },
          "404": {
            "description": "Space not found"
          },
          "409": {
            "description": "Webhook with this ID already exists in the space"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "get": {
        "operationId": "listWebhooks",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookListDto"
                }
              }
            }
          },
          "404": {
            "description": "Space not found"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/webhooks/{spaceId}/{webhookId}": {
      "get": {
        "operationId": "getWebhook",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDto"
                }
              }
            }
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "put": {
        "operationId": "updateWebhook",
        "summary": "",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateWebhookDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDto"
                }
              }
            }
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "",
        "parameters": [],
        "responses": {
          "204": {
            "description": "Webhook deleted successfully"
          },
          "404": {
            "description": "Webhook not found"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/webhooks/{spaceId}/{webhookId}/archive": {
      "get": {
        "operationId": "getWebhookArchive",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookArchiveListDto"
                }
              }
            }
          }
        },
        "tags": [
          "Webhooks"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/webhook-events/{spaceId}": {
      "get": {
        "operationId": "findAll",
        "summary": "List webhook events for a space",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "required": false,
            "in": "query",
            "schema": {
              "enum": [
                "WAITING",
                "PENDING",
                "IN_PROGRESS",
                "DELIVERED",
                "FAILED"
              ],
              "type": "string"
            }
          },
          {
            "name": "eventType",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhookId",
            "required": false,
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": false,
            "in": "query",
            "schema": {
              "default": 1,
              "type": "number"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "schema": {
              "default": 50,
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns paginated webhook events",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventListDto"
                }
              }
            }
          }
        },
        "tags": [
          "webhook-events"
        ]
      }
    },
    "/webhook-events/{spaceId}/{webhookEventId}": {
      "get": {
        "operationId": "findOne",
        "summary": "Get a single webhook event",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhookEventId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns webhook event with executions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEventDto"
                }
              }
            }
          },
          "404": {
            "description": "Webhook event not found"
          }
        },
        "tags": [
          "webhook-events"
        ]
      }
    },
    "/webhook-events/{spaceId}/{webhookEventId}/replay": {
      "post": {
        "operationId": "replay",
        "summary": "Replay a webhook event",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhookEventId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook event replayed successfully"
          },
          "404": {
            "description": "Webhook event not found"
          }
        },
        "tags": [
          "webhook-events"
        ]
      }
    },
    "/webhook-events/{spaceId}/shipment/{shipmentId}": {
      "get": {
        "operationId": "findByShipment",
        "summary": "Get webhook events for a shipment",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "shipmentId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns webhook events for the shipment",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEventDto"
                  }
                }
              }
            }
          }
        },
        "tags": [
          "webhook-events"
        ]
      }
    },
    "/provider-configs/{spaceId}": {
      "post": {
        "operationId": "createProviderConfig",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateProviderConfigDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConfigDto"
                }
              }
            }
          }
        },
        "tags": [
          "ProviderConfigs"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "get": {
        "operationId": "listProviderConfigs",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConfigListDto"
                }
              }
            }
          }
        },
        "tags": [
          "ProviderConfigs"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/provider-configs/{spaceId}/{providerId}": {
      "get": {
        "operationId": "getProviderConfig",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "providerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConfigDto"
                }
              }
            }
          }
        },
        "tags": [
          "ProviderConfigs"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "put": {
        "operationId": "updateProviderConfig",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "providerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProviderConfigDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProviderConfigDto"
                }
              }
            }
          }
        },
        "tags": [
          "ProviderConfigs"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      },
      "delete": {
        "operationId": "deleteProviderConfig",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "providerId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": ""
          }
        },
        "tags": [
          "ProviderConfigs"
        ],
        "security": [
          {
            "bearer": []
          }
        ]
      }
    },
    "/spaces": {
      "post": {
        "operationId": "createSpace",
        "summary": "",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSpaceDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceDto"
                }
              }
            }
          },
          "409": {
            "description": "Space with this name already exists"
          }
        },
        "tags": [
          "Spaces"
        ]
      },
      "get": {
        "operationId": "getSpaces",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceListDto"
                }
              }
            }
          }
        },
        "tags": [
          "Spaces"
        ]
      }
    },
    "/spaces/{spaceId}": {
      "get": {
        "operationId": "getSpace",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceDto"
                }
              }
            }
          },
          "404": {
            "description": "Space not found"
          }
        },
        "tags": [
          "Spaces"
        ]
      },
      "put": {
        "operationId": "updateSpace",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSpaceDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpaceDto"
                }
              }
            }
          },
          "404": {
            "description": "Space not found"
          },
          "409": {
            "description": "Space with this name already exists"
          }
        },
        "tags": [
          "Spaces"
        ]
      },
      "delete": {
        "operationId": "deleteSpace",
        "summary": "",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Space deleted successfully"
          },
          "404": {
            "description": "Space not found"
          }
        },
        "tags": [
          "Spaces"
        ]
      }
    },
    "/analytics/{spaceId}/shipments": {
      "get": {
        "operationId": "getShipmentsAnalytics",
        "summary": "Get shipments analytics for a space",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "description": "Space identifier",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Start date (ISO format)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "End date (ISO format)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "granularity",
            "required": false,
            "in": "query",
            "description": "Time granularity for volume over time",
            "schema": {
              "enum": [
                "day",
                "week",
                "month"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shipments analytics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ShipmentsAnalyticsDto"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ]
      }
    },
    "/analytics/{spaceId}/providers": {
      "get": {
        "operationId": "getProvidersAnalytics",
        "summary": "Get provider-level analytics for a space",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "description": "Space identifier",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Start date (ISO format)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "End date (ISO format)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "granularity",
            "required": false,
            "in": "query",
            "description": "Time granularity",
            "schema": {
              "enum": [
                "day",
                "week",
                "month"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider analytics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProvidersAnalyticsDto"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ]
      }
    },
    "/analytics/{spaceId}/webhooks": {
      "get": {
        "operationId": "getWebhooksAnalytics",
        "summary": "Get webhook analytics for a space",
        "parameters": [
          {
            "name": "spaceId",
            "required": true,
            "in": "path",
            "description": "Space identifier",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "required": false,
            "in": "query",
            "description": "Start date (ISO format)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "required": false,
            "in": "query",
            "description": "End date (ISO format)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "granularity",
            "required": false,
            "in": "query",
            "description": "Time granularity",
            "schema": {
              "enum": [
                "day",
                "week",
                "month"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhooks analytics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhooksAnalyticsDto"
                }
              }
            }
          }
        },
        "tags": [
          "analytics"
        ]
      }
    },
    "/webhook/inpost": {
      "post": {
        "operationId": "processInpostWebhook",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/webhook/dhl": {
      "post": {
        "operationId": "processDhlWebhook",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/webhook/dpd": {
      "post": {
        "operationId": "processDpdWebhook",
        "summary": "",
        "parameters": [],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GenericResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": []
          }
        ],
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "info": {
    "title": "Shipments API",
    "description": "Shipments Backend API Documentation",
    "version": "1.0.0",
    "contact": {}
  },
  "tags": [],
  "servers": [],
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "type": "http"
      }
    },
    "schemas": {
      "ParcelDimensions": {
        "type": "object",
        "properties": {
          "length": {
            "type": "number"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          }
        },
        "required": [
          "length",
          "width",
          "height"
        ]
      },
      "Parcel": {
        "type": "object",
        "properties": {
          "dimensions": {
            "$ref": "#/components/schemas/ParcelDimensions"
          },
          "weight": {
            "type": "number"
          }
        },
        "required": [
          "dimensions",
          "weight"
        ]
      },
      "Address": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          },
          "postCode": {
            "type": "string"
          },
          "countryCode": {
            "type": "string"
          },
          "street": {
            "type": "string"
          },
          "houseNumber": {
            "type": "string"
          },
          "flatNumber": {
            "type": "string"
          }
        },
        "required": [
          "city",
          "postCode",
          "countryCode",
          "street",
          "houseNumber"
        ]
      },
      "Receiver": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          }
        },
        "required": [
          "email",
          "phone"
        ]
      },
      "Money": {
        "type": "object",
        "properties": {
          "currencyCode": {
            "type": "string"
          },
          "centAmount": {
            "type": "number"
          }
        },
        "required": [
          "currencyCode",
          "centAmount"
        ]
      },
      "CreateShipmentDto": {
        "type": "object",
        "properties": {
          "providerId": {
            "type": "string",
            "description": "Provider config ID (e.g., \"inpost\", \"inpost-b2b\")"
          },
          "parcels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Parcel"
            }
          },
          "data": {
            "type": "string"
          },
          "orderDate": {
            "format": "date-time",
            "type": "string"
          },
          "receiver": {
            "$ref": "#/components/schemas/Receiver"
          },
          "cod": {
            "$ref": "#/components/schemas/Money"
          },
          "pickupPointId": {
            "type": "string"
          },
          "costsCenter": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "comment": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "orderNumber": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          }
        },
        "required": [
          "providerId",
          "parcels"
        ]
      },
      "ShipmentInformationDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "trackingNumber": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "trackingNumber"
        ]
      },
      "AddShipmentWithTrackingNumberDto": {
        "type": "object",
        "properties": {
          "providerId": {
            "type": "string",
            "description": "Provider config ID (e.g., \"inpost\", \"inpost-b2b\")"
          },
          "data": {
            "type": "string"
          },
          "trackingNumber": {
            "type": "string"
          }
        },
        "required": [
          "providerId",
          "trackingNumber"
        ]
      },
      "ShipmentDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "parcels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Parcel"
            }
          },
          "providerId": {
            "type": "string",
            "enum": [
              "dhl",
              "dhl-sp",
              "inpost",
              "dpd"
            ]
          },
          "providerType": {
            "type": "string"
          },
          "data": {
            "type": "string"
          },
          "trackingNumber": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "NEW",
              "IN_TRANSIT",
              "COMPLETED",
              "RETURNED",
              "CANCELLED"
            ]
          },
          "orderNumber": {
            "type": "string"
          },
          "orderDate": {
            "format": "date-time",
            "type": "string"
          },
          "finishedDate": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "modifiedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "ownerId",
          "parcels",
          "providerId",
          "trackingNumber",
          "status",
          "createdAt",
          "modifiedAt"
        ]
      },
      "ShipmentListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipmentDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "StringFilter": {
        "type": "object",
        "properties": {
          "equals": {
            "type": "string"
          },
          "not": {
            "type": "string"
          },
          "in": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notIn": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "contains": {
            "type": "string"
          },
          "startsWith": {
            "type": "string"
          },
          "endsWith": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          }
        }
      },
      "ShipmentStatusFilter": {
        "type": "object",
        "properties": {
          "equals": {
            "type": "string",
            "enum": [
              "new",
              "in-transit",
              "completed",
              "returned",
              "cancelled"
            ]
          },
          "not": {
            "type": "string",
            "enum": [
              "new",
              "in-transit",
              "completed",
              "returned",
              "cancelled"
            ]
          },
          "in": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "new",
                "in-transit",
                "completed",
                "returned",
                "cancelled"
              ]
            }
          },
          "notIn": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "new",
                "in-transit",
                "completed",
                "returned",
                "cancelled"
              ]
            }
          }
        }
      },
      "DateFilter": {
        "type": "object",
        "properties": {
          "equals": {
            "format": "date-time",
            "type": "string"
          },
          "not": {
            "format": "date-time",
            "type": "string"
          },
          "in": {
            "type": "array",
            "items": {
              "format": "date-time",
              "type": "string"
            }
          },
          "notIn": {
            "type": "array",
            "items": {
              "format": "date-time",
              "type": "string"
            }
          },
          "lt": {
            "format": "date-time",
            "type": "string"
          },
          "lte": {
            "format": "date-time",
            "type": "string"
          },
          "gt": {
            "format": "date-time",
            "type": "string"
          },
          "gte": {
            "format": "date-time",
            "type": "string"
          }
        }
      },
      "ShipmentWhereFilter": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "ownerId": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "providerId": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "trackingNumber": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "data": {
            "$ref": "#/components/schemas/StringFilter"
          },
          "status": {
            "$ref": "#/components/schemas/ShipmentStatusFilter"
          },
          "createdAt": {
            "$ref": "#/components/schemas/DateFilter"
          },
          "modifiedAt": {
            "$ref": "#/components/schemas/DateFilter"
          },
          "AND": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipmentWhereFilter"
            }
          },
          "OR": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipmentWhereFilter"
            }
          },
          "NOT": {
            "$ref": "#/components/schemas/ShipmentWhereFilter"
          }
        }
      },
      "FindManyShipmentDto": {
        "type": "object",
        "properties": {
          "where": {
            "$ref": "#/components/schemas/ShipmentWhereFilter"
          },
          "take": {
            "type": "number",
            "default": 10
          },
          "skip": {
            "type": "number",
            "default": 0
          },
          "cursor": {
            "type": "object",
            "description": "Cursor for pagination"
          },
          "orderBy": {
            "type": "object",
            "description": "Order by fields"
          }
        }
      },
      "ShipmentStatusEntry": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "status",
          "createdAt"
        ]
      },
      "ShipmentEventDto": {
        "type": "object",
        "properties": {
          "shipmentEventId": {
            "type": "string"
          },
          "shipmentId": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "Order",
              "Shipment",
              "Provider",
              "Webhook"
            ]
          },
          "summary": {
            "type": "string"
          },
          "eventData": {
            "type": "object"
          },
          "eventDate": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "shipmentEventId",
          "shipmentId",
          "category",
          "eventDate",
          "createdAt"
        ]
      },
      "ShipmentWithStatusEntriesDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "ownerId": {
            "type": "string"
          },
          "parcels": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Parcel"
            }
          },
          "providerId": {
            "type": "string",
            "enum": [
              "dhl",
              "dhl-sp",
              "inpost",
              "dpd"
            ]
          },
          "providerType": {
            "type": "string"
          },
          "data": {
            "type": "string"
          },
          "trackingNumber": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "NEW",
              "IN_TRANSIT",
              "COMPLETED",
              "RETURNED",
              "CANCELLED"
            ]
          },
          "orderNumber": {
            "type": "string"
          },
          "orderDate": {
            "format": "date-time",
            "type": "string"
          },
          "finishedDate": {
            "format": "date-time",
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "modifiedAt": {
            "format": "date-time",
            "type": "string"
          },
          "statusEntries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipmentStatusEntry"
            }
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipmentEventDto"
            }
          }
        },
        "required": [
          "id",
          "ownerId",
          "parcels",
          "providerId",
          "trackingNumber",
          "status",
          "createdAt",
          "modifiedAt",
          "statusEntries",
          "events"
        ]
      },
      "ShipmentEventListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShipmentEventDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "GenericResponse": {
        "type": "object",
        "properties": {}
      },
      "TrackingUrlResponse": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          }
        },
        "required": [
          "url"
        ]
      },
      "CreateWebhookDto": {
        "type": "object",
        "properties": {
          "webhookId": {
            "type": "string",
            "description": "Unique identifier for the webhook within the space",
            "minLength": 1,
            "maxLength": 100
          },
          "url": {
            "type": "string",
            "description": "URL to send webhook requests to"
          },
          "method": {
            "type": "string",
            "description": "HTTP method to use for webhook requests",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ],
            "default": "POST"
          },
          "apiKey": {
            "type": "string",
            "description": "API key to include in webhook requests",
            "maxLength": 500
          },
          "signature": {
            "type": "string",
            "description": "Signature for webhook authentication",
            "maxLength": 500
          },
          "isActive": {
            "type": "boolean",
            "description": "Whether the webhook is active",
            "default": true
          }
        },
        "required": [
          "webhookId",
          "url"
        ]
      },
      "WebhookDto": {
        "type": "object",
        "properties": {
          "webhookId": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "apiKey": {
            "type": "string"
          },
          "signature": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "modifiedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "webhookId",
          "spaceId",
          "url",
          "method",
          "isActive",
          "createdAt",
          "modifiedAt"
        ]
      },
      "WebhookListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "UpdateWebhookDto": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "description": "URL to send webhook requests to"
          },
          "method": {
            "type": "string",
            "description": "HTTP method to use for webhook requests",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "PATCH",
              "DELETE"
            ]
          },
          "apiKey": {
            "type": "string",
            "description": "API key to include in webhook requests",
            "maxLength": 500
          },
          "signature": {
            "type": "string",
            "description": "Signature for webhook authentication",
            "maxLength": 500
          },
          "isActive": {
            "type": "boolean",
            "description": "Whether the webhook is active"
          }
        }
      },
      "WebhookArchiveDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "webhookId": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "apiKey": {
            "type": "string"
          },
          "signature": {
            "type": "string"
          },
          "isActive": {
            "type": "boolean"
          },
          "archivedAt": {
            "format": "date-time",
            "type": "string"
          },
          "archiveReason": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "webhookId",
          "spaceId",
          "url",
          "method",
          "isActive",
          "archivedAt",
          "archiveReason"
        ]
      },
      "WebhookArchiveListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookArchiveDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "WebhookExecutionDto": {
        "type": "object",
        "properties": {
          "webhookExecutionId": {
            "type": "string"
          },
          "webhookEventId": {
            "type": "string"
          },
          "attemptNumber": {
            "type": "number"
          },
          "result": {
            "type": "string",
            "enum": [
              "SUCCESS",
              "FAILURE"
            ]
          },
          "httpStatus": {
            "type": "number"
          },
          "responseBody": {
            "type": "string"
          },
          "errorMessage": {
            "type": "string"
          },
          "durationMs": {
            "type": "number"
          },
          "executedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "webhookExecutionId",
          "webhookEventId",
          "attemptNumber",
          "result",
          "executedAt"
        ]
      },
      "WebhookEventDto": {
        "type": "object",
        "properties": {
          "webhookEventId": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "shipmentId": {
            "type": "string"
          },
          "webhookId": {
            "type": "string"
          },
          "eventType": {
            "type": "string"
          },
          "payload": {
            "type": "object"
          },
          "url": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "apiKey": {
            "type": "string"
          },
          "signature": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "WAITING",
              "PENDING",
              "IN_PROGRESS",
              "DELIVERED",
              "FAILED"
            ]
          },
          "maxAttempts": {
            "type": "number"
          },
          "deliveredAt": {
            "format": "date-time",
            "type": "string"
          },
          "originalEventId": {
            "type": "string"
          },
          "executions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookExecutionDto"
            }
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "modifiedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "webhookEventId",
          "spaceId",
          "shipmentId",
          "webhookId",
          "eventType",
          "payload",
          "url",
          "method",
          "status",
          "maxAttempts",
          "executions",
          "createdAt",
          "modifiedAt"
        ]
      },
      "WebhookEventListDto": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventDto"
            }
          },
          "total": {
            "type": "number"
          },
          "page": {
            "type": "number"
          },
          "limit": {
            "type": "number"
          },
          "totalPages": {
            "type": "number"
          }
        },
        "required": [
          "events",
          "total",
          "page",
          "limit",
          "totalPages"
        ]
      },
      "CreateProviderConfigDto": {
        "type": "object",
        "properties": {
          "providerId": {
            "type": "string"
          },
          "providerType": {
            "type": "string",
            "enum": [
              "inpost",
              "dhl",
              "dhl-sp",
              "dpd"
            ]
          },
          "name": {
            "type": "string"
          },
          "defaults": {
            "type": "object"
          },
          "templates": {
            "type": "object"
          },
          "accountParams": {
            "type": "object"
          },
          "isActive": {
            "type": "boolean"
          }
        },
        "required": [
          "providerId",
          "providerType"
        ]
      },
      "ProviderConfigDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "spaceId": {
            "type": "string"
          },
          "providerId": {
            "type": "string"
          },
          "providerType": {
            "type": "string",
            "enum": [
              "inpost",
              "dhl",
              "dhl-sp",
              "dpd"
            ]
          },
          "name": {
            "type": "string"
          },
          "defaults": {
            "type": "object"
          },
          "templates": {
            "type": "object"
          },
          "accountParams": {
            "type": "object"
          },
          "isActive": {
            "type": "boolean"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "modifiedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "spaceId",
          "providerId",
          "providerType",
          "isActive",
          "createdAt",
          "modifiedAt"
        ]
      },
      "ProviderConfigListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderConfigDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "UpdateProviderConfigDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "defaults": {
            "type": "object"
          },
          "templates": {
            "type": "object"
          },
          "accountParams": {
            "type": "object"
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "CreateSpaceDto": {
        "type": "object",
        "properties": {
          "spaceId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "spaceId",
          "name"
        ]
      },
      "SpaceDto": {
        "type": "object",
        "properties": {
          "spaceId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "createdAt": {
            "format": "date-time",
            "type": "string"
          },
          "modifiedAt": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "spaceId",
          "name",
          "createdAt",
          "modifiedAt"
        ]
      },
      "SpaceListDto": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpaceDto"
            }
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "items",
          "total"
        ]
      },
      "UpdateSpaceDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "VolumeOverTimeItemDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "date",
          "count"
        ]
      },
      "TerminalStatusByProviderItemDto": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string"
          },
          "completed": {
            "type": "number"
          },
          "returned": {
            "type": "number"
          },
          "canceled": {
            "type": "number"
          },
          "total": {
            "type": "number"
          }
        },
        "required": [
          "provider",
          "completed",
          "returned",
          "canceled",
          "total"
        ]
      },
      "StatusInProviderItemDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "avgHours": {
            "type": "number"
          }
        },
        "required": [
          "status",
          "avgHours"
        ]
      },
      "TimeInStatusByProviderItemDto": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string"
          },
          "statuses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusInProviderItemDto"
            }
          }
        },
        "required": [
          "provider",
          "statuses"
        ]
      },
      "ShipmentsAnalyticsDto": {
        "type": "object",
        "properties": {
          "volumeOverTime": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VolumeOverTimeItemDto"
            }
          },
          "terminalStatusByProvider": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TerminalStatusByProviderItemDto"
            }
          },
          "timeInStatusByProvider": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeInStatusByProviderItemDto"
            }
          }
        },
        "required": [
          "volumeOverTime",
          "terminalStatusByProvider",
          "timeInStatusByProvider"
        ]
      },
      "DeliveryTimeItemDto": {
        "type": "object",
        "properties": {
          "provider": {
            "type": "string"
          },
          "avgHours": {
            "type": "number"
          }
        },
        "required": [
          "provider",
          "avgHours"
        ]
      },
      "ProvidersAnalyticsDto": {
        "type": "object",
        "properties": {
          "deliveryTime": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryTimeItemDto"
            }
          }
        },
        "required": [
          "deliveryTime"
        ]
      },
      "WebhookSuccessRateItemDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string"
          },
          "count": {
            "type": "number"
          }
        },
        "required": [
          "status",
          "count"
        ]
      },
      "WebhookLatencyDto": {
        "type": "object",
        "properties": {
          "avg": {
            "type": "number",
            "description": "Average latency in seconds"
          },
          "median": {
            "type": "number",
            "description": "Median latency in seconds"
          },
          "p95": {
            "type": "number",
            "description": "P95 latency in seconds"
          }
        },
        "required": [
          "avg",
          "median",
          "p95"
        ]
      },
      "WebhooksAnalyticsDto": {
        "type": "object",
        "properties": {
          "successRate": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookSuccessRateItemDto"
            }
          },
          "avgRetries": {
            "type": "number",
            "description": "Average number of retries per webhook event"
          },
          "latency": {
            "$ref": "#/components/schemas/WebhookLatencyDto"
          }
        },
        "required": [
          "successRate",
          "avgRetries",
          "latency"
        ]
      },
      "ParcelStatusUpdateNotification": {
        "type": "object",
        "properties": {
          "parcelId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        },
        "required": [
          "parcelId",
          "status"
        ]
      }
    }
  }
}
