// Code generated by lister-gen. DO NOT EDIT.

package v1alpha1

import (
	v1alpha1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
	"k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/cache"
)

// WorkflowTaskSetLister helps list WorkflowTaskSets.
// All objects returned here must be treated as read-only.
type WorkflowTaskSetLister interface {
	// List lists all WorkflowTaskSets in the indexer.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1alpha1.WorkflowTaskSet, err error)
	// WorkflowTaskSets returns an object that can list and get WorkflowTaskSets.
	WorkflowTaskSets(namespace string) WorkflowTaskSetNamespaceLister
	WorkflowTaskSetListerExpansion
}

// workflowTaskSetLister implements the WorkflowTaskSetLister interface.
type workflowTaskSetLister struct {
	indexer cache.Indexer
}

// NewWorkflowTaskSetLister returns a new WorkflowTaskSetLister.
func NewWorkflowTaskSetLister(indexer cache.Indexer) WorkflowTaskSetLister {
	return &workflowTaskSetLister{indexer: indexer}
}

// List lists all WorkflowTaskSets in the indexer.
func (s *workflowTaskSetLister) List(selector labels.Selector) (ret []*v1alpha1.WorkflowTaskSet, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1alpha1.WorkflowTaskSet))
	})
	return ret, err
}

// WorkflowTaskSets returns an object that can list and get WorkflowTaskSets.
func (s *workflowTaskSetLister) WorkflowTaskSets(namespace string) WorkflowTaskSetNamespaceLister {
	return workflowTaskSetNamespaceLister{indexer: s.indexer, namespace: namespace}
}

// WorkflowTaskSetNamespaceLister helps list and get WorkflowTaskSets.
// All objects returned here must be treated as read-only.
type WorkflowTaskSetNamespaceLister interface {
	// List lists all WorkflowTaskSets in the indexer for a given namespace.
	// Objects returned here must be treated as read-only.
	List(selector labels.Selector) (ret []*v1alpha1.WorkflowTaskSet, err error)
	// Get retrieves the WorkflowTaskSet from the indexer for a given namespace and name.
	// Objects returned here must be treated as read-only.
	Get(name string) (*v1alpha1.WorkflowTaskSet, error)
	WorkflowTaskSetNamespaceListerExpansion
}

// workflowTaskSetNamespaceLister implements the WorkflowTaskSetNamespaceLister
// interface.
type workflowTaskSetNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

// List lists all WorkflowTaskSets in the indexer for a given namespace.
func (s workflowTaskSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.WorkflowTaskSet, err error) {
	err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
		ret = append(ret, m.(*v1alpha1.WorkflowTaskSet))
	})
	return ret, err
}

// Get retrieves the WorkflowTaskSet from the indexer for a given namespace and name.
func (s workflowTaskSetNamespaceLister) Get(name string) (*v1alpha1.WorkflowTaskSet, error) {
	obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(v1alpha1.Resource("workflowtaskset"), name)
	}
	return obj.(*v1alpha1.WorkflowTaskSet), nil
}
