// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.8.0
// - protoc             v5.27.1
// source: msapi/tool.proto

package msapi

import (
	context "context"
	http "github.com/go-kratos/kratos/v2/transport/http"
	binding "github.com/go-kratos/kratos/v2/transport/http/binding"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the kratos package it is being compiled against.
var _ = new(context.Context)
var _ = binding.EncodeURL

const _ = http.SupportPackageIsVersion1

const OperationToolServiceBatchCreateAccounts = "/api.ToolService/BatchCreateAccounts"

type ToolServiceHTTPServer interface {
	// BatchCreateAccounts 账号
	BatchCreateAccounts(context.Context, *BatchCreateAccountsRequest) (*BatchCreateAccountsResponse, error)
}

func RegisterToolServiceHTTPServer(s *http.Server, srv ToolServiceHTTPServer) {
	r := s.Route("/")
	r.POST("/tool/accounts/bulk", _ToolService_BatchCreateAccounts0_HTTP_Handler(srv))
}

func _ToolService_BatchCreateAccounts0_HTTP_Handler(srv ToolServiceHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in BatchCreateAccountsRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationToolServiceBatchCreateAccounts)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.BatchCreateAccounts(ctx, req.(*BatchCreateAccountsRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		return ctx.Result(200, out)
	}
}

type ToolServiceHTTPClient interface {
	BatchCreateAccounts(ctx context.Context, req *BatchCreateAccountsRequest, opts ...http.CallOption) (rsp *BatchCreateAccountsResponse, err error)
}

type ToolServiceHTTPClientImpl struct {
	cc *http.Client
}

func NewToolServiceHTTPClient(client *http.Client) ToolServiceHTTPClient {
	return &ToolServiceHTTPClientImpl{client}
}

func (c *ToolServiceHTTPClientImpl) BatchCreateAccounts(ctx context.Context, in *BatchCreateAccountsRequest, opts ...http.CallOption) (*BatchCreateAccountsResponse, error) {
	var out BatchCreateAccountsResponse
	pattern := "/tool/accounts/bulk"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationToolServiceBatchCreateAccounts))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, nil
}
