// 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"
)

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

// workflowTaskResultLister implements the WorkflowTaskResultLister interface.
type workflowTaskResultLister struct {
	indexer cache.Indexer
}

// NewWorkflowTaskResultLister returns a new WorkflowTaskResultLister.
func NewWorkflowTaskResultLister(indexer cache.Indexer) WorkflowTaskResultLister {
	return &workflowTaskResultLister{indexer: indexer}
}

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

// WorkflowTaskResults returns an object that can list and get WorkflowTaskResults.
func (s *workflowTaskResultLister) WorkflowTaskResults(namespace string) WorkflowTaskResultNamespaceLister {
	return workflowTaskResultNamespaceLister{indexer: s.indexer, namespace: namespace}
}

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

// workflowTaskResultNamespaceLister implements the WorkflowTaskResultNamespaceLister
// interface.
type workflowTaskResultNamespaceLister struct {
	indexer   cache.Indexer
	namespace string
}

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

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