{
    "openapi": "3.0.3",
    "info": {
        "title": "Captcha service - API",
        "description": "API Documentation.",
        "version": "1.0.0"
    },
    "tags": [
        {
            "name": "captcha",
            "description": "Operations about captcha"
        }
    ],
    "paths": {
        "/api/v1/captcha": {
            "get": {
                "tags": [
                    "captcha"
                ],
                "summary": "Captcha generation",
                "description": "",
                "operationId": "captchaGeneration",
                "parameters": [
                    {
                        "name": "public-token",
                        "in": "header",
                        "description": "Public token for captcha generation",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/Captcha"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Invalid public token value"
                    }
                }
            },
            "post": {
                "tags": [
                    "captcha"
                ],
                "summary": "Checking captcha",
                "description": "",
                "operationId": "captchaChecking",
                "parameters": [
                    {
                        "name": "public-token",
                        "in": "header",
                        "description": "Public token for captcha generation",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "array",
                                "items": {
                                    "$ref": "#/components/schemas/CaptchaChecking"
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/CaptchaVerification"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Invalid public token value"
                    }
                }
            }
        },
        "/api/v1/captcha/{captcha_key}": {
            "get": {
                "tags": [
                    "captcha"
                ],
                "summary": "Verification Information",
                "description": "",
                "operationId": "CaptchaKeyInfo",
                "parameters": [
                    {
                        "name": "private-token",
                        "in": "header",
                        "description": "Private token for captcha verification",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "captcha_key",
                        "in": "path",
                        "description": "The key that we received when generating the captcha",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "successful operation",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/CaptchaKeyInfo"
                                    }
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Invalid private token value"
                    },
                    "404": {
                        "description": "Captcha key not found"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Captcha": {
                "type": "object",
                "properties": {
                    "image_head": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Image",
                        }
                    },
                    "image_body": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Image"
                        }
                    },
                    "captcha_key": {
                        "type": "string"
                    }
                },
                "required": [
                    "image_head", "image_body", "captcha_key"
                ]
            },
            "Image": {
                "type": "object",
                "properties": {
                    "base64": {
                        "type": "string",
                        "format": "byte"
                    },
                    "width": {
                        "type": "integer"
                    },
                    "height": {
                        "type": "integer"
                    }
                },
                "required": [
                    "base64", "width", "height"
                ]
            },
            "CaptchaVerification": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "boolean"
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "required": [
                    "status", "message"
                ]
            },
            "CaptchaChecking": {
                "type": "object",
                "properties": {
                    "captcha_key": {
                        "type": "string"
                    },
                    "verification": {
                        "type": "array",
                        "example": [{"x": 10, "y": 20}, {"x":  30, "y":  30}, {"x": 60, "y": 50}]
                    }
                },
                "required": [
                    "captcha_key", "verification"
                ]
            },
            "CaptchaKeyInfo": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "boolean"
                    },
                    "message": {
                        "type": "string"
                    }
                },
                "required": [
                    "status", "message"
                ]
            }
        }
    }
}
