// Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
// source: api/http/v1/index.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/http/v1/index.proto
*/
package v1

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 {
	// 首页大接口
	// 首页换一换接口
	// `dynamic_resp:"true" midware:"guest"`
	GetAllList(ctx context.Context, req *GetAllListReq) (resp interface{}, err error)

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

var v1IndexSvc Index

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

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

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