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

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

package nacos

import (
	"github.com/nacos-group/nacos-sdk-go/v2/model"
	"github.com/nacos-group/nacos-sdk-go/v2/vo"

	autowire "github.com/alibaba/ioc-golang/autowire"
	normal "github.com/alibaba/ioc-golang/autowire/normal"
	singleton "github.com/alibaba/ioc-golang/autowire/singleton"
	util "github.com/alibaba/ioc-golang/autowire/util"
)

func init() {
	normal.RegisterStructDescriptor(&autowire.StructDescriptor{
		Factory: func() interface{} {
			return &namingClient_{}
		},
	})
	namingClientStructDescriptor := &autowire.StructDescriptor{
		Factory: func() interface{} {
			return &NamingClient{}
		},
		ParamFactory: func() interface{} {
			var _ paramInterface = &Param{}
			return &Param{}
		},
		ConstructFunc: func(i interface{}, p interface{}) (interface{}, error) {
			param := p.(paramInterface)
			impl := i.(*NamingClient)
			return param.New(impl)
		},
		Metadata: map[string]interface{}{
			"aop":      map[string]interface{}{},
			"autowire": map[string]interface{}{},
		},
	}
	normal.RegisterStructDescriptor(namingClientStructDescriptor)
	singleton.RegisterStructDescriptor(namingClientStructDescriptor)
}

type paramInterface interface {
	New(impl *NamingClient) (*NamingClient, error)
}
type namingClient_ struct {
	RegisterInstance_         func(param vo.RegisterInstanceParam) (bool, error)
	DeregisterInstance_       func(param vo.DeregisterInstanceParam) (bool, error)
	UpdateInstance_           func(param vo.UpdateInstanceParam) (bool, error)
	GetService_               func(param vo.GetServiceParam) (service model.Service, err error)
	GetAllServicesInfo_       func(param vo.GetAllServiceInfoParam) (model.ServiceList, error)
	SelectAllInstances_       func(param vo.SelectAllInstancesParam) ([]model.Instance, error)
	SelectInstances_          func(param vo.SelectInstancesParam) ([]model.Instance, error)
	SelectOneHealthyInstance_ func(param vo.SelectOneHealthInstanceParam) (*model.Instance, error)
	Subscribe_                func(param *vo.SubscribeParam) error
	Unsubscribe_              func(param *vo.SubscribeParam) (err error)
}

func (n *namingClient_) RegisterInstance(param vo.RegisterInstanceParam) (bool, error) {
	return n.RegisterInstance_(param)
}

func (n *namingClient_) DeregisterInstance(param vo.DeregisterInstanceParam) (bool, error) {
	return n.DeregisterInstance_(param)
}

func (n *namingClient_) UpdateInstance(param vo.UpdateInstanceParam) (bool, error) {
	return n.UpdateInstance_(param)
}

func (n *namingClient_) GetService(param vo.GetServiceParam) (service model.Service, err error) {
	return n.GetService_(param)
}

func (n *namingClient_) GetAllServicesInfo(param vo.GetAllServiceInfoParam) (model.ServiceList, error) {
	return n.GetAllServicesInfo_(param)
}

func (n *namingClient_) SelectAllInstances(param vo.SelectAllInstancesParam) ([]model.Instance, error) {
	return n.SelectAllInstances_(param)
}

func (n *namingClient_) SelectInstances(param vo.SelectInstancesParam) ([]model.Instance, error) {
	return n.SelectInstances_(param)
}

func (n *namingClient_) SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (*model.Instance, error) {
	return n.SelectOneHealthyInstance_(param)
}

func (n *namingClient_) Subscribe(param *vo.SubscribeParam) error {
	return n.Subscribe_(param)
}

func (n *namingClient_) Unsubscribe(param *vo.SubscribeParam) (err error) {
	return n.Unsubscribe_(param)
}

type NamingClientIOCInterface interface {
	RegisterInstance(param vo.RegisterInstanceParam) (bool, error)
	DeregisterInstance(param vo.DeregisterInstanceParam) (bool, error)
	UpdateInstance(param vo.UpdateInstanceParam) (bool, error)
	GetService(param vo.GetServiceParam) (service model.Service, err error)
	GetAllServicesInfo(param vo.GetAllServiceInfoParam) (model.ServiceList, error)
	SelectAllInstances(param vo.SelectAllInstancesParam) ([]model.Instance, error)
	SelectInstances(param vo.SelectInstancesParam) ([]model.Instance, error)
	SelectOneHealthyInstance(param vo.SelectOneHealthInstanceParam) (*model.Instance, error)
	Subscribe(param *vo.SubscribeParam) error
	Unsubscribe(param *vo.SubscribeParam) (err error)
}

var _namingClientSDID string

func GetNamingClient(p *Param) (*NamingClient, error) {
	if _namingClientSDID == "" {
		_namingClientSDID = util.GetSDIDByStructPtr(new(NamingClient))
	}
	i, err := normal.GetImpl(_namingClientSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(*NamingClient)
	return impl, nil
}

func GetNamingClientIOCInterface(p *Param) (NamingClientIOCInterface, error) {
	if _namingClientSDID == "" {
		_namingClientSDID = util.GetSDIDByStructPtr(new(NamingClient))
	}
	i, err := normal.GetImplWithProxy(_namingClientSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(NamingClientIOCInterface)
	return impl, nil
}

func GetNamingClientSingleton(p *Param) (*NamingClient, error) {
	if _namingClientSDID == "" {
		_namingClientSDID = util.GetSDIDByStructPtr(new(NamingClient))
	}
	i, err := singleton.GetImpl(_namingClientSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(*NamingClient)
	return impl, nil
}

func GetNamingClientIOCInterfaceSingleton(p *Param) (NamingClientIOCInterface, error) {
	if _namingClientSDID == "" {
		_namingClientSDID = util.GetSDIDByStructPtr(new(NamingClient))
	}
	i, err := singleton.GetImplWithProxy(_namingClientSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(NamingClientIOCInterface)
	return impl, nil
}

type ThisNamingClient struct {
}

func (t *ThisNamingClient) This() NamingClientIOCInterface {
	thisPtr, _ := GetNamingClientIOCInterfaceSingleton(nil)
	return thisPtr
}
