// Code generated by ent, DO NOT EDIT.

package membership

import (
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/chainloop-dev/chainloop/app/controlplane/pkg/authz"
	"github.com/chainloop-dev/chainloop/app/controlplane/pkg/data/ent/predicate"
	"github.com/google/uuid"
)

// ID filters vertices based on their ID field.
func ID(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldID, id))
}

// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldID, id))
}

// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldID, id))
}

// IDIn applies the In predicate on the ID field.
func IDIn(ids ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldIn(FieldID, ids...))
}

// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNotIn(FieldID, ids...))
}

// IDGT applies the GT predicate on the ID field.
func IDGT(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldGT(FieldID, id))
}

// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldGTE(FieldID, id))
}

// IDLT applies the LT predicate on the ID field.
func IDLT(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldLT(FieldID, id))
}

// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldLTE(FieldID, id))
}

// Current applies equality check predicate on the "current" field. It's identical to CurrentEQ.
func Current(v bool) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldCurrent, v))
}

// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldCreatedAt, v))
}

// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldUpdatedAt, v))
}

// MemberID applies equality check predicate on the "member_id" field. It's identical to MemberIDEQ.
func MemberID(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldMemberID, v))
}

// ResourceID applies equality check predicate on the "resource_id" field. It's identical to ResourceIDEQ.
func ResourceID(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldResourceID, v))
}

// ParentID applies equality check predicate on the "parent_id" field. It's identical to ParentIDEQ.
func ParentID(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldParentID, v))
}

// CurrentEQ applies the EQ predicate on the "current" field.
func CurrentEQ(v bool) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldCurrent, v))
}

// CurrentNEQ applies the NEQ predicate on the "current" field.
func CurrentNEQ(v bool) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldCurrent, v))
}

// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldCreatedAt, v))
}

// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldCreatedAt, v))
}

// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldIn(FieldCreatedAt, vs...))
}

// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldNotIn(FieldCreatedAt, vs...))
}

// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldGT(FieldCreatedAt, v))
}

// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldGTE(FieldCreatedAt, v))
}

// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldLT(FieldCreatedAt, v))
}

// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldLTE(FieldCreatedAt, v))
}

// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldUpdatedAt, v))
}

// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldUpdatedAt, v))
}

// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldIn(FieldUpdatedAt, vs...))
}

// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldNotIn(FieldUpdatedAt, vs...))
}

// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldGT(FieldUpdatedAt, v))
}

// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldGTE(FieldUpdatedAt, v))
}

// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldLT(FieldUpdatedAt, v))
}

// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.Membership {
	return predicate.Membership(sql.FieldLTE(FieldUpdatedAt, v))
}

// RoleEQ applies the EQ predicate on the "role" field.
func RoleEQ(v authz.Role) predicate.Membership {
	vc := v
	return predicate.Membership(sql.FieldEQ(FieldRole, vc))
}

// RoleNEQ applies the NEQ predicate on the "role" field.
func RoleNEQ(v authz.Role) predicate.Membership {
	vc := v
	return predicate.Membership(sql.FieldNEQ(FieldRole, vc))
}

// RoleIn applies the In predicate on the "role" field.
func RoleIn(vs ...authz.Role) predicate.Membership {
	v := make([]any, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.Membership(sql.FieldIn(FieldRole, v...))
}

// RoleNotIn applies the NotIn predicate on the "role" field.
func RoleNotIn(vs ...authz.Role) predicate.Membership {
	v := make([]any, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.Membership(sql.FieldNotIn(FieldRole, v...))
}

// MembershipTypeEQ applies the EQ predicate on the "membership_type" field.
func MembershipTypeEQ(v authz.MembershipType) predicate.Membership {
	vc := v
	return predicate.Membership(sql.FieldEQ(FieldMembershipType, vc))
}

// MembershipTypeNEQ applies the NEQ predicate on the "membership_type" field.
func MembershipTypeNEQ(v authz.MembershipType) predicate.Membership {
	vc := v
	return predicate.Membership(sql.FieldNEQ(FieldMembershipType, vc))
}

// MembershipTypeIn applies the In predicate on the "membership_type" field.
func MembershipTypeIn(vs ...authz.MembershipType) predicate.Membership {
	v := make([]any, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.Membership(sql.FieldIn(FieldMembershipType, v...))
}

// MembershipTypeNotIn applies the NotIn predicate on the "membership_type" field.
func MembershipTypeNotIn(vs ...authz.MembershipType) predicate.Membership {
	v := make([]any, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.Membership(sql.FieldNotIn(FieldMembershipType, v...))
}

// MembershipTypeIsNil applies the IsNil predicate on the "membership_type" field.
func MembershipTypeIsNil() predicate.Membership {
	return predicate.Membership(sql.FieldIsNull(FieldMembershipType))
}

// MembershipTypeNotNil applies the NotNil predicate on the "membership_type" field.
func MembershipTypeNotNil() predicate.Membership {
	return predicate.Membership(sql.FieldNotNull(FieldMembershipType))
}

// MemberIDEQ applies the EQ predicate on the "member_id" field.
func MemberIDEQ(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldMemberID, v))
}

// MemberIDNEQ applies the NEQ predicate on the "member_id" field.
func MemberIDNEQ(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldMemberID, v))
}

// MemberIDIn applies the In predicate on the "member_id" field.
func MemberIDIn(vs ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldIn(FieldMemberID, vs...))
}

// MemberIDNotIn applies the NotIn predicate on the "member_id" field.
func MemberIDNotIn(vs ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNotIn(FieldMemberID, vs...))
}

// MemberIDGT applies the GT predicate on the "member_id" field.
func MemberIDGT(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldGT(FieldMemberID, v))
}

// MemberIDGTE applies the GTE predicate on the "member_id" field.
func MemberIDGTE(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldGTE(FieldMemberID, v))
}

// MemberIDLT applies the LT predicate on the "member_id" field.
func MemberIDLT(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldLT(FieldMemberID, v))
}

// MemberIDLTE applies the LTE predicate on the "member_id" field.
func MemberIDLTE(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldLTE(FieldMemberID, v))
}

// MemberIDIsNil applies the IsNil predicate on the "member_id" field.
func MemberIDIsNil() predicate.Membership {
	return predicate.Membership(sql.FieldIsNull(FieldMemberID))
}

// MemberIDNotNil applies the NotNil predicate on the "member_id" field.
func MemberIDNotNil() predicate.Membership {
	return predicate.Membership(sql.FieldNotNull(FieldMemberID))
}

// ResourceTypeEQ applies the EQ predicate on the "resource_type" field.
func ResourceTypeEQ(v authz.ResourceType) predicate.Membership {
	vc := v
	return predicate.Membership(sql.FieldEQ(FieldResourceType, vc))
}

// ResourceTypeNEQ applies the NEQ predicate on the "resource_type" field.
func ResourceTypeNEQ(v authz.ResourceType) predicate.Membership {
	vc := v
	return predicate.Membership(sql.FieldNEQ(FieldResourceType, vc))
}

// ResourceTypeIn applies the In predicate on the "resource_type" field.
func ResourceTypeIn(vs ...authz.ResourceType) predicate.Membership {
	v := make([]any, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.Membership(sql.FieldIn(FieldResourceType, v...))
}

// ResourceTypeNotIn applies the NotIn predicate on the "resource_type" field.
func ResourceTypeNotIn(vs ...authz.ResourceType) predicate.Membership {
	v := make([]any, len(vs))
	for i := range v {
		v[i] = vs[i]
	}
	return predicate.Membership(sql.FieldNotIn(FieldResourceType, v...))
}

// ResourceTypeIsNil applies the IsNil predicate on the "resource_type" field.
func ResourceTypeIsNil() predicate.Membership {
	return predicate.Membership(sql.FieldIsNull(FieldResourceType))
}

// ResourceTypeNotNil applies the NotNil predicate on the "resource_type" field.
func ResourceTypeNotNil() predicate.Membership {
	return predicate.Membership(sql.FieldNotNull(FieldResourceType))
}

// ResourceIDEQ applies the EQ predicate on the "resource_id" field.
func ResourceIDEQ(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldResourceID, v))
}

// ResourceIDNEQ applies the NEQ predicate on the "resource_id" field.
func ResourceIDNEQ(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldResourceID, v))
}

// ResourceIDIn applies the In predicate on the "resource_id" field.
func ResourceIDIn(vs ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldIn(FieldResourceID, vs...))
}

// ResourceIDNotIn applies the NotIn predicate on the "resource_id" field.
func ResourceIDNotIn(vs ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNotIn(FieldResourceID, vs...))
}

// ResourceIDGT applies the GT predicate on the "resource_id" field.
func ResourceIDGT(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldGT(FieldResourceID, v))
}

// ResourceIDGTE applies the GTE predicate on the "resource_id" field.
func ResourceIDGTE(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldGTE(FieldResourceID, v))
}

// ResourceIDLT applies the LT predicate on the "resource_id" field.
func ResourceIDLT(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldLT(FieldResourceID, v))
}

// ResourceIDLTE applies the LTE predicate on the "resource_id" field.
func ResourceIDLTE(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldLTE(FieldResourceID, v))
}

// ResourceIDIsNil applies the IsNil predicate on the "resource_id" field.
func ResourceIDIsNil() predicate.Membership {
	return predicate.Membership(sql.FieldIsNull(FieldResourceID))
}

// ResourceIDNotNil applies the NotNil predicate on the "resource_id" field.
func ResourceIDNotNil() predicate.Membership {
	return predicate.Membership(sql.FieldNotNull(FieldResourceID))
}

// ParentIDEQ applies the EQ predicate on the "parent_id" field.
func ParentIDEQ(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldEQ(FieldParentID, v))
}

// ParentIDNEQ applies the NEQ predicate on the "parent_id" field.
func ParentIDNEQ(v uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNEQ(FieldParentID, v))
}

// ParentIDIn applies the In predicate on the "parent_id" field.
func ParentIDIn(vs ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldIn(FieldParentID, vs...))
}

// ParentIDNotIn applies the NotIn predicate on the "parent_id" field.
func ParentIDNotIn(vs ...uuid.UUID) predicate.Membership {
	return predicate.Membership(sql.FieldNotIn(FieldParentID, vs...))
}

// ParentIDIsNil applies the IsNil predicate on the "parent_id" field.
func ParentIDIsNil() predicate.Membership {
	return predicate.Membership(sql.FieldIsNull(FieldParentID))
}

// ParentIDNotNil applies the NotNil predicate on the "parent_id" field.
func ParentIDNotNil() predicate.Membership {
	return predicate.Membership(sql.FieldNotNull(FieldParentID))
}

// HasOrganization applies the HasEdge predicate on the "organization" edge.
func HasOrganization() predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, OrganizationTable, OrganizationColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasOrganizationWith applies the HasEdge predicate on the "organization" edge with a given conditions (other predicates).
func HasOrganizationWith(preds ...predicate.Organization) predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := newOrganizationStep()
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// HasUser applies the HasEdge predicate on the "user" edge.
func HasUser() predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasUserWith applies the HasEdge predicate on the "user" edge with a given conditions (other predicates).
func HasUserWith(preds ...predicate.User) predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := newUserStep()
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// HasParent applies the HasEdge predicate on the "parent" edge.
func HasParent() predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasParentWith applies the HasEdge predicate on the "parent" edge with a given conditions (other predicates).
func HasParentWith(preds ...predicate.Membership) predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := newParentStep()
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// HasChildren applies the HasEdge predicate on the "children" edge.
func HasChildren() predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.O2M, false, ChildrenTable, ChildrenColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasChildrenWith applies the HasEdge predicate on the "children" edge with a given conditions (other predicates).
func HasChildrenWith(preds ...predicate.Membership) predicate.Membership {
	return predicate.Membership(func(s *sql.Selector) {
		step := newChildrenStep()
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// And groups predicates with the AND operator between them.
func And(predicates ...predicate.Membership) predicate.Membership {
	return predicate.Membership(sql.AndPredicates(predicates...))
}

// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Membership) predicate.Membership {
	return predicate.Membership(sql.OrPredicates(predicates...))
}

// Not applies the not operator on the given predicate.
func Not(p predicate.Membership) predicate.Membership {
	return predicate.Membership(sql.NotPredicates(p))
}
