{
  "openapi": "3.1.0",
  "info": {
    "title": "bitbybit Open API",
    "description": "The bitbybit Open API provides programmatic access to your bitbybit data including customers, orders, and products.",
    "version": "1.0.0",
    "contact": {
      "name": "bitbybit Support",
      "url": "https://bitbybit.studio"
    }
  },
  "servers": [
    {
      "url": "https://api.bitbybit.studio/customer/api/open/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/customers": {
      "get": {
        "operationId": "listCustomers",
        "summary": "List customers",
        "description": "Retrieve a paginated list of customers for your company.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            },
            "description": "Page number"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            },
            "description": "Number of results per page"
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search by name, email, or phone number"
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by source values (comma-separated)"
          },
          {
            "name": "tags",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by tags (comma-separated)"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "updatedAt:desc"
            },
            "description": "Sort field and direction (e.g., updatedAt:desc)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Customer"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMeta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "operationId": "createCustomer",
        "summary": "Create a customer",
        "description": "Create a new customer. Either email or phoneNumber is required.",
        "tags": [
          "Customers"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "phoneNumber": {
                    "type": "string"
                  },
                  "firstName": {
                    "type": "string"
                  },
                  "lastName": {
                    "type": "string"
                  },
                  "imageUrl": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "addresses": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/AddressInput"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/customers/{id}": {
      "get": {
        "operationId": "getCustomer",
        "summary": "Get a customer",
        "description": "Retrieve a single customer by ID.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "updateCustomer",
        "summary": "Update a customer",
        "description": "Update an existing customer's information.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "phoneNumber": {
                    "type": "string"
                  },
                  "firstName": {
                    "type": "string"
                  },
                  "lastName": {
                    "type": "string"
                  },
                  "imageUrl": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Customer"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteCustomer",
        "summary": "Delete a customer",
        "description": "Permanently delete a customer and their associated data.",
        "tags": [
          "Customers"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/orders": {
      "get": {
        "operationId": "listOrders",
        "summary": "List orders",
        "description": "Retrieve a paginated list of orders for your company.",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search by order ID or customer name"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "archived",
                "cancelled",
                "refunded"
              ]
            }
          },
          {
            "name": "fulfillmentStatus",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "unfulfilled",
                "fulfilled"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMeta"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createOrder",
        "summary": "Create an order",
        "description": "Create a new order. Provide either a customerId or a customer object to auto-create.",
        "tags": [
          "Orders"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "lineItems",
                  "shippingAddress"
                ],
                "properties": {
                  "customerId": {
                    "type": "string",
                    "description": "ID of an existing customer"
                  },
                  "customer": {
                    "type": "object",
                    "description": "Create or find a customer by phone/email",
                    "properties": {
                      "firstName": {
                        "type": "string"
                      },
                      "lastName": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string",
                        "format": "email"
                      }
                    },
                    "required": [
                      "firstName",
                      "lastName"
                    ]
                  },
                  "lineItems": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "productVariantId",
                        "quantity"
                      ],
                      "properties": {
                        "productVariantId": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1
                        }
                      }
                    }
                  },
                  "shippingAddress": {
                    "$ref": "#/components/schemas/ShippingAddressInput"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Order created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "getOrder",
        "summary": "Get an order",
        "description": "Retrieve a single order by ID with line items and shipping details.",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "updateOrder",
        "summary": "Update an order",
        "description": "Update order status, fulfillment status, or notes.",
        "tags": [
          "Orders"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "archived",
                      "cancelled",
                      "refunded"
                    ]
                  },
                  "fulfillmentStatus": {
                    "type": "string",
                    "enum": [
                      "unfulfilled",
                      "fulfilled"
                    ]
                  },
                  "financialStatus": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "paid",
                      "refunded"
                    ]
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Order updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Order"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/orders/{id}/shipping": {
      "get": {
        "operationId": "getOrderShippingMethod",
        "summary": "Get Order Shipping",
        "description": "Retrieve the selected (active) shipping method for an order by order ID.",
        "tags": ["Orders"],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Order ID — the unique identifier of the order.",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "oneOf": [
                        { "$ref": "#/components/schemas/OrderShippingMethod" },
                        { "type": "null" }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "List products",
        "description": "Retrieve a paginated list of products for your company.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search by product name"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMeta"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createProduct",
        "summary": "Create a product",
        "description": "Create a new product with variants.",
        "tags": [
          "Products"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "variants"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "variants": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "title",
                        "price"
                      ],
                      "properties": {
                        "title": {
                          "type": "string"
                        },
                        "price": {
                          "type": "number",
                          "minimum": 0
                        },
                        "sku": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Product created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get a product",
        "description": "Retrieve a single product by ID with variants and options.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "put": {
        "operationId": "updateProduct",
        "summary": "Update a product",
        "description": "Update product name or description.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Product updated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Product"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "operationId": "deleteProduct",
        "summary": "Delete a product",
        "description": "Permanently delete a product and its variants.",
        "tags": [
          "Products"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API key for authentication. Create one in Settings > Developer."
      }
    },
    "schemas": {
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "imageUrl": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "addresses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          },
          "additionalData": {
            "type": "object",
            "description": "Custom customer fields defined for your company, returned as a flat map of field key to value. Keys match the field keys you configured in Settings; values keep the type they were stored with (string, number, boolean, array, or object). Returns an empty object when the customer has no custom field values.",
            "additionalProperties": true,
            "example": {
              "favorite_food": "Nasi Goreng",
              "shirt_size": "L",
              "loyalty_signup_year": 2024
            }
          },
          "subscriptionStatus": {
            "type": "array",
            "description": "Marketing subscription state per bitbybit app. Apps the customer has never been recorded against are omitted.",
            "items": {
              "$ref": "#/components/schemas/SubscriptionStatus"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SubscriptionStatus": {
        "type": "object",
        "properties": {
          "app": {
            "type": "string",
            "enum": ["BITCRM", "BITLINK"],
            "description": "The bitbybit app the subscription state applies to"
          },
          "status": {
            "type": "string",
            "enum": ["subscribe", "unsubscribe"],
            "description": "Whether the customer is subscribed to marketing messages for that app"
          }
        }
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "orderNumber": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "archived",
              "cancelled",
              "refunded"
            ]
          },
          "fulfillmentStatus": {
            "type": "string",
            "enum": [
              "unfulfilled",
              "fulfilled"
            ]
          },
          "financialStatus": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "refunded"
            ]
          },
          "total": {
            "type": "number"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "customer": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "firstName": {
                "type": "string",
                "nullable": true
              },
              "lastName": {
                "type": "string",
                "nullable": true
              },
              "email": {
                "type": "string",
                "nullable": true
              },
              "phoneNumber": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "lineItems": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            }
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/Address"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OrderShippingMethod": {
        "type": "object",
        "description": "Shipping method selected for an order.",
        "properties": {
          "companyId": { "type": "integer" },
          "id": { "type": "string" },
          "name": { "type": "string", "nullable": true },
          "fee": { "type": "number", "nullable": true },
          "type": {
            "type": "string",
            "enum": ["custom", "gosend", "jne", "kirimin_aja", "ride_blitz"]
          },
          "currency": { "type": "string", "nullable": true },

          "deliveryAddress": { "type": "string", "nullable": true },
          "deliveryEmail": { "type": "string", "nullable": true },
          "deliveryLatitude": { "type": "number", "nullable": true },
          "deliveryLongitude": { "type": "number", "nullable": true },
          "deliveryCity": { "type": "string", "nullable": true },
          "deliveryProvince": { "type": "string", "nullable": true },
          "deliveryZip": { "type": "string", "nullable": true },
          "deliveryCountry": { "type": "string", "nullable": true },
          "deliveryName": { "type": "string", "nullable": true },
          "deliveryNotes": { "type": "string", "nullable": true },
          "deliveryPhone": { "type": "string", "nullable": true },
          "deliveryKecamatan": { "type": "string", "nullable": true },
          "deliveryKecamatanId": { "type": "integer", "nullable": true },
          "deliveryKelurahan": { "type": "string", "nullable": true },
          "deliveryKelurahanId": { "type": "integer", "nullable": true },

          "driverLicensePlate": { "type": "string", "nullable": true },
          "driverName": { "type": "string", "nullable": true },
          "driverPhone": { "type": "string", "nullable": true },
          "driverPhoto": { "type": "string", "nullable": true },

          "senderAddress": { "type": "string", "nullable": true },
          "senderEmail": { "type": "string", "nullable": true },
          "senderLatitude": { "type": "number", "nullable": true },
          "senderLongitude": { "type": "number", "nullable": true },
          "senderName": { "type": "string", "nullable": true },
          "senderNotes": { "type": "string", "nullable": true },
          "senderPhone": { "type": "string", "nullable": true },
          "senderZip": { "type": "string", "nullable": true },
          "senderCountry": { "type": "string", "nullable": true },
          "senderProvince": { "type": "string", "nullable": true },
          "senderCity": { "type": "string", "nullable": true },
          "senderKecamatan": { "type": "string", "nullable": true },
          "senderKelurahan": { "type": "string", "nullable": true },
          "senderKecamatanId": { "type": "integer", "nullable": true },
          "senderKelurahanId": { "type": "integer", "nullable": true },

          "shippingStatus": { "type": "string", "nullable": true },
          "trackingUrl": { "type": "string", "nullable": true },
          "deliveryMethod": { "type": "string", "nullable": true },
          "distance": { "type": "number", "nullable": true },

          "packageWeight": { "type": "number", "nullable": true },
          "packageLength": { "type": "number", "nullable": true },
          "packageWidth": { "type": "number", "nullable": true },
          "packageHeight": { "type": "number", "nullable": true },

          "orderNo": { "type": "string", "nullable": true },
          "bookingId": { "type": "string", "nullable": true },
          "cancellationReason": { "type": "string", "nullable": true },
          "retryBooking": { "type": "boolean" },
          "eventTimestamp": { "type": "string", "nullable": true },
          "cancelledBy": { "type": "string", "nullable": true },
          "cancelledSource": { "type": "string", "nullable": true },

          "serviceType": {
            "type": "string",
            "nullable": true,
            "enum": ["INSTANT", "EXPRESS"]
          },
          "itemName": { "type": "string", "nullable": true },
          "itemType": { "type": "string", "nullable": true },
          "itemValue": { "type": "number", "nullable": true },
          "itemQty": { "type": "integer", "nullable": true },
          "shippingNotes": { "type": "string", "nullable": true },

          "insurance": { "type": "boolean" },
          "insuranceFee": { "type": "number", "nullable": true },
          "insuranceAmount": { "type": "number", "nullable": true },
          "discountAmount": { "type": "number", "nullable": true },
          "discountPercentage": { "type": "number", "nullable": true },
          "packageHandover": {
            "type": "string",
            "nullable": true,
            "enum": ["PICKUP", "DROPOFF"]
          },
          "pickupSchedule": { "type": "string", "format": "date-time", "nullable": true },
          "vehicleType": {
            "type": "string",
            "nullable": true,
            "enum": ["TWO_WHEEL", "FOUR_WHEEL"]
          },
          "courierGroup": { "type": "string", "nullable": true },
          "selectedExpedition": { "type": "string", "nullable": true },
          "selectedDelivery": { "type": "string", "nullable": true },
          "bikeFuelType": { "type": "string", "nullable": true },
          "pickupNumber": { "type": "string", "nullable": true },
          "paymentId": { "type": "string", "nullable": true },
          "paymentStatus": { "type": "string", "nullable": true },
          "awb": { "type": "string", "nullable": true },
          "serviceName": { "type": "string", "nullable": true },
          "statusCode": { "type": "integer", "nullable": true },

          "storeLocationId": { "type": "string", "nullable": true }
        },
        "additionalProperties": true
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "productId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "media": {
            "type": "string",
            "nullable": true
          },
          "medias": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductVariant"
            }
          },
          "options": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "values": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ProductVariant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "compareAtPrice": {
            "type": "number",
            "nullable": true
          },
          "inventorySku": {
            "type": "string",
            "nullable": true
          },
          "media": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "LineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "quantity": {
            "type": "integer"
          },
          "price": {
            "type": "number"
          },
          "title": {
            "type": "string"
          },
          "productVariant": {
            "$ref": "#/components/schemas/ProductVariant"
          }
        }
      },
      "Address": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "address1": {
            "type": "string",
            "nullable": true
          },
          "address2": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "province": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          },
          "zip": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "AddressInput": {
        "type": "object",
        "required": [
          "address1"
        ],
        "properties": {
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "zip": {
            "type": "string"
          },
          "mainAddress": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "ShippingAddressInput": {
        "type": "object",
        "required": [
          "firstName",
          "lastName",
          "phone",
          "address1",
          "city",
          "province",
          "zip"
        ],
        "properties": {
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "address1": {
            "type": "string"
          },
          "address2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "zip": {
            "type": "string"
          }
        }
      },
      "PaginationMeta": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "hasNextPage": {
            "type": "boolean"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Authentication failed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "INVALID_API_KEY",
                "message": "Invalid or expired API key"
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "NOT_FOUND",
                "message": "Resource not found"
              }
            }
          }
        }
      },
      "ValidationError": {
        "description": "Validation error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "Invalid request body"
              }
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "code": "RATE_LIMIT_EXCEEDED",
                "message": "Too many requests. Please retry after the reset period."
              }
            }
          }
        }
      }
    }
  }
}
