{"openapi":"3.0.1","info":{"title":"fork.by Service API","version":"1.0"},"servers":[{"url":"http://fork.by","description":"Generated server url"}],"tags":[{"name":"BackOffice","description":"Back-office endpoints for catalog owners/admins"},{"name":"User","description":"Authentication endpoints"}],"paths":{"/api/1.0/backoffice/{id}/menu/{menuItemId}":{"put":{"tags":["BackOffice"],"summary":"Update menu item","operationId":"updateMenuItem","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"menuItemId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MenuItem"}}},"required":true},"responses":{"400":{"description":"Bad request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Updated","content":{"*/*":{"schema":{"$ref":"#/components/schemas/MenuItem"}}}}}},"delete":{"tags":["BackOffice"],"summary":"Delete menu item","operationId":"deleteMenuItem","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"menuItemId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/{id}/categories/{categoryId}":{"put":{"tags":["BackOffice"],"summary":"Update category","operationId":"updateCategory","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"categoryId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}},"required":true},"responses":{"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Updated","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Category"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["BackOffice"],"summary":"Delete category","operationId":"deleteCategory","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"categoryId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/login":{"post":{"tags":["User"],"summary":"Login","description":"Authenticates user and returns JWT token","operationId":"login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"400":{"description":"Invalid credentials","content":{"*/*":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}}}}},"/api/1.0/backoffice/{id}/support":{"get":{"tags":["BackOffice"],"summary":"Get support messages for catalog","operationId":"getSupportMessages","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["BackOffice"],"summary":"Create support message for catalog","operationId":"createSupportMessage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogSupportMessage"}}},"required":true},"responses":{"201":{"description":"Created","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CatalogSupportMessage"}}}},"400":{"description":"Bad request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/{id}/menu":{"get":{"tags":["BackOffice"],"summary":"Get menu (catalog details) by catalog id","operationId":"getMenuItems","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CatalogDetails"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["BackOffice"],"summary":"Add menu item","operationId":"addMenuItem","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MenuItem"}}},"required":true},"responses":{"201":{"description":"Created","content":{"*/*":{"schema":{"$ref":"#/components/schemas/MenuItem"}}}},"400":{"description":"Bad request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/{id}/categories":{"get":{"tags":["BackOffice"],"summary":"Get categories for catalog","operationId":"getCategories","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["BackOffice"],"summary":"Add category","operationId":"addCategory","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Category"}}},"required":true},"responses":{"201":{"description":"Created","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Category"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/upload":{"post":{"tags":["BackOffice"],"summary":"Upload file","description":"Uploads a file to /uploads/{folder}/ and returns a URL path","operationId":"uploadFile","requestBody":{"content":{"multipart/form-data":{"schema":{"required":["file","folder"],"type":"object","properties":{"file":{"type":"string","description":"File to upload","format":"binary"},"folder":{"type":"string","description":"Target folder under /uploads","example":"menu"}}}}}},"responses":{"400":{"description":"Bad request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Uploaded","content":{"*/*":{"schema":{"type":"object"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/{id}/orders/{orderId}":{"patch":{"tags":["BackOffice"],"summary":"Update order status","operationId":"updateOrder","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"orderId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"description":"Body with a single key: status"}}},"required":true},"responses":{"400":{"description":"Bad request","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"Updated","content":{"*/*":{"schema":{"$ref":"#/components/schemas/Order"}}}}}}},"/api/1.0/backoffice/catalog/{id}":{"get":{"tags":["BackOffice"],"summary":"Get catalog entry by id (backoffice)","operationId":"getCatalog","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CatalogEntry"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"tags":["BackOffice"],"summary":"Update catalog entry (backoffice)","operationId":"updateCatalogEntry","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CatalogEntry"}}},"required":true},"responses":{"200":{"description":"Updated","content":{"*/*":{"schema":{"$ref":"#/components/schemas/CatalogEntry"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/test-auth":{"get":{"tags":["User"],"summary":"Test authentication","description":"Returns a success message if request is authenticated","operationId":"testAuth","responses":{"401":{"description":"Unauthorized","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string"}}}}}}},"/api/1.0/backoffice/{id}/telegram":{"get":{"tags":["BackOffice"],"summary":"Get Telegram chatId for catalog","operationId":"getTelegramChatId","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/{id}/stats":{"get":{"tags":["BackOffice"],"summary":"Get comprehensive stats for catalog","operationId":"getStats","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/1.0/backoffice/{id}/orders":{"get":{"tags":["BackOffice"],"summary":"Get orders by catalog","description":"Optional sorting and filtering by status","operationId":"getOrdersByCatalogEntry","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"Sort option: date_desc, date_asc, status_asc, status_desc","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","description":"Filter by order status (repeatable). Example: status=CREATED&status=CONFIRMED","required":false,"schema":{"type":"array","items":{"type":"string"}}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object"}}}},"403":{"description":"Forbidden","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"*/*":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"MenuItem":{"type":"object","properties":{"id":{"type":"string"},"catId":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"price":{"type":"number","format":"double"},"weight":{"type":"integer","format":"int32"},"bzhu":{"type":"string"},"ccal":{"type":"number","format":"double"},"createdDate":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["ACTIVE","PAUSED","HIDDEN"]},"categoryId":{"type":"string"},"image":{"type":"array","items":{"type":"string"}}}},"ErrorResponse":{"type":"object","properties":{"errorMessage":{"type":"string"},"code":{"type":"integer","format":"int32"},"reasonPhrase":{"type":"string"}}},"Category":{"type":"object","properties":{"id":{"type":"string"},"companyId":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"order":{"type":"integer","format":"int32"}}},"LoginRequest":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"}}},"LoginResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"user":{"$ref":"#/components/schemas/UserEntity"},"token":{"type":"string"},"tokenType":{"type":"string"},"expiresIn":{"type":"integer","format":"int64"}}},"UserEntity":{"type":"object","properties":{"id":{"type":"string"},"username":{"type":"string"},"uuid":{"type":"string"},"email":{"type":"string"}}},"CatalogSupportMessage":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"date":{"type":"string","format":"date-time"},"companyId":{"type":"string"},"isRead":{"type":"boolean"},"isUserMessage":{"type":"boolean"}}},"Order":{"type":"object","properties":{"id":{"type":"string"},"dateCreated":{"type":"string","format":"date-time"},"lastUpdatedDate":{"type":"string","format":"date-time"},"status":{"type":"string","enum":["Created","Confirmed","Declined","Delivered","Archived"]},"catalogEntryId":{"type":"string"},"orderMenuItems":{"type":"array","items":{"$ref":"#/components/schemas/OrderMenuItem"}},"comments":{"type":"string"},"deliveryFee":{"type":"number","format":"double"},"totalPrice":{"type":"number","format":"double"},"userId":{"type":"string"},"name":{"type":"string"},"address":{"type":"string"},"phone":{"type":"string"},"deliveryType":{"type":"string"}}},"OrderMenuItem":{"type":"object","properties":{"menuItemId":{"type":"string"},"quantity":{"type":"integer","format":"int32"},"price":{"type":"number","format":"double"}}},"CatalogEntry":{"type":"object","properties":{"id":{"type":"string"},"orgName":{"type":"string"},"orgUrl":{"type":"array","items":{"type":"string"}},"orgContacts":{"type":"string"},"orgInfo":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"image":{"type":"string"},"tags":{"type":"string"},"address":{"type":"array","items":{"$ref":"#/components/schemas/CatalogEntryAddress"}},"foodType":{"type":"array","items":{"type":"string"}},"deliveryType":{"type":"array","items":{"type":"string"}},"delivery":{"type":"string"},"deliveryFee":{"type":"number","format":"double"},"deliveryFeeAfterHours":{"type":"integer","format":"int32"},"deliveryFeeAfterPrice":{"type":"number","format":"double"},"deliveryFeeAfterHoursValue":{"type":"number","format":"double"},"deliveryFeeAfterPriceValue":{"type":"number","format":"double"},"unreadSupportMessagesCount":{"type":"integer","format":"int32"},"createdDate":{"type":"string","format":"date-time"},"lowestPrice":{"type":"number","format":"double"},"notification":{"type":"array","items":{"$ref":"#/components/schemas/NotificationSetting"}},"telegramChatId":{"type":"string"},"workingHours":{"type":"string"}}},"CatalogEntryAddress":{"type":"object","properties":{"address":{"type":"string"},"phone":{"type":"array","items":{"type":"string"}},"workHours":{"type":"string"},"image":{"type":"array","items":{"type":"string"}}}},"NotificationSetting":{"type":"object","properties":{"status":{"type":"string","enum":["ENABLED","DISABLED"]},"notificationType":{"type":"string","enum":["EMAIL","TELEGRAM","INSTAGRAM"]},"destination":{"type":"string"},"extraInfo":{"type":"string"}}},"CatalogDetails":{"type":"object","properties":{"menu":{"type":"array","items":{"$ref":"#/components/schemas/MenuItem"}},"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"}}}}}}}