// Copyright Contributors to the Open Cluster Management project
// Code generated by informer-gen. DO NOT EDIT.

package v1alpha1

import (
	context "context"
	time "time"

	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	runtime "k8s.io/apimachinery/pkg/runtime"
	watch "k8s.io/apimachinery/pkg/watch"
	cache "k8s.io/client-go/tools/cache"
	versioned "open-cluster-management.io/api/client/work/clientset/versioned"
	internalinterfaces "open-cluster-management.io/api/client/work/informers/externalversions/internalinterfaces"
	workv1alpha1 "open-cluster-management.io/api/client/work/listers/work/v1alpha1"
	apiworkv1alpha1 "open-cluster-management.io/api/work/v1alpha1"
)

// ManifestWorkReplicaSetInformer provides access to a shared informer and lister for
// ManifestWorkReplicaSets.
type ManifestWorkReplicaSetInformer interface {
	Informer() cache.SharedIndexInformer
	Lister() workv1alpha1.ManifestWorkReplicaSetLister
}

type manifestWorkReplicaSetInformer struct {
	factory          internalinterfaces.SharedInformerFactory
	tweakListOptions internalinterfaces.TweakListOptionsFunc
	namespace        string
}

// NewManifestWorkReplicaSetInformer constructs a new informer for ManifestWorkReplicaSet type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewManifestWorkReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
	return NewFilteredManifestWorkReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil)
}

// NewFilteredManifestWorkReplicaSetInformer constructs a new informer for ManifestWorkReplicaSet type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredManifestWorkReplicaSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
	return cache.NewSharedIndexInformer(
		&cache.ListWatch{
			ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.WorkV1alpha1().ManifestWorkReplicaSets(namespace).List(context.Background(), options)
			},
			WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.WorkV1alpha1().ManifestWorkReplicaSets(namespace).Watch(context.Background(), options)
			},
			ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.WorkV1alpha1().ManifestWorkReplicaSets(namespace).List(ctx, options)
			},
			WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
				if tweakListOptions != nil {
					tweakListOptions(&options)
				}
				return client.WorkV1alpha1().ManifestWorkReplicaSets(namespace).Watch(ctx, options)
			},
		},
		&apiworkv1alpha1.ManifestWorkReplicaSet{},
		resyncPeriod,
		indexers,
	)
}

func (f *manifestWorkReplicaSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
	return NewFilteredManifestWorkReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}

func (f *manifestWorkReplicaSetInformer) Informer() cache.SharedIndexInformer {
	return f.factory.InformerFor(&apiworkv1alpha1.ManifestWorkReplicaSet{}, f.defaultInformer)
}

func (f *manifestWorkReplicaSetInformer) Lister() workv1alpha1.ManifestWorkReplicaSetLister {
	return workv1alpha1.NewManifestWorkReplicaSetLister(f.Informer().GetIndexer())
}
