syntax = "v1"

info (
	title:   "recovery API"
	desc:    "API for order recovery"
	author:  "Tension"
	email:   "tension@ppanel.com"
	version: "0.0.1"
)

import "../types.api"

type (
	RecoverySendCodeRequest {
		Email string `json:"email" validate:"required,email"`
	}
	RecoverOrderRequest {
		OrderNo string `json:"order_no" validate:"required"`
		Email   string `json:"email" validate:"required,email"`
		Code    string `json:"code" validate:"required"`
	}
	RecoverOrderResponse {
		Success bool   `json:"success"`
		Message string `json:"message"`
	}
)

@server (
	prefix:     v1/public/recovery
	group:      public/recovery
	middleware: DeviceMiddleware
)
service ppanel {
	@doc "Send recovery verification code"
	@handler SendCode
	post /send_code (RecoverySendCodeRequest) returns (SendCodeResponse)

	@doc "Recover order subscription"
	@handler RecoverOrder
	post /order (RecoverOrderRequest) returns (RecoverOrderResponse)
}
