// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.7.1
// - protoc             (unknown)
// source: user/api/auth/v1/auth.proto

package v1

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 OperationAuthChangePasswordByForget = "/user.api.auth.v1.Auth/ChangePasswordByForget"
const OperationAuthChangePasswordByPre = "/user.api.auth.v1.Auth/ChangePasswordByPre"
const OperationAuthForgetPassword = "/user.api.auth.v1.Auth/ForgetPassword"
const OperationAuthGetCsrfToken = "/user.api.auth.v1.Auth/GetCsrfToken"
const OperationAuthGetLogin = "/user.api.auth.v1.Auth/GetLogin"
const OperationAuthLogin = "/user.api.auth.v1.Auth/Login"
const OperationAuthLoginPasswordless = "/user.api.auth.v1.Auth/LoginPasswordless"
const OperationAuthRefresh = "/user.api.auth.v1.Auth/Refresh"
const OperationAuthRegister = "/user.api.auth.v1.Auth/Register"
const OperationAuthSendForgetPasswordToken = "/user.api.auth.v1.Auth/SendForgetPasswordToken"
const OperationAuthSendPasswordlessToken = "/user.api.auth.v1.Auth/SendPasswordlessToken"
const OperationAuthToken = "/user.api.auth.v1.Auth/Token"
const OperationAuthValidatePassword = "/user.api.auth.v1.Auth/ValidatePassword"

type AuthHTTPServer interface {
	ChangePasswordByForget(context.Context, *ChangePasswordByForgetRequest) (*ChangePasswordByForgetReply, error)
	ChangePasswordByPre(context.Context, *ChangePasswordByPreRequest) (*ChangePasswordByPreReply, error)
	// ForgetPasswordForgetPassword
	//verify forget password token
	ForgetPassword(context.Context, *ForgetPasswordRequest) (*ForgetPasswordReply, error)
	GetCsrfToken(context.Context, *GetCsrfTokenRequest) (*GetCsrfTokenResponse, error)
	GetLogin(context.Context, *GetLoginRequest) (*GetLoginResponse, error)
	Login(context.Context, *LoginAuthRequest) (*LoginAuthReply, error)
	LoginPasswordless(context.Context, *LoginPasswordlessRequest) (*LoginPasswordlessReply, error)
	Refresh(context.Context, *RefreshTokenAuthRequest) (*RefreshTokenAuthReply, error)
	Register(context.Context, *RegisterAuthRequest) (*RegisterAuthReply, error)
	SendForgetPasswordToken(context.Context, *ForgetPasswordTokenRequest) (*ForgetPasswordTokenReply, error)
	SendPasswordlessToken(context.Context, *PasswordlessTokenAuthRequest) (*PasswordlessTokenAuthReply, error)
	Token(context.Context, *TokenRequest) (*TokenReply, error)
	// ValidatePasswordValidatePassword
	// server validation for password strength
	ValidatePassword(context.Context, *ValidatePasswordRequest) (*ValidatePasswordReply, error)
}

func RegisterAuthHTTPServer(s *http.Server, srv AuthHTTPServer) {
	r := s.Route("/")
	r.POST("/v1/auth/register", _Auth_Register0_HTTP_Handler(srv))
	r.POST("/v1/auth/login", _Auth_Login0_HTTP_Handler(srv))
	r.GET("/v1/auth/login", _Auth_GetLogin0_HTTP_Handler(srv))
	r.POST("/v1/auth/token", _Auth_Token0_HTTP_Handler(srv))
	r.POST("/v1/auth/refresh", _Auth_Refresh0_HTTP_Handler(srv))
	r.POST("/v1/auth/action/passwordless", _Auth_SendPasswordlessToken0_HTTP_Handler(srv))
	r.POST("/v1/auth/login/passwordless", _Auth_LoginPasswordless0_HTTP_Handler(srv))
	r.POST("/v1/auth/action/forget", _Auth_SendForgetPasswordToken0_HTTP_Handler(srv))
	r.POST("/v1/auth/password/forget", _Auth_ForgetPassword0_HTTP_Handler(srv))
	r.POST("/v1/auth/password/forget/change", _Auth_ChangePasswordByForget0_HTTP_Handler(srv))
	r.POST("/v1/auth/password/validate", _Auth_ValidatePassword0_HTTP_Handler(srv))
	r.POST("/v1/auth/password/change", _Auth_ChangePasswordByPre0_HTTP_Handler(srv))
	r.GET("/v1/auth/csrf", _Auth_GetCsrfToken0_HTTP_Handler(srv))
}

func _Auth_Register0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in RegisterAuthRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthRegister)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.Register(ctx, req.(*RegisterAuthRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*RegisterAuthReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_Login0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in LoginAuthRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthLogin)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.Login(ctx, req.(*LoginAuthRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*LoginAuthReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_GetLogin0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in GetLoginRequest
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthGetLogin)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.GetLogin(ctx, req.(*GetLoginRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*GetLoginResponse)
		return ctx.Result(200, reply)
	}
}

func _Auth_Token0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in TokenRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthToken)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.Token(ctx, req.(*TokenRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*TokenReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_Refresh0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in RefreshTokenAuthRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthRefresh)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.Refresh(ctx, req.(*RefreshTokenAuthRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*RefreshTokenAuthReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_SendPasswordlessToken0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in PasswordlessTokenAuthRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthSendPasswordlessToken)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.SendPasswordlessToken(ctx, req.(*PasswordlessTokenAuthRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*PasswordlessTokenAuthReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_LoginPasswordless0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in LoginPasswordlessRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthLoginPasswordless)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.LoginPasswordless(ctx, req.(*LoginPasswordlessRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*LoginPasswordlessReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_SendForgetPasswordToken0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ForgetPasswordTokenRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthSendForgetPasswordToken)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.SendForgetPasswordToken(ctx, req.(*ForgetPasswordTokenRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*ForgetPasswordTokenReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_ForgetPassword0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ForgetPasswordRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthForgetPassword)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ForgetPassword(ctx, req.(*ForgetPasswordRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*ForgetPasswordReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_ChangePasswordByForget0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ChangePasswordByForgetRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthChangePasswordByForget)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ChangePasswordByForget(ctx, req.(*ChangePasswordByForgetRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*ChangePasswordByForgetReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_ValidatePassword0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ValidatePasswordRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthValidatePassword)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ValidatePassword(ctx, req.(*ValidatePasswordRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*ValidatePasswordReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_ChangePasswordByPre0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in ChangePasswordByPreRequest
		if err := ctx.Bind(&in); err != nil {
			return err
		}
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthChangePasswordByPre)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.ChangePasswordByPre(ctx, req.(*ChangePasswordByPreRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*ChangePasswordByPreReply)
		return ctx.Result(200, reply)
	}
}

func _Auth_GetCsrfToken0_HTTP_Handler(srv AuthHTTPServer) func(ctx http.Context) error {
	return func(ctx http.Context) error {
		var in GetCsrfTokenRequest
		if err := ctx.BindQuery(&in); err != nil {
			return err
		}
		http.SetOperation(ctx, OperationAuthGetCsrfToken)
		h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
			return srv.GetCsrfToken(ctx, req.(*GetCsrfTokenRequest))
		})
		out, err := h(ctx, &in)
		if err != nil {
			return err
		}
		reply := out.(*GetCsrfTokenResponse)
		return ctx.Result(200, reply)
	}
}

type AuthHTTPClient interface {
	ChangePasswordByForget(ctx context.Context, req *ChangePasswordByForgetRequest, opts ...http.CallOption) (rsp *ChangePasswordByForgetReply, err error)
	ChangePasswordByPre(ctx context.Context, req *ChangePasswordByPreRequest, opts ...http.CallOption) (rsp *ChangePasswordByPreReply, err error)
	ForgetPassword(ctx context.Context, req *ForgetPasswordRequest, opts ...http.CallOption) (rsp *ForgetPasswordReply, err error)
	GetCsrfToken(ctx context.Context, req *GetCsrfTokenRequest, opts ...http.CallOption) (rsp *GetCsrfTokenResponse, err error)
	GetLogin(ctx context.Context, req *GetLoginRequest, opts ...http.CallOption) (rsp *GetLoginResponse, err error)
	Login(ctx context.Context, req *LoginAuthRequest, opts ...http.CallOption) (rsp *LoginAuthReply, err error)
	LoginPasswordless(ctx context.Context, req *LoginPasswordlessRequest, opts ...http.CallOption) (rsp *LoginPasswordlessReply, err error)
	Refresh(ctx context.Context, req *RefreshTokenAuthRequest, opts ...http.CallOption) (rsp *RefreshTokenAuthReply, err error)
	Register(ctx context.Context, req *RegisterAuthRequest, opts ...http.CallOption) (rsp *RegisterAuthReply, err error)
	SendForgetPasswordToken(ctx context.Context, req *ForgetPasswordTokenRequest, opts ...http.CallOption) (rsp *ForgetPasswordTokenReply, err error)
	SendPasswordlessToken(ctx context.Context, req *PasswordlessTokenAuthRequest, opts ...http.CallOption) (rsp *PasswordlessTokenAuthReply, err error)
	Token(ctx context.Context, req *TokenRequest, opts ...http.CallOption) (rsp *TokenReply, err error)
	ValidatePassword(ctx context.Context, req *ValidatePasswordRequest, opts ...http.CallOption) (rsp *ValidatePasswordReply, err error)
}

type AuthHTTPClientImpl struct {
	cc *http.Client
}

func NewAuthHTTPClient(client *http.Client) AuthHTTPClient {
	return &AuthHTTPClientImpl{client}
}

func (c *AuthHTTPClientImpl) ChangePasswordByForget(ctx context.Context, in *ChangePasswordByForgetRequest, opts ...http.CallOption) (*ChangePasswordByForgetReply, error) {
	var out ChangePasswordByForgetReply
	pattern := "/v1/auth/password/forget/change"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthChangePasswordByForget))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) ChangePasswordByPre(ctx context.Context, in *ChangePasswordByPreRequest, opts ...http.CallOption) (*ChangePasswordByPreReply, error) {
	var out ChangePasswordByPreReply
	pattern := "/v1/auth/password/change"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthChangePasswordByPre))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) ForgetPassword(ctx context.Context, in *ForgetPasswordRequest, opts ...http.CallOption) (*ForgetPasswordReply, error) {
	var out ForgetPasswordReply
	pattern := "/v1/auth/password/forget"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthForgetPassword))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) GetCsrfToken(ctx context.Context, in *GetCsrfTokenRequest, opts ...http.CallOption) (*GetCsrfTokenResponse, error) {
	var out GetCsrfTokenResponse
	pattern := "/v1/auth/csrf"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationAuthGetCsrfToken))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) GetLogin(ctx context.Context, in *GetLoginRequest, opts ...http.CallOption) (*GetLoginResponse, error) {
	var out GetLoginResponse
	pattern := "/v1/auth/login"
	path := binding.EncodeURL(pattern, in, true)
	opts = append(opts, http.Operation(OperationAuthGetLogin))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) Login(ctx context.Context, in *LoginAuthRequest, opts ...http.CallOption) (*LoginAuthReply, error) {
	var out LoginAuthReply
	pattern := "/v1/auth/login"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthLogin))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) LoginPasswordless(ctx context.Context, in *LoginPasswordlessRequest, opts ...http.CallOption) (*LoginPasswordlessReply, error) {
	var out LoginPasswordlessReply
	pattern := "/v1/auth/login/passwordless"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthLoginPasswordless))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) Refresh(ctx context.Context, in *RefreshTokenAuthRequest, opts ...http.CallOption) (*RefreshTokenAuthReply, error) {
	var out RefreshTokenAuthReply
	pattern := "/v1/auth/refresh"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthRefresh))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) Register(ctx context.Context, in *RegisterAuthRequest, opts ...http.CallOption) (*RegisterAuthReply, error) {
	var out RegisterAuthReply
	pattern := "/v1/auth/register"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthRegister))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) SendForgetPasswordToken(ctx context.Context, in *ForgetPasswordTokenRequest, opts ...http.CallOption) (*ForgetPasswordTokenReply, error) {
	var out ForgetPasswordTokenReply
	pattern := "/v1/auth/action/forget"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthSendForgetPasswordToken))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) SendPasswordlessToken(ctx context.Context, in *PasswordlessTokenAuthRequest, opts ...http.CallOption) (*PasswordlessTokenAuthReply, error) {
	var out PasswordlessTokenAuthReply
	pattern := "/v1/auth/action/passwordless"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthSendPasswordlessToken))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) Token(ctx context.Context, in *TokenRequest, opts ...http.CallOption) (*TokenReply, error) {
	var out TokenReply
	pattern := "/v1/auth/token"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthToken))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}

func (c *AuthHTTPClientImpl) ValidatePassword(ctx context.Context, in *ValidatePasswordRequest, opts ...http.CallOption) (*ValidatePasswordReply, error) {
	var out ValidatePasswordReply
	pattern := "/v1/auth/password/validate"
	path := binding.EncodeURL(pattern, in, false)
	opts = append(opts, http.Operation(OperationAuthValidatePassword))
	opts = append(opts, http.PathTemplate(pattern))
	err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
	if err != nil {
		return nil, err
	}
	return &out, err
}
