{
    "schemes": [],
    "swagger": "2.0",
    "info": {
        "description": "One-time password management service for Banknote Tracker",
        "title": "BNT OTP Service API",
        "contact": {},
        "version": "1.0"
    },
    "host": "localhost:9005",
    "basePath": "/",
    "paths": {
        "/otp/health": {
            "get": {
                "description": "Returns service health status",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "health"
                ],
                "summary": "Health check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.HealthResponse"
                        }
                    }
                }
            }
        },
        "/otp/{reference}": {
            "post": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Retrieves OTP details by reference and contact email",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "otp"
                ],
                "summary": "Get OTP details",
                "parameters": [
                    {
                        "type": "string",
                        "description": "OTP reference (UUID)",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "OTP get request",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schemas.OtpGetRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.OtpResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        },
        "/otp/{reference}/resend": {
            "post": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Regenerates and resends an OTP for the given reference",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "otp"
                ],
                "summary": "Resend OTP",
                "parameters": [
                    {
                        "type": "string",
                        "description": "OTP reference (UUID)",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "OTP resend request",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schemas.OtpResendRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.OtpResendResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        },
        "/otp/{reference}/validate": {
            "post": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Validates an OTP code against the stored value for a given reference",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "otp"
                ],
                "summary": "Validate OTP",
                "parameters": [
                    {
                        "type": "string",
                        "description": "OTP reference (UUID)",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "OTP validate request",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schemas.OtpValidateRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.OtpValidationResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "schemas.AuditInfoResponse": {
            "type": "object",
            "properties": {
                "department_reference": {
                    "type": "string"
                },
                "device_name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "ip_address": {
                    "type": "string"
                },
                "latitude": {
                    "type": "string"
                },
                "longitude": {
                    "type": "string"
                },
                "organisation_reference": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "user_reference": {
                    "type": "string"
                }
            }
        },
        "schemas.HealthResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        },
        "schemas.OtpGetRequest": {
            "type": "object",
            "required": [
                "otp_contact"
            ],
            "properties": {
                "otp_contact": {
                    "type": "string"
                }
            }
        },
        "schemas.OtpResendRequest": {
            "type": "object",
            "required": [
                "otp_contact"
            ],
            "properties": {
                "otp_channel": {
                    "type": "string"
                },
                "otp_contact": {
                    "type": "string"
                }
            }
        },
        "schemas.OtpResendResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                },
                "reference": {
                    "type": "string"
                }
            }
        },
        "schemas.OtpResponse": {
            "type": "object",
            "properties": {
                "created_by": {
                    "$ref": "#/definitions/schemas.AuditInfoResponse"
                },
                "otp_channel": {
                    "type": "string"
                },
                "otp_contact": {
                    "type": "string"
                },
                "reference": {
                    "type": "string"
                },
                "updated_by": {
                    "$ref": "#/definitions/schemas.AuditInfoResponse"
                }
            }
        },
        "schemas.OtpValidateRequest": {
            "type": "object",
            "required": [
                "otp_code",
                "otp_contact"
            ],
            "properties": {
                "otp_channel": {
                    "type": "string"
                },
                "otp_code": {
                    "type": "string",
                    "maxLength": 8,
                    "minLength": 4
                },
                "otp_contact": {
                    "type": "string"
                }
            }
        },
        "schemas.OtpValidationResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                },
                "reference": {
                    "type": "string"
                },
                "valid": {
                    "type": "boolean"
                }
            }
        },
        "shared.ApplicationError": {
            "type": "object",
            "properties": {
                "error_reference": {
                    "type": "string"
                },
                "error_type": {
                    "$ref": "#/definitions/shared.ErrorType"
                },
                "errors": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "status_code": {
                    "type": "integer"
                },
                "timestamp": {
                    "type": "string"
                }
            }
        },
        "shared.ErrorType": {
            "type": "string",
            "enum": [
                "VALIDATION_ERROR",
                "NOT_FOUND_ERROR",
                "CONFLICT_ERROR",
                "UNAUTHORIZED_ERROR",
                "AUTHENTICATION_ERROR",
                "FORBIDDEN_ERROR",
                "BAD_REQUEST_ERROR",
                "SERVER_ERROR",
                "REDIS_ERROR",
                "CREATE_ERROR",
                "UPDATE_ERROR",
                "INVALID_RESOURCE_ERROR",
                "TIMEOUT",
                "METHOD_NOT_ALLOWED",
                "RATE_LIMIT_EXCEEDED",
                "PAYLOAD_TOO_LARGE",
                "UNPROCESSABLE_ENTITY",
                "INTERNAL_ERROR"
            ],
            "x-enum-varnames": [
                "ValidationError",
                "NotFoundError",
                "ConflictError",
                "UnauthorizedError",
                "AuthenticationError",
                "ForbiddenError",
                "BadRequestError",
                "ServerError",
                "RedisError",
                "CreateError",
                "UpdateError",
                "InvalidResourceError",
                "TimeoutError",
                "MethodNotAllowedError",
                "RateLimitExceededError",
                "PayloadTooLargeError",
                "UnprocessableEntityError",
                "InternalError"
            ]
        }
    },
    "securityDefinitions": {
        "BearerAuth": {
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    }
}