paths:
  /bookings:
    post:
      tags:
        - Bookings
      summary: Create a new booking
      description: Create a new booking for a car.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  type: string
                  description: First name of the person booking.
                lastName:
                  type: string
                  description: Last name of the person booking.
                phone:
                  type: string
                  description: Phone number of the person booking.
                email:
                  type: string
                  description: Email address of the person booking.
                address:
                  type: string
                  description: Address of the person booking.
                paymentMethod:
                  type: string
                  description: Payment method used for the booking.
                carId:
                  type: integer
                  description: ID of the car being booked.
                startDate:
                  type: string
                  format: date-time
                  description: Start date of the booking.
                endDate:
                  type: string
                  format: date-time
                  description: End date of the booking.
                totalPrice:
                  type: number
                  format: float
                  description: Total price of the booking.
                additionalDrivers:
                  type: array
                  items:
                    type: string
                  description: List of additional drivers.
                insurance:
                  type: boolean
                  description: Whether insurance is included in the booking.
              required:
                - firstName
                - lastName
                - phone
                - email
                - address
                - paymentMethod
                - carId
                - startDate
                - endDate
                - totalPrice
      responses:
        201:
          description: Booking created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Booking'
        400:
          description: Invalid input.

    get:
      tags:
        - Bookings
      summary: Get all bookings
      description: Retrieve a list of all bookings.
      security:
        - bearerAuth: []
      responses:
        200:
          description: A list of bookings.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Booking'
        401:
          description: Unauthorized.

  /bookings/house:
    post:
      tags:
        - Bookings
      summary: Create a new housing booking
      description: Create a new booking for a housing or hotel.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  type: string
                  description: First name of the person booking.
                lastName:
                  type: string
                  description: Last name of the person booking.
                phone:
                  type: string
                  description: Phone number of the person booking.
                email:
                  type: string
                  description: Email address of the person booking.
                address:
                  type: string
                  description: Address of the person booking.
                paymentMethod:
                  type: string
                  description: Payment method used for the booking.
                HousingId:
                  type: integer
                  description: ID of the housing being booked.
                startDate:
                  type: string
                  format: date-time
                  description: Start date of the booking.
                endDate:
                  type: string
                  format: date-time
                  description: End date of the booking.
                totalPrice:
                  type: number
                  format: float
                  description: Total price of the booking.
                specialAsk:
                  type: string
                  description: Special requests or notes for the booking.
              required:
                - firstName
                - lastName
                - phone
                - email
                - paymentMethod
                - HousingId
                - startDate
                - endDate
                - totalPrice
      responses:
        201:
          description: Housing booking created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HousingBooking'
        400:
          description: Invalid input.

  /bookings/housing:
    get:
      tags:
        - Bookings
      summary: Get all housing bookings
      description: Retrieve a list of all housing bookings.
      security:
        - bearerAuth: []
      responses:
        200:
          description: A list of housing bookings.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HousingBooking'
        401:
          description: Unauthorized.

  /bookings/user:
    get:
      tags:
        - Bookings
      summary: Get bookings for the authenticated user
      description: Retrieve a list of bookings for the currently authenticated user.
      security:
        - bearerAuth: []
      responses:
        200:
          description: A list of bookings for the user.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Booking'
        400:
          description: User ID is required.
        401:
          description: Unauthorized.

  /bookings/housing/{id}/validate:
    post:
      tags:
        - Bookings
      summary: Validate a housing booking
      description: Validate a housing booking and mark it as active.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: ID of the housing booking to validate.
      security:
        - bearerAuth: []
      responses:
        200:
          description: Housing booking validated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HousingBooking'
        400:
          description: Housing booking not found or not in pending status.
        401:
          description: Unauthorized.

  /bookings/housing/{id}/cancel:
    post:
      tags:
        - Bookings
      summary: Cancel a housing booking
      description: Cancel a housing booking and mark it as cancelled.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: ID of the housing booking to cancel.
      security:
        - bearerAuth: []
      responses:
        200:
          description: Housing booking cancelled successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HousingBooking'
        400:
          description: Housing booking not found or cannot be cancelled.
        401:
          description: Unauthorized.

  /bookings/{id}/validate:
    post:
      tags:
        - Bookings
      summary: Validate a booking
      description: Validate a booking and mark it as active.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: ID of the booking to validate.
      security:
        - bearerAuth: []
      responses:
        200:
          description: Booking validated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Booking'
        400:
          description: Booking not found or not in pending status.
        401:
          description: Unauthorized.

  /bookings/{id}/cancel:
    post:
      tags:
        - Bookings
      summary: Cancel a booking
      description: Cancel a booking and mark it as cancelled.
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
          description: ID of the booking to cancel.
      security:
        - bearerAuth: []
      responses:
        200:
          description: Booking cancelled successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Booking'
        400:
          description: Booking not found or cannot be cancelled.
        401:
          description: Unauthorized.

  /bookings/{id}:
    delete:
      tags:
        - Bookings
      summary: Cancel a booking
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        204:
          description: Booking cancelled successfully

  /bookings/hotel-clicked/{hotelId}:
    put:
      tags:
        - Bookings
      summary: Increment hotel click count
      description: Increment the click count for a specific hotel.
      parameters:
        - in: path
          name: hotelId
          required: true
          schema:
            type: integer
          description: ID of the hotel to increment the click count for.
      responses:
        200:
          description: Hotel click count incremented successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  name:
                    type: string
                  onClickCount:
                    type: integer
        400:
          description: Hotel not found or invalid input.