// Code generated by ent, DO NOT EDIT.

package guild

import (
	"fmt"

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

const (
	// Label holds the string label denoting the guild type in the database.
	Label = "guild"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldIconHash holds the string denoting the icon_hash field in the database.
	FieldIconHash = "icon_hash"
	// FieldAuditChannel holds the string denoting the audit_channel field in the database.
	FieldAuditChannel = "audit_channel"
	// FieldLanguage holds the string denoting the language field in the database.
	FieldLanguage = "language"
	// FieldAdminSnowflakes holds the string denoting the admin_snowflakes field in the database.
	FieldAdminSnowflakes = "admin_snowflakes"
	// FieldModeratorSnowflakes holds the string denoting the moderator_snowflakes field in the database.
	FieldModeratorSnowflakes = "moderator_snowflakes"
	// FieldSettings holds the string denoting the settings field in the database.
	FieldSettings = "settings"
	// EdgeMembers holds the string denoting the members edge name in mutations.
	EdgeMembers = "members"
	// EdgeAdmins holds the string denoting the admins edge name in mutations.
	EdgeAdmins = "admins"
	// EdgeRoles holds the string denoting the roles edge name in mutations.
	EdgeRoles = "roles"
	// EdgeYoutubeTalents holds the string denoting the youtube_talents edge name in mutations.
	EdgeYoutubeTalents = "youtube_talents"
	// Table holds the table name of the guild in the database.
	Table = "guilds"
	// MembersTable is the table that holds the members relation/edge. The primary key declared below.
	MembersTable = "guild_members"
	// MembersInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	MembersInverseTable = "users"
	// AdminsTable is the table that holds the admins relation/edge. The primary key declared below.
	AdminsTable = "guild_admins"
	// AdminsInverseTable is the table name for the User entity.
	// It exists in this package in order to avoid circular dependency with the "user" package.
	AdminsInverseTable = "users"
	// RolesTable is the table that holds the roles relation/edge.
	RolesTable = "guild_roles"
	// RolesInverseTable is the table name for the GuildRole entity.
	// It exists in this package in order to avoid circular dependency with the "guildrole" package.
	RolesInverseTable = "guild_roles"
	// RolesColumn is the table column denoting the roles relation/edge.
	RolesColumn = "guild_roles"
	// YoutubeTalentsTable is the table that holds the youtube_talents relation/edge. The primary key declared below.
	YoutubeTalentsTable = "you_tube_talent_guilds"
	// YoutubeTalentsInverseTable is the table name for the YouTubeTalent entity.
	// It exists in this package in order to avoid circular dependency with the "youtubetalent" package.
	YoutubeTalentsInverseTable = "you_tube_talents"
)

// Columns holds all SQL columns for guild fields.
var Columns = []string{
	FieldID,
	FieldName,
	FieldIconHash,
	FieldAuditChannel,
	FieldLanguage,
	FieldAdminSnowflakes,
	FieldModeratorSnowflakes,
	FieldSettings,
}

var (
	// MembersPrimaryKey and MembersColumn2 are the table columns denoting the
	// primary key for the members relation (M2M).
	MembersPrimaryKey = []string{"guild_id", "user_id"}
	// AdminsPrimaryKey and AdminsColumn2 are the table columns denoting the
	// primary key for the admins relation (M2M).
	AdminsPrimaryKey = []string{"guild_id", "user_id"}
	// YoutubeTalentsPrimaryKey and YoutubeTalentsColumn2 are the table columns denoting the
	// primary key for the youtube_talents relation (M2M).
	YoutubeTalentsPrimaryKey = []string{"you_tube_talent_id", "guild_id"}
)

// 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
}

// Language defines the type for the "language" enum field.
type Language string

// LanguageEnUS is the default value of the Language enum.
const DefaultLanguage = LanguageEnUS

// Language values.
const (
	LanguageEnUS Language = "en-US"
)

func (l Language) String() string {
	return string(l)
}

// LanguageValidator is a validator for the "language" field enum values. It is called by the builders before save.
func LanguageValidator(l Language) error {
	switch l {
	case LanguageEnUS:
		return nil
	default:
		return fmt.Errorf("guild: invalid enum value for language field: %q", l)
	}
}

// OrderOption defines the ordering options for the Guild 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()
}

// ByName orders the results by the name field.
func ByName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldName, opts...).ToFunc()
}

// ByIconHash orders the results by the icon_hash field.
func ByIconHash(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIconHash, opts...).ToFunc()
}

// ByAuditChannel orders the results by the audit_channel field.
func ByAuditChannel(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAuditChannel, opts...).ToFunc()
}

// ByLanguage orders the results by the language field.
func ByLanguage(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLanguage, opts...).ToFunc()
}

// ByMembersCount orders the results by members count.
func ByMembersCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newMembersStep(), opts...)
	}
}

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

// ByAdminsCount orders the results by admins count.
func ByAdminsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newAdminsStep(), opts...)
	}
}

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

// ByRolesCount orders the results by roles count.
func ByRolesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newRolesStep(), opts...)
	}
}

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

// ByYoutubeTalentsCount orders the results by youtube_talents count.
func ByYoutubeTalentsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newYoutubeTalentsStep(), opts...)
	}
}

// ByYoutubeTalents orders the results by youtube_talents terms.
func ByYoutubeTalents(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newYoutubeTalentsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newMembersStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(MembersInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2M, false, MembersTable, MembersPrimaryKey...),
	)
}
func newAdminsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AdminsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2M, false, AdminsTable, AdminsPrimaryKey...),
	)
}
func newRolesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(RolesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, RolesTable, RolesColumn),
	)
}
func newYoutubeTalentsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(YoutubeTalentsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2M, true, YoutubeTalentsTable, YoutubeTalentsPrimaryKey...),
	)
}
