// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: api/grpc/v1/api.proto

/*
Package v1 is a generated blademaster stub package.
This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.

It is generated from these files:
	api/grpc/v1/api.proto
*/
package v1

import (
	"context"

	bm "go-common/library/net/http/blademaster"
	"go-common/library/net/http/blademaster/binding"
)

// to suppressed 'imported but not used warning'
var _ *bm.Context
var _ context.Context
var _ binding.StructValidator

// ==================
// XCaptcha Interface
// ==================

// XCaptcha
type XCaptcha interface {
	// 创建验证码
	Create(ctx context.Context, req *XCreateCaptchaReq) (resp *XCreateCaptchaResp, err error)

	// 二次校验checkToken  `internal:"true"`
	Verify(ctx context.Context, req *XVerifyReq) (resp *XVerifyResp, err error)

	// 验证码校验 `internal:"true"`
	Check(ctx context.Context, req *CheckReq) (resp *CheckResp, err error)
}

var v1XCaptchaSvc XCaptcha

// @params XCreateCaptchaReq
// @router GET /xlive/xcaptcha/v1/xCaptcha/create
// @response XCreateCaptchaResp
func xCaptchaCreate(c *bm.Context) {
	p := new(XCreateCaptchaReq)
	if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
		return
	}
	resp, err := v1XCaptchaSvc.Create(c, p)
	c.JSON(resp, err)
}

// @params XVerifyReq
// @router GET /xlive/internal/xcaptcha/v1/xCaptcha/verify
// @response XVerifyResp
func xCaptchaVerify(c *bm.Context) {
	p := new(XVerifyReq)
	if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
		return
	}
	resp, err := v1XCaptchaSvc.Verify(c, p)
	c.JSON(resp, err)
}

// @params CheckReq
// @router GET /xlive/internal/xcaptcha/v1/xCaptcha/check
// @response CheckResp
func xCaptchaCheck(c *bm.Context) {
	p := new(CheckReq)
	if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
		return
	}
	resp, err := v1XCaptchaSvc.Check(c, p)
	c.JSON(resp, err)
}

// RegisterV1XCaptchaService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV1XCaptchaService(e *bm.Engine, svc XCaptcha, midMap map[string]bm.HandlerFunc) {
	v1XCaptchaSvc = svc
	e.GET("/xlive/xcaptcha/v1/xCaptcha/create", xCaptchaCreate)
	e.GET("/xlive/internal/xcaptcha/v1/xCaptcha/verify", xCaptchaVerify)
	e.GET("/xlive/internal/xcaptcha/v1/xCaptcha/check", xCaptchaCheck)
}
