// Code generated by Kitex v0.5.1. DO NOT EDIT.

package merchantservice

import (
	"context"
	client "github.com/cloudwego/kitex/client"
	callopt "github.com/cloudwego/kitex/client/callopt"
	merchant "github.com/cqqqq777/go-kitex-mall/shared/kitex_gen/merchant"
)

// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
type Client interface {
	Register(ctx context.Context, req *merchant.MallMerchantRegisterRequest, callOptions ...callopt.Option) (r *merchant.MallMerchantRegisterResponse, err error)
	Login(ctx context.Context, req *merchant.MallMerchantLoginRequest, callOptions ...callopt.Option) (r *merchant.MallMerchantLoginResponse, err error)
	GetInfo(ctx context.Context, req *merchant.MallMerchantGetInfoRequest, callOptions ...callopt.Option) (r *merchant.MallMerchantGetInfoResponse, err error)
}

// NewClient creates a client for the service defined in IDL.
func NewClient(destService string, opts ...client.Option) (Client, error) {
	var options []client.Option
	options = append(options, client.WithDestService(destService))

	options = append(options, opts...)

	kc, err := client.NewClient(serviceInfo(), options...)
	if err != nil {
		return nil, err
	}
	return &kMerchantServiceClient{
		kClient: newServiceClient(kc),
	}, nil
}

// MustNewClient creates a client for the service defined in IDL. It panics if any error occurs.
func MustNewClient(destService string, opts ...client.Option) Client {
	kc, err := NewClient(destService, opts...)
	if err != nil {
		panic(err)
	}
	return kc
}

type kMerchantServiceClient struct {
	*kClient
}

func (p *kMerchantServiceClient) Register(ctx context.Context, req *merchant.MallMerchantRegisterRequest, callOptions ...callopt.Option) (r *merchant.MallMerchantRegisterResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.Register(ctx, req)
}

func (p *kMerchantServiceClient) Login(ctx context.Context, req *merchant.MallMerchantLoginRequest, callOptions ...callopt.Option) (r *merchant.MallMerchantLoginResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.Login(ctx, req)
}

func (p *kMerchantServiceClient) GetInfo(ctx context.Context, req *merchant.MallMerchantGetInfoRequest, callOptions ...callopt.Option) (r *merchant.MallMerchantGetInfoResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.GetInfo(ctx, req)
}
