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

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

package transaction

import (
	"github.com/alibaba/ioc-golang/aop"
	"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 &context_{}
		},
	})
	contextStructDescriptor := &autowire.StructDescriptor{
		Factory: func() interface{} {
			return &context{}
		},
		ParamFactory: func() interface{} {
			var _ contextParamInterface = &contextParam{}
			return &contextParam{}
		},
		ConstructFunc: func(i interface{}, p interface{}) (interface{}, error) {
			param := p.(contextParamInterface)
			impl := i.(*context)
			return param.init(impl)
		},
		Metadata: map[string]interface{}{
			"aop":      map[string]interface{}{},
			"autowire": map[string]interface{}{},
		},
		DisableProxy: true,
	}
	normal.RegisterStructDescriptor(contextStructDescriptor)
	normal.RegisterStructDescriptor(&autowire.StructDescriptor{
		Factory: func() interface{} {
			return &rollbackAbleInvocationCtx_{}
		},
	})
	rollbackAbleInvocationCtxStructDescriptor := &autowire.StructDescriptor{
		Factory: func() interface{} {
			return &rollbackAbleInvocationCtx{}
		},
		ParamFactory: func() interface{} {
			var _ rollbackAbleInvocationCtxParamInterface = &rollbackAbleInvocationCtxParam{}
			return &rollbackAbleInvocationCtxParam{}
		},
		ConstructFunc: func(i interface{}, p interface{}) (interface{}, error) {
			param := p.(rollbackAbleInvocationCtxParamInterface)
			impl := i.(*rollbackAbleInvocationCtx)
			return param.init(impl)
		},
		Metadata: map[string]interface{}{
			"aop":      map[string]interface{}{},
			"autowire": map[string]interface{}{},
		},
		DisableProxy: true,
	}
	normal.RegisterStructDescriptor(rollbackAbleInvocationCtxStructDescriptor)
	normal.RegisterStructDescriptor(&autowire.StructDescriptor{
		Factory: func() interface{} {
			return &interceptorImpl_{}
		},
	})
	interceptorImplStructDescriptor := &autowire.StructDescriptor{
		Factory: func() interface{} {
			return &interceptorImpl{}
		},
		Metadata: map[string]interface{}{
			"aop":      map[string]interface{}{},
			"autowire": map[string]interface{}{},
		},
		DisableProxy: true,
	}
	singleton.RegisterStructDescriptor(interceptorImplStructDescriptor)
}

type contextParamInterface interface {
	init(impl *context) (*context, error)
}
type rollbackAbleInvocationCtxParamInterface interface {
	init(impl *rollbackAbleInvocationCtx) (*rollbackAbleInvocationCtx, error)
}
type context_ struct {
	Finish_                             func()
	GetEntranceMethodFullName_          func() string
	Failed_                             func(err error)
	AddSuccessfullyCalledInvocationCtx_ func(ctx *aop.InvocationContext)
}

func (c *context_) Finish() {
	c.Finish_()
}

func (c *context_) GetEntranceMethodFullName() string {
	return c.GetEntranceMethodFullName_()
}

func (c *context_) Failed(err error) {
	c.Failed_(err)
}

func (c *context_) AddSuccessfullyCalledInvocationCtx(ctx *aop.InvocationContext) {
	c.AddSuccessfullyCalledInvocationCtx_(ctx)
}

type rollbackAbleInvocationCtx_ struct {
	Rollback_ func(err error)
}

func (r *rollbackAbleInvocationCtx_) Rollback(err error) {
	r.Rollback_(err)
}

type interceptorImpl_ struct {
	BeforeInvoke_ func(ctx *aop.InvocationContext)
	AfterInvoke_  func(ctx *aop.InvocationContext)
}

func (i *interceptorImpl_) BeforeInvoke(ctx *aop.InvocationContext) {
	i.BeforeInvoke_(ctx)
}

func (i *interceptorImpl_) AfterInvoke(ctx *aop.InvocationContext) {
	i.AfterInvoke_(ctx)
}

type contextIOCInterface interface {
	Finish()
	GetEntranceMethodFullName() string
	Failed(err error)
	AddSuccessfullyCalledInvocationCtx(ctx *aop.InvocationContext)
}

type rollbackAbleInvocationCtxIOCInterface interface {
	Rollback(err error)
}

type interceptorImplIOCInterface interface {
	BeforeInvoke(ctx *aop.InvocationContext)
	AfterInvoke(ctx *aop.InvocationContext)
}

var _contextSDID string

func Getcontext(p *contextParam) (*context, error) {
	if _contextSDID == "" {
		_contextSDID = util.GetSDIDByStructPtr(new(context))
	}
	i, err := normal.GetImpl(_contextSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(*context)
	return impl, nil
}

func GetcontextIOCInterface(p *contextParam) (contextIOCInterface, error) {
	if _contextSDID == "" {
		_contextSDID = util.GetSDIDByStructPtr(new(context))
	}
	i, err := normal.GetImplWithProxy(_contextSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(contextIOCInterface)
	return impl, nil
}

var _rollbackAbleInvocationCtxSDID string

func GetrollbackAbleInvocationCtx(p *rollbackAbleInvocationCtxParam) (*rollbackAbleInvocationCtx, error) {
	if _rollbackAbleInvocationCtxSDID == "" {
		_rollbackAbleInvocationCtxSDID = util.GetSDIDByStructPtr(new(rollbackAbleInvocationCtx))
	}
	i, err := normal.GetImpl(_rollbackAbleInvocationCtxSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(*rollbackAbleInvocationCtx)
	return impl, nil
}

func GetrollbackAbleInvocationCtxIOCInterface(p *rollbackAbleInvocationCtxParam) (rollbackAbleInvocationCtxIOCInterface, error) {
	if _rollbackAbleInvocationCtxSDID == "" {
		_rollbackAbleInvocationCtxSDID = util.GetSDIDByStructPtr(new(rollbackAbleInvocationCtx))
	}
	i, err := normal.GetImplWithProxy(_rollbackAbleInvocationCtxSDID, p)
	if err != nil {
		return nil, err
	}
	impl := i.(rollbackAbleInvocationCtxIOCInterface)
	return impl, nil
}

var _interceptorImplSDID string

func GetinterceptorImplSingleton() (*interceptorImpl, error) {
	if _interceptorImplSDID == "" {
		_interceptorImplSDID = util.GetSDIDByStructPtr(new(interceptorImpl))
	}
	i, err := singleton.GetImpl(_interceptorImplSDID, nil)
	if err != nil {
		return nil, err
	}
	impl := i.(*interceptorImpl)
	return impl, nil
}

func GetinterceptorImplIOCInterfaceSingleton() (interceptorImplIOCInterface, error) {
	if _interceptorImplSDID == "" {
		_interceptorImplSDID = util.GetSDIDByStructPtr(new(interceptorImpl))
	}
	i, err := singleton.GetImplWithProxy(_interceptorImplSDID, nil)
	if err != nil {
		return nil, err
	}
	impl := i.(interceptorImplIOCInterface)
	return impl, nil
}

type ThisinterceptorImpl struct {
}

func (t *ThisinterceptorImpl) This() interceptorImplIOCInterface {
	thisPtr, _ := GetinterceptorImplIOCInterfaceSingleton()
	return thisPtr
}
