// Code generated by ent, DO NOT EDIT.

package challenge

import (
	"PasswordManager/ent/predicate"
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/google/uuid"
)

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

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

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

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

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

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

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

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

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

// Expiry applies equality check predicate on the "expiry" field. It's identical to ExpiryEQ.
func Expiry(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldEQ(FieldExpiry, v))
}

// ExpiryEQ applies the EQ predicate on the "expiry" field.
func ExpiryEQ(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldEQ(FieldExpiry, v))
}

// ExpiryNEQ applies the NEQ predicate on the "expiry" field.
func ExpiryNEQ(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldNEQ(FieldExpiry, v))
}

// ExpiryIn applies the In predicate on the "expiry" field.
func ExpiryIn(vs ...time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldIn(FieldExpiry, vs...))
}

// ExpiryNotIn applies the NotIn predicate on the "expiry" field.
func ExpiryNotIn(vs ...time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldNotIn(FieldExpiry, vs...))
}

// ExpiryGT applies the GT predicate on the "expiry" field.
func ExpiryGT(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldGT(FieldExpiry, v))
}

// ExpiryGTE applies the GTE predicate on the "expiry" field.
func ExpiryGTE(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldGTE(FieldExpiry, v))
}

// ExpiryLT applies the LT predicate on the "expiry" field.
func ExpiryLT(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldLT(FieldExpiry, v))
}

// ExpiryLTE applies the LTE predicate on the "expiry" field.
func ExpiryLTE(v time.Time) predicate.Challenge {
	return predicate.Challenge(sql.FieldLTE(FieldExpiry, v))
}

// HasUser applies the HasEdge predicate on the "user" edge.
func HasUser() predicate.Challenge {
	return predicate.Challenge(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.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.To(UserInverseTable, FieldID),
			sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
		)
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// HasEmailChallenge applies the HasEdge predicate on the "emailChallenge" edge.
func HasEmailChallenge() predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, EmailChallengeTable, EmailChallengeColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasEmailChallengeWith applies the HasEdge predicate on the "emailChallenge" edge with a given conditions (other predicates).
func HasEmailChallengeWith(preds ...predicate.EmailChallenge) predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.To(EmailChallengeInverseTable, FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, EmailChallengeTable, EmailChallengeColumn),
		)
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// HasWebauthnChallenge applies the HasEdge predicate on the "webauthnChallenge" edge.
func HasWebauthnChallenge() predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, WebauthnChallengeTable, WebauthnChallengeColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasWebauthnChallengeWith applies the HasEdge predicate on the "webauthnChallenge" edge with a given conditions (other predicates).
func HasWebauthnChallengeWith(preds ...predicate.WebAuthnChallenge) predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.To(WebauthnChallengeInverseTable, FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, WebauthnChallengeTable, WebauthnChallengeColumn),
		)
		sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
			for _, p := range preds {
				p(s)
			}
		})
	})
}

// HasTotpCredential applies the HasEdge predicate on the "totpCredential" edge.
func HasTotpCredential() predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, TotpCredentialTable, TotpCredentialColumn),
		)
		sqlgraph.HasNeighbors(s, step)
	})
}

// HasTotpCredentialWith applies the HasEdge predicate on the "totpCredential" edge with a given conditions (other predicates).
func HasTotpCredentialWith(preds ...predicate.TotpCredential) predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		step := sqlgraph.NewStep(
			sqlgraph.From(Table, FieldID),
			sqlgraph.To(TotpCredentialInverseTable, FieldID),
			sqlgraph.Edge(sqlgraph.O2O, false, TotpCredentialTable, TotpCredentialColumn),
		)
		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.Challenge) predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		s1 := s.Clone().SetP(nil)
		for _, p := range predicates {
			p(s1)
		}
		s.Where(s1.P())
	})
}

// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.Challenge) predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		s1 := s.Clone().SetP(nil)
		for i, p := range predicates {
			if i > 0 {
				s1.Or()
			}
			p(s1)
		}
		s.Where(s1.P())
	})
}

// Not applies the not operator on the given predicate.
func Not(p predicate.Challenge) predicate.Challenge {
	return predicate.Challenge(func(s *sql.Selector) {
		p(s.Not())
	})
}
