{
    "openapi": "3.0.0",
    "info": {
        "title": "Customer review",
        "description": "API to manage customer reviews",
        "version": "1.0.0",
        "x-build": null
    },
    "paths": {
        "/api/v1/reviews": {
            "get": {
                "operationId": "get_api_reviews_all",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "The page number for pagination",
                        "schema": {
                            "type": "integer",
                            "default": 1
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "The number of reviews per page",
                        "schema": {
                            "type": "integer",
                            "default": 10
                        }
                    },
                    {
                        "name": "rating",
                        "in": "query",
                        "description": "Filter by rating",
                        "schema": {
                            "type": "string"
                        },
                        "example": "5"
                    },
                    {
                        "name": "product-category",
                        "in": "query",
                        "description": "Filter by product-category",
                        "schema": {
                            "type": "string"
                        },
                        "example": "car"
                    },
                    {
                        "name": "partner",
                        "in": "query",
                        "description": "Filter by partners, separated by comma",
                        "schema": {
                            "type": "string"
                        },
                        "example": "cpp,slavia"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated list of reviews",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Review"
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/pagination"
                                        },
                                        "summary": {
                                            "properties": {
                                                "averageRating": {
                                                    "description": "Average rating of all reviews filtered by criteria",
                                                    "type": "number",
                                                    "format": "float"
                                                },
                                                "perPartner": {
                                                    "$ref": "#/components/schemas/partnerSummary"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/reviews/summary": {
            "get": {
                "operationId": "get_api_reviews_summary",
                "parameters": [
                    {
                        "name": "rating",
                        "in": "query",
                        "description": "Filter by rating",
                        "schema": {
                            "type": "string"
                        },
                        "example": "5"
                    },
                    {
                        "name": "product-category",
                        "in": "query",
                        "description": "Filter by product-category",
                        "schema": {
                            "type": "string"
                        },
                        "example": "car"
                    },
                    {
                        "name": "partner",
                        "in": "query",
                        "description": "Filter by partners, separated by comma",
                        "schema": {
                            "type": "string"
                        },
                        "example": "cpp,slavia"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Summary of reviews",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/partnerSummary"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/reviews/list": {
            "get": {
                "operationId": "get_api_reviews_list",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "The page number for pagination",
                        "schema": {
                            "type": "integer",
                            "default": 1
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "The number of reviews per page",
                        "schema": {
                            "type": "integer",
                            "default": 10
                        }
                    },
                    {
                        "name": "rating",
                        "in": "query",
                        "description": "Filter by rating",
                        "schema": {
                            "type": "string"
                        },
                        "example": "5"
                    },
                    {
                        "name": "product-category",
                        "in": "query",
                        "description": "Filter by product-category",
                        "schema": {
                            "type": "string"
                        },
                        "example": "car"
                    },
                    {
                        "name": "partner",
                        "in": "query",
                        "description": "Filter by partners, separated by comma",
                        "schema": {
                            "type": "string"
                        },
                        "example": "cpp,slavia"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of reviews",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Review"
                                            }
                                        },
                                        "pagination": {
                                            "$ref": "#/components/schemas/pagination"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/reviews/{id}": {
            "get": {
                "operationId": "get_api_reviews_detail",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "description": "Id of review to find",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Detail of review",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Review"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Review not found"
                    }
                }
            }
        },
        "/api/v1/reviews/upload": {
            "post": {
                "operationId": "post_api_reviews_upload",
                "responses": {
                    "default": {
                        "description": ""
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "pagination": {
                "properties": {
                    "currentPage": {
                        "type": "integer",
                        "example": 1
                    },
                    "hasPreviousPage": {
                        "type": "boolean",
                        "example": false
                    },
                    "hasNextPage": {
                        "type": "boolean",
                        "example": true
                    },
                    "perPage": {
                        "type": "integer",
                        "example": 10
                    },
                    "count": {
                        "type": "integer",
                        "example": 1350
                    },
                    "pages": {
                        "type": "integer",
                        "example": 135
                    }
                },
                "type": "object"
            },
            "partnerSummary": {
                "properties": {
                    "partner": {
                        "type": "string"
                    },
                    "averageRating": {
                        "type": "number",
                        "format": "float",
                        "example": 4.1
                    },
                    "count": {
                        "type": "number",
                        "example": 27
                    },
                    "ratingCounts": {
                        "properties": {
                            "1": {
                                "type": "integer",
                                "example": 2
                            },
                            "2": {
                                "type": "integer",
                                "example": 1
                            },
                            "3": {
                                "type": "integer",
                                "example": 4
                            },
                            "4": {
                                "type": "integer",
                                "example": 6
                            },
                            "5": {
                                "type": "integer",
                                "example": 14
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "Review": {
                "required": [
                    "id",
                    "productCategory",
                    "partner"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "author": {
                        "type": "string",
                        "nullable": true
                    },
                    "rating": {
                        "type": "number",
                        "format": "float",
                        "default": 0
                    },
                    "description": {
                        "type": "string",
                        "default": null,
                        "nullable": true
                    },
                    "productCategory": {
                        "type": "string"
                    },
                    "partner": {
                        "type": "string"
                    },
                    "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "default": null,
                        "nullable": true
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "Bearer": {
                "type": "http",
                "scheme": "bearer"
            }
        }
    },
    "security": [
        {
            "Bearer": []
        }
    ]
}