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

package orderservice

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

// Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework.
type Client interface {
	CreateOrder(ctx context.Context, req *order.MallCreateOrderRequest, callOptions ...callopt.Option) (r *order.MallCreateOrderResponse, err error)
	UpdateOrder(ctx context.Context, req *order.MallUpdateOrderRequest, callOptions ...callopt.Option) (r *order.MallUpdateOrderResponse, err error)
	OrderList(ctx context.Context, req *order.MallOrderListRequset, callOptions ...callopt.Option) (r *order.MallOrderListResponse, err error)
	GetOrder(ctx context.Context, req *order.MallGetOrderRequest, callOptions ...callopt.Option) (r *order.MallGetOrderResponse, 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 &kOrderServiceClient{
		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 kOrderServiceClient struct {
	*kClient
}

func (p *kOrderServiceClient) CreateOrder(ctx context.Context, req *order.MallCreateOrderRequest, callOptions ...callopt.Option) (r *order.MallCreateOrderResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.CreateOrder(ctx, req)
}

func (p *kOrderServiceClient) UpdateOrder(ctx context.Context, req *order.MallUpdateOrderRequest, callOptions ...callopt.Option) (r *order.MallUpdateOrderResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.UpdateOrder(ctx, req)
}

func (p *kOrderServiceClient) OrderList(ctx context.Context, req *order.MallOrderListRequset, callOptions ...callopt.Option) (r *order.MallOrderListResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.OrderList(ctx, req)
}

func (p *kOrderServiceClient) GetOrder(ctx context.Context, req *order.MallGetOrderRequest, callOptions ...callopt.Option) (r *order.MallGetOrderResponse, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.GetOrder(ctx, req)
}
