paths:
  /cars/{carId}/reviews:
    get:
      tags:
        - Reviews
      summary: Get reviews for a car
      parameters:
        - in: path
          name: carId
          required: true
          schema:
            type: integer
      responses:
        200:
          description: A list of reviews for the car
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Review'
    post:
      tags:
        - Reviews
      summary: Create a review for a car
      parameters:
        - in: path
          name: carId
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                rating:
                  type: integer
                  minimum: 1
                  maximum: 5
                comment:
                  type: string
      responses:
        201:
          description: Review created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Review'

  /cars/{carId}/rating:
    get:
      tags:
        - Reviews
      summary: Get average rating for a car
      parameters:
        - in: path
          name: carId
          required: true
          schema:
            type: integer
      responses:
        200:
          description: Average rating and total reviews for the car
          content:
            application/json:
              schema:
                type: object
                properties:
                  averageRating:
                    type: number
                  totalReviews:
                    type: integer

  /housing/{houseId}/reviews:
    get:
      tags:
        - Reviews
      summary: Get reviews for a house
      parameters:
        - in: path
          name: houseId
          required: true
          schema:
            type: integer
      responses:
        200:
          description: A list of reviews for the house
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Review'
    post:
      tags:
        - Reviews
      summary: Create a review for a house
      parameters:
        - in: path
          name: houseId
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                rating:
                  type: integer
                  minimum: 1
                  maximum: 5
                comment:
                  type: string
      responses:
        201:
          description: Review created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Review'

  /housing/{houseId}/rating:
    get:
      tags:
        - Reviews
      summary: Get average rating for a house
      parameters:
        - in: path
          name: houseId
          required: true
          schema:
            type: integer
      responses:
        200:
          description: Average rating and total reviews for the house
          content:
            application/json:
              schema:
                type: object
                properties:
                  averageRating:
                    type: number
                  totalReviews:
                    type: integer

  /reviews/{id}:
    put:
      tags:
        - Reviews
      summary: Update a review
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                rating:
                  type: integer
                  minimum: 1
                  maximum: 5
                comment:
                  type: string
      responses:
        200:
          description: Review updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Review'
    delete:
      tags:
        - Reviews
      summary: Delete a review
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        204:
          description: Review deleted successfully

  /housing/reviews/{id}:
    put:
      tags:
        - Reviews
      summary: Update a house review
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                rating:
                  type: integer
                  minimum: 1
                  maximum: 5
                comment:
                  type: string
      responses:
        200:
          description: House review updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Review'
    delete:
      tags:
        - Reviews
      summary: Delete a house review
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: integer
      responses:
        204:
          description: House review deleted successfully
