// Code generated by ent, DO NOT EDIT.

package authidentity

import (
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
)

const (
	// Label holds the string label denoting the authidentity type in the database.
	Label = "auth_identity"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
	FieldUpdatedAt = "updated_at"
	// FieldUserID holds the string denoting the user_id field in the database.
	FieldUserID = "user_id"
	// FieldProviderType holds the string denoting the provider_type field in the database.
	FieldProviderType = "provider_type"
	// FieldProviderKey holds the string denoting the provider_key field in the database.
	FieldProviderKey = "provider_key"
	// FieldProviderSubject holds the string denoting the provider_subject field in the database.
	FieldProviderSubject = "provider_subject"
	// FieldVerifiedAt holds the string denoting the verified_at field in the database.
	FieldVerifiedAt = "verified_at"
	// FieldIssuer holds the string denoting the issuer field in the database.
	FieldIssuer = "issuer"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// EdgeUser holds the string denoting the user edge name in mutations.
	EdgeUser = "user"
	// EdgeChannels holds the string denoting the channels edge name in mutations.
	EdgeChannels = "channels"
	// EdgeAdoptionDecisions holds the string denoting the adoption_decisions edge name in mutations.
	EdgeAdoptionDecisions = "adoption_decisions"
	// Table holds the table name of the authidentity in the database.
	Table = "auth_identities"
	// UserTable is the table that holds the user relation/edge.
	UserTable = "auth_identities"
	// UserInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	UserInverseTable = "users"
	// UserColumn is the table column denoting the user relation/edge.
	UserColumn = "user_id"
	// ChannelsTable is the table that holds the channels relation/edge.
	ChannelsTable = "auth_identity_channels"
	// ChannelsInverseTable is the table name for the AuthIdentityChannel entity.
	// It exists in this package in order to avoid circular dependency with the "authidentitychannel" package.
	ChannelsInverseTable = "auth_identity_channels"
	// ChannelsColumn is the table column denoting the channels relation/edge.
	ChannelsColumn = "identity_id"
	// AdoptionDecisionsTable is the table that holds the adoption_decisions relation/edge.
	AdoptionDecisionsTable = "identity_adoption_decisions"
	// AdoptionDecisionsInverseTable is the table name for the IdentityAdoptionDecision entity.
	// It exists in this package in order to avoid circular dependency with the "identityadoptiondecision" package.
	AdoptionDecisionsInverseTable = "identity_adoption_decisions"
	// AdoptionDecisionsColumn is the table column denoting the adoption_decisions relation/edge.
	AdoptionDecisionsColumn = "identity_id"
)

// Columns holds all SQL columns for authidentity fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldUserID,
	FieldProviderType,
	FieldProviderKey,
	FieldProviderSubject,
	FieldVerifiedAt,
	FieldIssuer,
	FieldMetadata,
}

// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
	for i := range Columns {
		if column == Columns[i] {
			return true
		}
	}
	return false
}

var (
	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
	DefaultCreatedAt func() time.Time
	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
	DefaultUpdatedAt func() time.Time
	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
	UpdateDefaultUpdatedAt func() time.Time
	// ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
	ProviderTypeValidator func(string) error
	// ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
	ProviderKeyValidator func(string) error
	// ProviderSubjectValidator is a validator for the "provider_subject" field. It is called by the builders before save.
	ProviderSubjectValidator func(string) error
	// DefaultMetadata holds the default value on creation for the "metadata" field.
	DefaultMetadata func() map[string]interface{}
)

// OrderOption defines the ordering options for the AuthIdentity queries.
type OrderOption func(*sql.Selector)

// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldID, opts...).ToFunc()
}

// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}

// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}

// ByUserID orders the results by the user_id field.
func ByUserID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUserID, opts...).ToFunc()
}

// ByProviderType orders the results by the provider_type field.
func ByProviderType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProviderType, opts...).ToFunc()
}

// ByProviderKey orders the results by the provider_key field.
func ByProviderKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProviderKey, opts...).ToFunc()
}

// ByProviderSubject orders the results by the provider_subject field.
func ByProviderSubject(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProviderSubject, opts...).ToFunc()
}

// ByVerifiedAt orders the results by the verified_at field.
func ByVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldVerifiedAt, opts...).ToFunc()
}

// ByIssuer orders the results by the issuer field.
func ByIssuer(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIssuer, opts...).ToFunc()
}

// ByUserField orders the results by user field.
func ByUserField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newUserStep(), sql.OrderByField(field, opts...))
	}
}

// ByChannelsCount orders the results by channels count.
func ByChannelsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newChannelsStep(), opts...)
	}
}

// ByChannels orders the results by channels terms.
func ByChannels(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newChannelsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}

// ByAdoptionDecisionsCount orders the results by adoption_decisions count.
func ByAdoptionDecisionsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newAdoptionDecisionsStep(), opts...)
	}
}

// ByAdoptionDecisions orders the results by adoption_decisions terms.
func ByAdoptionDecisions(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newAdoptionDecisionsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newUserStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UserInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
	)
}
func newChannelsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ChannelsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ChannelsTable, ChannelsColumn),
	)
}
func newAdoptionDecisionsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AdoptionDecisionsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, AdoptionDecisionsTable, AdoptionDecisionsColumn),
	)
}
