openapi: 3.1.0 info: title: Api version: 0.1.0 description: Yemen Super Booking System API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: auth description: Authentication - name: regions description: Regions management - name: service-types description: Service types - name: services description: Services management - name: sub-services description: Sub-services management - name: bookings description: Bookings management - name: reviews description: Reviews - name: admin description: Admin operations - name: stats description: Statistics paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /auth/register: post: operationId: register tags: [auth] summary: Register a new user requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RegisterBody" responses: "201": description: User created content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "400": description: Validation error content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/login: post: operationId: login tags: [auth] summary: Login requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/LoginBody" responses: "200": description: Login successful content: application/json: schema: $ref: "#/components/schemas/AuthResponse" "401": description: Invalid credentials content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /auth/logout: post: operationId: logout tags: [auth] summary: Logout responses: "200": description: Logged out content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /auth/me: get: operationId: getMe tags: [auth] summary: Get current user responses: "200": description: Current user content: application/json: schema: $ref: "#/components/schemas/User" "401": description: Not authenticated content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" /regions: get: operationId: getRegions tags: [regions] summary: Get all regions responses: "200": description: List of regions content: application/json: schema: type: array items: $ref: "#/components/schemas/Region" post: operationId: createRegion tags: [regions] summary: Create a region (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateRegionBody" responses: "201": description: Region created content: application/json: schema: $ref: "#/components/schemas/Region" /regions/{id}: put: operationId: updateRegion tags: [regions] summary: Update a region (admin) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateRegionBody" responses: "200": description: Updated region content: application/json: schema: $ref: "#/components/schemas/Region" delete: operationId: deleteRegion tags: [regions] summary: Delete a region (admin) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /service-types: get: operationId: getServiceTypes tags: [service-types] summary: Get all service types responses: "200": description: List of service types content: application/json: schema: type: array items: $ref: "#/components/schemas/ServiceType" post: operationId: createServiceType tags: [service-types] summary: Create a service type (admin) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateServiceTypeBody" responses: "201": description: Service type created content: application/json: schema: $ref: "#/components/schemas/ServiceType" /service-types/{id}: put: operationId: updateServiceType tags: [service-types] summary: Update a service type (admin) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateServiceTypeBody" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/ServiceType" delete: operationId: deleteServiceType tags: [service-types] summary: Delete a service type (admin) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /services: get: operationId: getServices tags: [services] summary: Get services (with optional filters) parameters: - name: regionId in: query schema: type: integer - name: serviceTypeId in: query schema: type: integer - name: search in: query schema: type: string - name: status in: query schema: type: string responses: "200": description: List of services content: application/json: schema: type: array items: $ref: "#/components/schemas/ServiceWithDetails" post: operationId: createService tags: [services] summary: Create a service (provider) requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateServiceBody" responses: "201": description: Service created content: application/json: schema: $ref: "#/components/schemas/Service" /services/{id}: get: operationId: getService tags: [services] summary: Get service details parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Service details content: application/json: schema: $ref: "#/components/schemas/ServiceDetails" put: operationId: updateService tags: [services] summary: Update a service (provider/admin) parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateServiceBody" responses: "200": description: Updated service content: application/json: schema: $ref: "#/components/schemas/Service" delete: operationId: deleteService tags: [services] summary: Delete a service parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /services/{id}/approve: post: operationId: approveService tags: [services] summary: Approve a service (admin) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Approved content: application/json: schema: $ref: "#/components/schemas/Service" /services/{id}/suspend: post: operationId: suspendService tags: [services] summary: Suspend a service (admin) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Suspended content: application/json: schema: $ref: "#/components/schemas/Service" /provider/services: get: operationId: getProviderServices tags: [services] summary: Get current provider's services responses: "200": description: Provider services content: application/json: schema: type: array items: $ref: "#/components/schemas/ServiceWithDetails" /sub-services: post: operationId: createSubService tags: [sub-services] summary: Create a sub-service requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSubServiceBody" responses: "201": description: Sub-service created content: application/json: schema: $ref: "#/components/schemas/SubService" /sub-services/{id}: put: operationId: updateSubService tags: [sub-services] summary: Update a sub-service parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateSubServiceBody" responses: "200": description: Updated content: application/json: schema: $ref: "#/components/schemas/SubService" delete: operationId: deleteSubService tags: [sub-services] summary: Delete a sub-service parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /bookings: get: operationId: getBookings tags: [bookings] summary: Get bookings for current user responses: "200": description: List of bookings content: application/json: schema: type: array items: $ref: "#/components/schemas/BookingWithDetails" post: operationId: createBooking tags: [bookings] summary: Create a booking requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateBookingBody" responses: "201": description: Booking created content: application/json: schema: $ref: "#/components/schemas/Booking" /bookings/{id}: get: operationId: getBooking tags: [bookings] summary: Get a booking parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Booking details content: application/json: schema: $ref: "#/components/schemas/BookingWithDetails" /bookings/{id}/status: put: operationId: updateBookingStatus tags: [bookings] summary: Update booking status parameters: - name: id in: path required: true schema: type: integer requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/UpdateBookingStatusBody" responses: "200": description: Updated booking content: application/json: schema: $ref: "#/components/schemas/Booking" /provider/bookings: get: operationId: getProviderBookings tags: [bookings] summary: Get bookings for provider's services responses: "200": description: Provider bookings content: application/json: schema: type: array items: $ref: "#/components/schemas/BookingWithDetails" /reviews: post: operationId: createReview tags: [reviews] summary: Create a review requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/CreateReviewBody" responses: "201": description: Review created content: application/json: schema: $ref: "#/components/schemas/Review" /services/{id}/reviews: get: operationId: getServiceReviews tags: [reviews] summary: Get reviews for a service parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Reviews content: application/json: schema: type: array items: $ref: "#/components/schemas/ReviewWithUser" /admin/users: get: operationId: getAdminUsers tags: [admin] summary: Get all users (admin) responses: "200": description: All users content: application/json: schema: type: array items: $ref: "#/components/schemas/User" /admin/users/{id}: delete: operationId: deleteUser tags: [admin] summary: Delete a user (admin) parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Deleted content: application/json: schema: $ref: "#/components/schemas/SuccessResponse" /admin/pending-services: get: operationId: getPendingServices tags: [admin] summary: Get pending services (admin) responses: "200": description: Pending services content: application/json: schema: type: array items: $ref: "#/components/schemas/ServiceWithDetails" /stats/dashboard: get: operationId: getDashboardStats tags: [stats] summary: Get dashboard statistics responses: "200": description: Dashboard stats content: application/json: schema: $ref: "#/components/schemas/DashboardStats" /stats/provider: get: operationId: getProviderStats tags: [stats] summary: Get provider statistics responses: "200": description: Provider stats content: application/json: schema: $ref: "#/components/schemas/ProviderStats" components: schemas: HealthStatus: type: object properties: status: type: string required: [status] SuccessResponse: type: object properties: success: type: boolean message: type: string required: [success] ErrorResponse: type: object properties: error: type: string message: type: string required: [error] User: type: object properties: id: type: integer name: type: string email: type: string phone: type: string nullable: true role: type: string enum: [client, provider, admin] serviceTypeId: type: integer nullable: true createdAt: type: string required: [id, name, email, role, createdAt] AuthResponse: type: object properties: user: $ref: "#/components/schemas/User" token: type: string required: [user, token] RegisterBody: type: object properties: name: type: string email: type: string password: type: string phone: type: string nullable: true role: type: string enum: [client, provider] serviceTypeId: type: integer nullable: true required: [name, email, password, role] LoginBody: type: object properties: email: type: string password: type: string required: [email, password] Region: type: object properties: id: type: integer name: type: string image: type: string nullable: true status: type: string required: [id, name, status] CreateRegionBody: type: object properties: name: type: string image: type: string nullable: true status: type: string enum: [active, inactive] default: active required: [name] ServiceType: type: object properties: id: type: integer name: type: string icon: type: string status: type: string required: [id, name, icon, status] CreateServiceTypeBody: type: object properties: name: type: string icon: type: string status: type: string enum: [active, inactive] default: active required: [name, icon] Service: type: object properties: id: type: integer userId: type: integer serviceTypeId: type: integer regionId: type: integer name: type: string description: type: string nullable: true address: type: string nullable: true phone: type: string nullable: true logo: type: string nullable: true status: type: string enum: [pending, active, suspended] createdAt: type: string required: [id, userId, serviceTypeId, regionId, name, status, createdAt] ServiceWithDetails: allOf: - $ref: "#/components/schemas/Service" - type: object properties: regionName: type: string serviceTypeName: type: string serviceTypeIcon: type: string avgRating: type: number nullable: true reviewCount: type: integer subServiceCount: type: integer ServiceDetails: allOf: - $ref: "#/components/schemas/ServiceWithDetails" - type: object properties: subServices: type: array items: $ref: "#/components/schemas/SubService" images: type: array items: $ref: "#/components/schemas/ServiceImage" reviews: type: array items: $ref: "#/components/schemas/ReviewWithUser" CreateServiceBody: type: object properties: serviceTypeId: type: integer regionId: type: integer name: type: string description: type: string nullable: true address: type: string nullable: true phone: type: string nullable: true logo: type: string nullable: true required: [serviceTypeId, regionId, name] SubService: type: object properties: id: type: integer serviceId: type: integer name: type: string description: type: string nullable: true price: type: number duration: type: integer nullable: true image: type: string nullable: true status: type: string required: [id, serviceId, name, price, status] CreateSubServiceBody: type: object properties: serviceId: type: integer name: type: string description: type: string nullable: true price: type: number duration: type: integer nullable: true image: type: string nullable: true status: type: string enum: [active, inactive] default: active required: [serviceId, name, price] Booking: type: object properties: id: type: integer clientId: type: integer serviceId: type: integer subServiceId: type: integer bookingDate: type: string bookingTime: type: string status: type: string enum: [pending, confirmed, cancelled, completed] notes: type: string nullable: true createdAt: type: string required: [id, clientId, serviceId, subServiceId, bookingDate, bookingTime, status, createdAt] BookingWithDetails: allOf: - $ref: "#/components/schemas/Booking" - type: object properties: serviceName: type: string serviceLogo: type: string nullable: true subServiceName: type: string subServicePrice: type: number clientName: type: string regionName: type: string canReview: type: boolean CreateBookingBody: type: object properties: serviceId: type: integer subServiceId: type: integer bookingDate: type: string bookingTime: type: string notes: type: string nullable: true required: [serviceId, subServiceId, bookingDate, bookingTime] UpdateBookingStatusBody: type: object properties: status: type: string enum: [confirmed, cancelled, completed] required: [status] Review: type: object properties: id: type: integer userId: type: integer serviceId: type: integer rating: type: integer minimum: 1 maximum: 5 comment: type: string nullable: true createdAt: type: string required: [id, userId, serviceId, rating, createdAt] ReviewWithUser: allOf: - $ref: "#/components/schemas/Review" - type: object properties: userName: type: string CreateReviewBody: type: object properties: serviceId: type: integer bookingId: type: integer rating: type: integer minimum: 1 maximum: 5 comment: type: string nullable: true required: [serviceId, bookingId, rating] ServiceImage: type: object properties: id: type: integer serviceId: type: integer imagePath: type: string isCover: type: boolean required: [id, serviceId, imagePath, isCover] DashboardStats: type: object properties: totalUsers: type: integer totalServices: type: integer totalBookings: type: integer pendingServices: type: integer activeBookings: type: integer completedBookings: type: integer totalRegions: type: integer totalServiceTypes: type: integer required: [totalUsers, totalServices, totalBookings, pendingServices, activeBookings, completedBookings, totalRegions, totalServiceTypes] ProviderStats: type: object properties: totalServices: type: integer activeBookings: type: integer completedBookings: type: integer avgRating: type: number nullable: true totalReviews: type: integer pendingBookings: type: integer required: [totalServices, activeBookings, completedBookings, totalReviews, pendingBookings]