// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/user.proto

/*
Package bitesla_srv_user is a generated protocol buffer package.

It is generated from these files:
	proto/user.proto

It has these top-level messages:
	UserReq
	UserResp
*/
package bitesla_srv_user

import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"

import (
	context "context"
	client "github.com/micro/go-micro/client"
	server "github.com/micro/go-micro/server"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package

// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option

// Client API for User service

type UserService interface {
	LoginEmail(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error)
	LoginPhone(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error)
	GetCode(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error)
	RegisterEmail(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error)
	RegisterPhone(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error)
	GetUserById(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error)
}

type userService struct {
	c    client.Client
	name string
}

func NewUserService(name string, c client.Client) UserService {
	if c == nil {
		c = client.NewClient()
	}
	if len(name) == 0 {
		name = "bitesla.srv.user"
	}
	return &userService{
		c:    c,
		name: name,
	}
}

func (c *userService) LoginEmail(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error) {
	req := c.c.NewRequest(c.name, "User.LoginEmail", in)
	out := new(UserResp)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *userService) LoginPhone(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error) {
	req := c.c.NewRequest(c.name, "User.LoginPhone", in)
	out := new(UserResp)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *userService) GetCode(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error) {
	req := c.c.NewRequest(c.name, "User.GetCode", in)
	out := new(UserResp)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *userService) RegisterEmail(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error) {
	req := c.c.NewRequest(c.name, "User.RegisterEmail", in)
	out := new(UserResp)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *userService) RegisterPhone(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error) {
	req := c.c.NewRequest(c.name, "User.RegisterPhone", in)
	out := new(UserResp)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *userService) GetUserById(ctx context.Context, in *UserReq, opts ...client.CallOption) (*UserResp, error) {
	req := c.c.NewRequest(c.name, "User.GetUserById", in)
	out := new(UserResp)
	err := c.c.Call(ctx, req, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// Server API for User service

type UserHandler interface {
	LoginEmail(context.Context, *UserReq, *UserResp) error
	LoginPhone(context.Context, *UserReq, *UserResp) error
	GetCode(context.Context, *UserReq, *UserResp) error
	RegisterEmail(context.Context, *UserReq, *UserResp) error
	RegisterPhone(context.Context, *UserReq, *UserResp) error
	GetUserById(context.Context, *UserReq, *UserResp) error
}

func RegisterUserHandler(s server.Server, hdlr UserHandler, opts ...server.HandlerOption) error {
	type user interface {
		LoginEmail(ctx context.Context, in *UserReq, out *UserResp) error
		LoginPhone(ctx context.Context, in *UserReq, out *UserResp) error
		GetCode(ctx context.Context, in *UserReq, out *UserResp) error
		RegisterEmail(ctx context.Context, in *UserReq, out *UserResp) error
		RegisterPhone(ctx context.Context, in *UserReq, out *UserResp) error
		GetUserById(ctx context.Context, in *UserReq, out *UserResp) error
	}
	type User struct {
		user
	}
	h := &userHandler{hdlr}
	return s.Handle(s.NewHandler(&User{h}, opts...))
}

type userHandler struct {
	UserHandler
}

func (h *userHandler) LoginEmail(ctx context.Context, in *UserReq, out *UserResp) error {
	return h.UserHandler.LoginEmail(ctx, in, out)
}

func (h *userHandler) LoginPhone(ctx context.Context, in *UserReq, out *UserResp) error {
	return h.UserHandler.LoginPhone(ctx, in, out)
}

func (h *userHandler) GetCode(ctx context.Context, in *UserReq, out *UserResp) error {
	return h.UserHandler.GetCode(ctx, in, out)
}

func (h *userHandler) RegisterEmail(ctx context.Context, in *UserReq, out *UserResp) error {
	return h.UserHandler.RegisterEmail(ctx, in, out)
}

func (h *userHandler) RegisterPhone(ctx context.Context, in *UserReq, out *UserResp) error {
	return h.UserHandler.RegisterPhone(ctx, in, out)
}

func (h *userHandler) GetUserById(ctx context.Context, in *UserReq, out *UserResp) error {
	return h.UserHandler.GetUserById(ctx, in, out)
}
