// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: api/http/v2/index.proto

/*
Package v2 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/http/v2/index.proto
*/
package v2

import (
	"context"

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

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

// ===============
// Index Interface
// ===============

// Index 相关服务
type Index interface {
	// 首页大接口
	// `midware:"guest,verify"`
	GetAllList(ctx context.Context, req *GetAllListReq) (resp *GetAllListResp, err error)

	// 换一换接口
	// `midware:"guest,verify"`
	Change(ctx context.Context, req *ChangeReq) (resp *ChangeResp, err error)
}

var v2IndexSvc Index

// @params GetAllListReq
// @router GET /xlive/app-interface/v2/index/getAllList
// @response GetAllListResp
func indexGetAllList(c *bm.Context) {
	p := new(GetAllListReq)
	if err := c.Bind(p); err != nil {
		return
	}
	resp, err := v2IndexSvc.GetAllList(c, p)
	c.JSON(resp, err)
}

// @params ChangeReq
// @router GET /xlive/app-interface/v2/index/change
// @response ChangeResp
func indexChange(c *bm.Context) {
	p := new(ChangeReq)
	if err := c.Bind(p); err != nil {
		return
	}
	resp, err := v2IndexSvc.Change(c, p)
	c.JSON(resp, err)
}

// RegisterV2IndexService Register the blademaster route with middleware map
// midMap is the middleware map, the key is defined in proto
func RegisterV2IndexService(e *bm.Engine, svc Index, midMap map[string]bm.HandlerFunc) {
	guest := midMap["guest"]
	verify := midMap["verify"]
	v2IndexSvc = svc
	e.GET("/xlive/app-interface/v2/index/getAllList", guest, verify, indexGetAllList)
	e.GET("/xlive/app-interface/v2/index/change", guest, verify, indexChange)
}
