{
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "description": "API key (lk_live_..., lk_test_..., or lk_pub_...)",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Dock scheduling and supplier communication API. Manage locations, docks, booking slots, reservations, suppliers, and vehicle types.",
    "title": "Avisator API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/bookings": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "pending",
                "approved",
                "rejected",
                "cancelled",
                "arrived",
                "in_progress",
                "completed",
                "no_show"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "supplier_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "dock_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "location_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List bookings",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:read"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "cargo_description": {
                    "type": "string"
                  },
                  "date": {
                    "format": "date",
                    "type": "string"
                  },
                  "dock_id": {
                    "type": "string"
                  },
                  "driver_name": {
                    "type": "string"
                  },
                  "driver_phone": {
                    "type": "string"
                  },
                  "license_plate": {
                    "type": "string"
                  },
                  "location_id": {
                    "type": "string"
                  },
                  "reference_number": {
                    "type": "string"
                  },
                  "start_time": {
                    "pattern": "^[0-2]\\d:[0-5]\\d$",
                    "type": "string"
                  },
                  "supplier_id": {
                    "type": "string"
                  },
                  "vehicle_type_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "location_id",
                  "dock_id",
                  "supplier_id",
                  "vehicle_type_id",
                  "date",
                  "start_time"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create a booking",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:write"
      }
    },
    "/api/v1/bookings/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Cancel a booking",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:write"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get booking details",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:read"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "cargo_description": {
                    "type": "string"
                  },
                  "date": {
                    "format": "date",
                    "type": "string"
                  },
                  "dock_id": {
                    "type": "string"
                  },
                  "driver_name": {
                    "type": "string"
                  },
                  "driver_phone": {
                    "type": "string"
                  },
                  "license_plate": {
                    "type": "string"
                  },
                  "reference_number": {
                    "type": "string"
                  },
                  "start_time": {
                    "pattern": "^[0-2]\\d:[0-5]\\d$",
                    "type": "string"
                  },
                  "vehicle_type_id": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Update/reschedule a booking",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:write"
      }
    },
    "/api/v1/bookings/{id}/notes": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "content": {
                    "type": "string"
                  },
                  "is_important": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "content"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Add a note to a booking",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:write"
      }
    },
    "/api/v1/bookings/{id}/status": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "rejection_reason": {
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "approved",
                      "rejected",
                      "cancelled",
                      "arrived",
                      "in_progress",
                      "completed",
                      "no_show"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "status"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Update booking status",
        "tags": [
          "Bookings"
        ],
        "x-required-scope": "avisator:bookings:write"
      }
    },
    "/api/v1/dock-map/{location_id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "location_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get dock map occupancy data",
        "tags": [
          "Dock Map"
        ],
        "x-required-scope": "avisator:locations:read"
      }
    },
    "/api/v1/health": {
      "get": {
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [],
        "summary": "Health check",
        "tags": [
          "System"
        ]
      }
    },
    "/api/v1/locations": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List locations",
        "tags": [
          "Locations"
        ],
        "x-required-scope": "avisator:locations:read"
      }
    },
    "/api/v1/locations/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get location details with docks and schedules",
        "tags": [
          "Locations"
        ],
        "x-required-scope": "avisator:locations:read"
      }
    },
    "/api/v1/locations/{id}/docks": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List docks at location",
        "tags": [
          "Locations"
        ],
        "x-required-scope": "avisator:locations:read"
      }
    },
    "/api/v1/slots": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "location_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "dock_id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get available booking slots",
        "tags": [
          "Slots"
        ],
        "x-required-scope": "avisator:slots:read"
      }
    },
    "/api/v1/suppliers": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "default": 50,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List suppliers",
        "tags": [
          "Suppliers"
        ],
        "x-required-scope": "avisator:suppliers:read"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "contact_email": {
                    "format": "email",
                    "type": "string"
                  },
                  "contact_phone": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "nip": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Create a supplier",
        "tags": [
          "Suppliers"
        ],
        "x-required-scope": "avisator:suppliers:write"
      }
    },
    "/api/v1/suppliers/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get supplier details",
        "tags": [
          "Suppliers"
        ],
        "x-required-scope": "avisator:suppliers:read"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "contact_email": {
                    "format": "email",
                    "type": "string"
                  },
                  "contact_phone": {
                    "type": "string"
                  },
                  "is_active": {
                    "type": "boolean"
                  },
                  "name": {
                    "type": "string"
                  },
                  "nip": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Update a supplier",
        "tags": [
          "Suppliers"
        ],
        "x-required-scope": "avisator:suppliers:write"
      }
    },
    "/api/v1/vehicles": {
      "get": {
        "responses": {
          "200": {
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List vehicle types",
        "tags": [
          "Vehicles"
        ],
        "x-required-scope": "avisator:vehicles:read"
      }
    }
  },
  "servers": [
    {
      "url": "https://avisator.locura.tech"
    }
  ]
}
