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

package payservice

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

// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
type Client interface {
	CreatePay(ctx context.Context, req *pay.MallCreatePayRequest, callOptions ...callopt.Option) (r *pay.MallCreatePayResponse, err error)
	PayDetail(ctx context.Context, req *pay.MallPayDetailRequest, callOptions ...callopt.Option) (r *pay.MallPayDetailResponse, err error)
	PayReturn(ctx context.Context, req *pay.MallPayReturnRequest, callOptions ...callopt.Option) (r *pay.MallPayReturnResponse, err error)
	PayNotify(ctx context.Context, req *pay.MallPayNotifyRequest, callOptions ...callopt.Option) (r *pay.MallPayNotifyResponse, 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 &kPayServiceClient{
		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 kPayServiceClient struct {
	*kClient
}

func (p *kPayServiceClient) CreatePay(ctx context.Context, req *pay.MallCreatePayRequest, callOptions ...callopt.Option) (r *pay.MallCreatePayResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.CreatePay(ctx, req)
}

func (p *kPayServiceClient) PayDetail(ctx context.Context, req *pay.MallPayDetailRequest, callOptions ...callopt.Option) (r *pay.MallPayDetailResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.PayDetail(ctx, req)
}

func (p *kPayServiceClient) PayReturn(ctx context.Context, req *pay.MallPayReturnRequest, callOptions ...callopt.Option) (r *pay.MallPayReturnResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.PayReturn(ctx, req)
}

func (p *kPayServiceClient) PayNotify(ctx context.Context, req *pay.MallPayNotifyRequest, callOptions ...callopt.Option) (r *pay.MallPayNotifyResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.PayNotify(ctx, req)
}
