//go:build !ignore_autogenerated
// +build !ignore_autogenerated

// Code generated by iocli, run 'iocli gen' to re-generate

package service

import (
	autowire "github.com/alibaba/ioc-golang/autowire"
	normal "github.com/alibaba/ioc-golang/autowire/normal"
	util "github.com/alibaba/ioc-golang/autowire/util"
	"github.com/alibaba/ioc-golang/example/autowire/autowire_rpc/server/pkg/dto"
	rpc_service "github.com/alibaba/ioc-golang/extension/autowire/rpc/rpc_service"
)

func init() {
	normal.RegisterStructDescriptor(&autowire.StructDescriptor{
		Factory: func() interface{} {
			return &serviceStruct_{}
		},
	})
	serviceStructStructDescriptor := &autowire.StructDescriptor{
		Alias: "github.com/alibaba/ioc-golang/example/autowire/autowire_rpc/server/pkg/service/api.ServiceStructIOCRPCClient",
		Factory: func() interface{} {
			return &ServiceStruct{}
		},
		Metadata: map[string]interface{}{
			"aop":      map[string]interface{}{},
			"autowire": map[string]interface{}{},
		},
	}
	rpc_service.RegisterStructDescriptor(serviceStructStructDescriptor)
}

type serviceStruct_ struct {
	GetUser_ func(name string, age int) (*dto.User, error)
}

func (s *serviceStruct_) GetUser(name string, age int) (*dto.User, error) {
	return s.GetUser_(name, age)
}

type ServiceStructIOCInterface interface {
	GetUser(name string, age int) (*dto.User, error)
}

var _serviceStructSDID string

func GetServiceStructRpc() (*ServiceStruct, error) {
	if _serviceStructSDID == "" {
		_serviceStructSDID = util.GetSDIDByStructPtr(new(ServiceStruct))
	}
	i, err := rpc_service.GetImpl(_serviceStructSDID)
	if err != nil {
		return nil, err
	}
	impl := i.(*ServiceStruct)
	return impl, nil
}

func GetServiceStructIOCInterfaceRpc() (ServiceStructIOCInterface, error) {
	if _serviceStructSDID == "" {
		_serviceStructSDID = util.GetSDIDByStructPtr(new(ServiceStruct))
	}
	i, err := rpc_service.GetImplWithProxy(_serviceStructSDID)
	if err != nil {
		return nil, err
	}
	impl := i.(ServiceStructIOCInterface)
	return impl, nil
}
