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

package fake

import (
	"context"

	v1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	labels "k8s.io/apimachinery/pkg/labels"
	schema "k8s.io/apimachinery/pkg/runtime/schema"
	types "k8s.io/apimachinery/pkg/types"
	watch "k8s.io/apimachinery/pkg/watch"
	testing "k8s.io/client-go/testing"
)

// FakeFederatedResourceQuotas implements FederatedResourceQuotaInterface
type FakeFederatedResourceQuotas struct {
	Fake *FakePolicyV1alpha1
	ns   string
}

var federatedresourcequotasResource = schema.GroupVersionResource{Group: "policy.karmada.io", Version: "v1alpha1", Resource: "federatedresourcequotas"}

var federatedresourcequotasKind = schema.GroupVersionKind{Group: "policy.karmada.io", Version: "v1alpha1", Kind: "FederatedResourceQuota"}

// Get takes name of the federatedResourceQuota, and returns the corresponding federatedResourceQuota object, and an error if there is any.
func (c *FakeFederatedResourceQuotas) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.FederatedResourceQuota, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewGetAction(federatedresourcequotasResource, c.ns, name), &v1alpha1.FederatedResourceQuota{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.FederatedResourceQuota), err
}

// List takes label and field selectors, and returns the list of FederatedResourceQuotas that match those selectors.
func (c *FakeFederatedResourceQuotas) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FederatedResourceQuotaList, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewListAction(federatedresourcequotasResource, federatedresourcequotasKind, c.ns, opts), &v1alpha1.FederatedResourceQuotaList{})

	if obj == nil {
		return nil, err
	}

	label, _, _ := testing.ExtractFromListOptions(opts)
	if label == nil {
		label = labels.Everything()
	}
	list := &v1alpha1.FederatedResourceQuotaList{ListMeta: obj.(*v1alpha1.FederatedResourceQuotaList).ListMeta}
	for _, item := range obj.(*v1alpha1.FederatedResourceQuotaList).Items {
		if label.Matches(labels.Set(item.Labels)) {
			list.Items = append(list.Items, item)
		}
	}
	return list, err
}

// Watch returns a watch.Interface that watches the requested federatedResourceQuotas.
func (c *FakeFederatedResourceQuotas) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
	return c.Fake.
		InvokesWatch(testing.NewWatchAction(federatedresourcequotasResource, c.ns, opts))

}

// Create takes the representation of a federatedResourceQuota and creates it.  Returns the server's representation of the federatedResourceQuota, and an error, if there is any.
func (c *FakeFederatedResourceQuotas) Create(ctx context.Context, federatedResourceQuota *v1alpha1.FederatedResourceQuota, opts v1.CreateOptions) (result *v1alpha1.FederatedResourceQuota, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewCreateAction(federatedresourcequotasResource, c.ns, federatedResourceQuota), &v1alpha1.FederatedResourceQuota{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.FederatedResourceQuota), err
}

// Update takes the representation of a federatedResourceQuota and updates it. Returns the server's representation of the federatedResourceQuota, and an error, if there is any.
func (c *FakeFederatedResourceQuotas) Update(ctx context.Context, federatedResourceQuota *v1alpha1.FederatedResourceQuota, opts v1.UpdateOptions) (result *v1alpha1.FederatedResourceQuota, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(federatedresourcequotasResource, c.ns, federatedResourceQuota), &v1alpha1.FederatedResourceQuota{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.FederatedResourceQuota), err
}

// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeFederatedResourceQuotas) UpdateStatus(ctx context.Context, federatedResourceQuota *v1alpha1.FederatedResourceQuota, opts v1.UpdateOptions) (*v1alpha1.FederatedResourceQuota, error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateSubresourceAction(federatedresourcequotasResource, "status", c.ns, federatedResourceQuota), &v1alpha1.FederatedResourceQuota{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.FederatedResourceQuota), err
}

// Delete takes name of the federatedResourceQuota and deletes it. Returns an error if one occurs.
func (c *FakeFederatedResourceQuotas) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
	_, err := c.Fake.
		Invokes(testing.NewDeleteActionWithOptions(federatedresourcequotasResource, c.ns, name, opts), &v1alpha1.FederatedResourceQuota{})

	return err
}

// DeleteCollection deletes a collection of objects.
func (c *FakeFederatedResourceQuotas) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
	action := testing.NewDeleteCollectionAction(federatedresourcequotasResource, c.ns, listOpts)

	_, err := c.Fake.Invokes(action, &v1alpha1.FederatedResourceQuotaList{})
	return err
}

// Patch applies the patch and returns the patched federatedResourceQuota.
func (c *FakeFederatedResourceQuotas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.FederatedResourceQuota, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewPatchSubresourceAction(federatedresourcequotasResource, c.ns, name, pt, data, subresources...), &v1alpha1.FederatedResourceQuota{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.FederatedResourceQuota), err
}
