openapi: 3.0.0
security:
  - BearerAuth: []

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

tags:
  - name: Restaurant Details
    description: API endpoints for managing restaurant details (singleton resource)

paths:
  /api/restaurant-details:
    get:
      summary: Get restaurant details
      tags: [Restaurant Details]
      description: Returns the single restaurant details record
      security:
        - BearerAuth: []
      responses:
        200:
          description: Restaurant details retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      restaurantDetails:
                        type: object
                        properties:
                          id:
                            type: string
                            format: uuid
                            example: "123e4567-e89b-12d3-a456-426614174000"
                          name:
                            type: string
                            example: "YumBites Restaurant"
                          address:
                            type: string
                            example: "123 Main Street, City, State"
                          latitude:
                            type: number
                            format: float
                            example: 40.7128
                          longitude:
                            type: number
                            format: float
                            example: -74.0060
                          phone:
                            type: string
                            example: "+1234567890"
                          email:
                            type: string
                            example: "restaurant@yumbites.com"
                          website:
                            type: string
                            nullable: true
                            example: "https://yumbites.com"
                          logo:
                            type: string
                            nullable: true
                            example: "https://yumbites.com/logo.png"
                          theme:
                            type: string
                            example: "dark"
                          timingEnd:
                            type: string
                            example: "22:00"
                          ordercapacityLimit:
                            type: integer
                            example: 100
                          showReviews:
                            type: boolean
                            example: true
                          isRestaurantOpen:
                            type: boolean
                            example: true
                          freeDeliveryThreshold:
                            type: number
                            format: decimal
                            example: 50.00
                          deliveryFee:
                            type: number
                            format: decimal
                            example: 5.00
                          deliveryPlusCharge:
                            type: number
                            format: decimal
                            example: 2.00
                          createdAt:
                            type: string
                            format: date-time
                            example: "2024-01-01T00:00:00Z"
                          updatedAt:
                            type: string
                            format: date-time
                            example: "2024-01-01T00:00:00Z"
        401:
          description: Unauthorized
        404:
          description: Restaurant details not found

  /api/restaurant-details/theme:
    put:
      summary: Update theme
      tags: [Restaurant Details]
      description: Update the restaurant theme
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - theme
              properties:
                theme:
                  type: string
                  example: "dark"
                  description: Theme name (e.g., "light", "dark", "blue")
      responses:
        200:
          description: Theme updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Theme updated successfully"
                  data:
                    type: object
                    properties:
                      restaurantDetails:
                        type: object
        400:
          description: Bad request (theme is required)
        401:
          description: Unauthorized
        403:
          description: Forbidden (admin access required)

  /api/restaurant-details/delivery:
    put:
      summary: Update delivery settings
      tags: [Restaurant Details]
      description: Update delivery-related settings (free delivery threshold, delivery fee, delivery plus charge)
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                freeDeliveryThreshold:
                  type: number
                  format: decimal
                  example: 50.00
                  description: Minimum order amount for free delivery
                deliveryFee:
                  type: number
                  format: decimal
                  example: 5.00
                  description: Standard delivery fee
                deliveryPlusCharge:
                  type: number
                  format: decimal
                  example: 2.00
                  description: Additional delivery charge
      responses:
        200:
          description: Delivery settings updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Delivery settings updated successfully"
                  data:
                    type: object
                    properties:
                      restaurantDetails:
                        type: object
        401:
          description: Unauthorized
        403:
          description: Forbidden (admin access required)

  /api/restaurant-details/address:
    put:
      summary: Update address
      tags: [Restaurant Details]
      description: Update restaurant address and location coordinates
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - address
                - latitude
                - longitude
              properties:
                address:
                  type: string
                  example: "123 Main Street, City, State, ZIP"
                  description: Full address of the restaurant
                latitude:
                  type: number
                  format: float
                  example: 40.7128
                  description: Latitude coordinate
                longitude:
                  type: number
                  format: float
                  example: -74.0060
                  description: Longitude coordinate
      responses:
        200:
          description: Address updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Address updated successfully"
                  data:
                    type: object
                    properties:
                      restaurantDetails:
                        type: object
        400:
          description: Bad request (address, latitude, and longitude are required)
        401:
          description: Unauthorized
        403:
          description: Forbidden (admin access required)

  /api/restaurant-details/general:
    put:
      summary: Update general information
      tags: [Restaurant Details]
      description: Update general restaurant information (name, contact, website, logo, timing, capacity, and status)
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: "YumBites Restaurant"
                  description: Restaurant name
                phone:
                  type: string
                  example: "+1234567890"
                  description: Contact phone number
                email:
                  type: string
                  format: email
                  example: "restaurant@yumbites.com"
                  description: Contact email address
                website:
                  type: string
                  nullable: true
                  example: "https://yumbites.com"
                  description: Restaurant website URL
                logo:
                  type: string
                  nullable: true
                  example: "https://yumbites.com/logo.png"
                  description: Logo image URL
                timingEnd:
                  type: string
                  example: "22:00"
                  description: "Closing time (format: HH:mm)"
                ordercapacityLimit:
                  type: integer
                  example: 100
                  description: Maximum order capacity limit
                showReviews:
                  type: boolean
                  example: true
                  description: Whether to show reviews
                isRestaurantOpen:
                  type: boolean
                  example: true
                  description: Whether the restaurant is currently open
      responses:
        200:
          description: General information updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "General information updated successfully"
                  data:
                    type: object
                    properties:
                      restaurantDetails:
                        type: object
        401:
          description: Unauthorized
        403:
          description: Forbidden (admin access required)

