{
    "openapi": "3.0.0",
    "info": {
        "title": "AUSGEZEICHNET REST API",
        "description": " First version of the Ausgezeichnet REST API. \n## Authentication \n\nIn each HTTP request, the following HTTP header is required:\n\n ```\n# API Key\n x-api-key: <apiKey>\n```\n\n \n## Date format\nWe use the timezone `Europe/Berlin`.\n* **date** = *Y-m-d* = `2024-12-31`\n ",
        "version": "1.0.0"
    },
    "paths": {
        "/api/v1/ratings/{id}/comment": {
            "post": {
                "tags": [
                    "Ratings"
                ],
                "summary": "Post a public comment on a rating",
                "description": "Creates or replaces the public organization response on a specific rating.",
                "operationId": "post_api_ratings_comment",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "required": [
                                    "comment"
                                ],
                                "properties": {
                                    "comment": {
                                        "type": "string",
                                        "maxLength": 2000,
                                        "example": "Thank you for your feedback!"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Comment saved",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "success"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 400
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "comment is required"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Rating not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 404
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Rating not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "apiKey": []
                    }
                ]
            }
        },
        "/api/v1/ratings": {
            "get": {
                "tags": [
                    "Ratings"
                ],
                "summary": "Fetch Ratings",
                "description": "Fetch published ratings based on the given filter criteria.",
                "operationId": "get_api_ratings_index",
                "parameters": [
                    {
                        "name": "collectionMethod",
                        "in": "query",
                        "description": "Collection method of the ratings",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "unsolicited",
                                "after_fulfillment",
                                "point_of_sale"
                            ]
                        }
                    },
                    {
                        "name": "startDate",
                        "in": "query",
                        "description": "Start date of the ratings",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "endDate",
                        "in": "query",
                        "description": "End date of the ratings",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "format": "date"
                        }
                    },
                    {
                        "name": "score",
                        "in": "query",
                        "description": "Score of the ratings (1-5)",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "maximum": 5,
                            "minimum": 1
                        }
                    },
                    {
                        "name": "perPage",
                        "in": "query",
                        "description": "Number of items per page",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "maximum": 1000,
                            "minimum": 1
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "sortField",
                        "in": "query",
                        "description": "Field to sort by",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "createdAt",
                                "score"
                            ]
                        }
                    },
                    {
                        "name": "sortDirection",
                        "in": "query",
                        "description": "Sort direction",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "asc",
                                "desc"
                            ]
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "pagination": {
                                            "properties": {
                                                "totalItems": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "itemsPerPage": {
                                                    "type": "integer",
                                                    "example": 15
                                                },
                                                "currentPage": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "totalPages": {
                                                    "type": "integer",
                                                    "example": 1
                                                }
                                            },
                                            "type": "object"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/RatingTransformer"
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 400
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Validation error"
                                        },
                                        "errors": {
                                            "type": "object",
                                            "example": {
                                                "collectionMethod": "This value is not valid.",
                                                "startDate": "This value is not valid."
                                            }
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "apiKey": []
                    }
                ]
            }
        },
        "/api/v1/ratings/{id}": {
            "get": {
                "tags": [
                    "Ratings"
                ],
                "summary": "Fetch published rating details",
                "description": "Fetch a specific rating by its ID.",
                "operationId": "get_api_ratings_detail",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 200
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "success"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/RatingTransformer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Rating not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "code": {
                                            "type": "integer",
                                            "example": 404
                                        },
                                        "message": {
                                            "type": "string",
                                            "example": "Rating not found"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "apiKey": []
                    }
                ]
            }
        }
    },
    "components": {
        "schemas": {
            "RatingTransformer": {
                "title": "Rating",
                "description": "Rating Data",
                "properties": {
                    "id": {
                        "type": "string",
                        "readOnly": true,
                        "example": "5f7b1b1b7f0000a000000000"
                    },
                    "organization": {
                        "type": "string",
                        "readOnly": true,
                        "example": "Organization Name"
                    },
                    "organizationAccountNo": {
                        "type": "integer",
                        "readOnly": true,
                        "example": 123456
                    },
                    "detailRatingLink": {
                        "type": "string",
                        "readOnly": true,
                        "example": "https://example.com"
                    },
                    "collectionMethod": {
                        "type": "string",
                        "readOnly": true,
                        "example": "after_fulfillment"
                    },
                    "raterName": {
                        "type": "string",
                        "readOnly": true,
                        "example": "John Doe"
                    },
                    "score": {
                        "type": "number",
                        "readOnly": true,
                        "example": 5
                    },
                    "title": {
                        "type": "string",
                        "readOnly": true,
                        "example": "Title"
                    },
                    "description": {
                        "type": "string",
                        "readOnly": true,
                        "example": "Description"
                    },
                    "orderDate": {
                        "type": "string",
                        "format": "date",
                        "example": "2020-10-05"
                    },
                    "orderNumber": {
                        "type": "string",
                        "example": "123456"
                    },
                    "isPublished": {
                        "type": "boolean"
                    },
                    "isChanged": {
                        "type": "boolean"
                    },
                    "country": {
                        "type": "string",
                        "example": "DE"
                    },
                    "verifiedAt": {
                        "type": "string",
                        "format": "date"
                    },
                    "comment": {
                        "type": "string",
                        "example": "Comment"
                    },
                    "createdAt": {
                        "type": "string",
                        "format": "date"
                    },
                    "isConciliation": {
                        "type": "boolean"
                    },
                    "deletedAt": {
                        "type": "string",
                        "format": "date"
                    }
                },
                "type": "object"
            }
        },
        "securitySchemes": {
            "apiKey": {
                "type": "apiKey",
                "description": "Please use the following Format: **X-API-KEY <apiKey>**",
                "name": "X-API-KEY",
                "in": "header"
            }
        }
    },
    "security": [
        {
            "apiKey": []
        }
    ]
}