// Code generated by ent, DO NOT EDIT.

package account

import (
	"time"

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

const (
	// Label holds the string label denoting the account type in the database.
	Label = "account"
	// 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"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldNotes holds the string denoting the notes field in the database.
	FieldNotes = "notes"
	// FieldPlatform holds the string denoting the platform field in the database.
	FieldPlatform = "platform"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldCredentials holds the string denoting the credentials field in the database.
	FieldCredentials = "credentials"
	// FieldExtra holds the string denoting the extra field in the database.
	FieldExtra = "extra"
	// FieldProxyID holds the string denoting the proxy_id field in the database.
	FieldProxyID = "proxy_id"
	// FieldConcurrency holds the string denoting the concurrency field in the database.
	FieldConcurrency = "concurrency"
	// FieldPriority holds the string denoting the priority field in the database.
	FieldPriority = "priority"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldErrorMessage holds the string denoting the error_message field in the database.
	FieldErrorMessage = "error_message"
	// FieldLastUsedAt holds the string denoting the last_used_at field in the database.
	FieldLastUsedAt = "last_used_at"
	// FieldSchedulable holds the string denoting the schedulable field in the database.
	FieldSchedulable = "schedulable"
	// FieldRateLimitedAt holds the string denoting the rate_limited_at field in the database.
	FieldRateLimitedAt = "rate_limited_at"
	// FieldRateLimitResetAt holds the string denoting the rate_limit_reset_at field in the database.
	FieldRateLimitResetAt = "rate_limit_reset_at"
	// FieldOverloadUntil holds the string denoting the overload_until field in the database.
	FieldOverloadUntil = "overload_until"
	// FieldSessionWindowStart holds the string denoting the session_window_start field in the database.
	FieldSessionWindowStart = "session_window_start"
	// FieldSessionWindowEnd holds the string denoting the session_window_end field in the database.
	FieldSessionWindowEnd = "session_window_end"
	// FieldSessionWindowStatus holds the string denoting the session_window_status field in the database.
	FieldSessionWindowStatus = "session_window_status"
	// EdgeGroups holds the string denoting the groups edge name in mutations.
	EdgeGroups = "groups"
	// EdgeProxy holds the string denoting the proxy edge name in mutations.
	EdgeProxy = "proxy"
	// EdgeUsageLogs holds the string denoting the usage_logs edge name in mutations.
	EdgeUsageLogs = "usage_logs"
	// EdgeAccountGroups holds the string denoting the account_groups edge name in mutations.
	EdgeAccountGroups = "account_groups"
	// Table holds the table name of the account in the database.
	Table = "accounts"
	// GroupsTable is the table that holds the groups relation/edge. The primary key declared below.
	GroupsTable = "account_groups"
	// GroupsInverseTable is the table name for the Group entity.
	// It exists in this package in order to avoid circular dependency with the "group" package.
	GroupsInverseTable = "groups"
	// ProxyTable is the table that holds the proxy relation/edge.
	ProxyTable = "accounts"
	// ProxyInverseTable is the table name for the Proxy entity.
	// It exists in this package in order to avoid circular dependency with the "proxy" package.
	ProxyInverseTable = "proxies"
	// ProxyColumn is the table column denoting the proxy relation/edge.
	ProxyColumn = "proxy_id"
	// UsageLogsTable is the table that holds the usage_logs relation/edge.
	UsageLogsTable = "usage_logs"
	// UsageLogsInverseTable is the table name for the UsageLog entity.
	// It exists in this package in order to avoid circular dependency with the "usagelog" package.
	UsageLogsInverseTable = "usage_logs"
	// UsageLogsColumn is the table column denoting the usage_logs relation/edge.
	UsageLogsColumn = "account_id"
	// AccountGroupsTable is the table that holds the account_groups relation/edge.
	AccountGroupsTable = "account_groups"
	// AccountGroupsInverseTable is the table name for the AccountGroup entity.
	// It exists in this package in order to avoid circular dependency with the "accountgroup" package.
	AccountGroupsInverseTable = "account_groups"
	// AccountGroupsColumn is the table column denoting the account_groups relation/edge.
	AccountGroupsColumn = "account_id"
)

// Columns holds all SQL columns for account fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldName,
	FieldNotes,
	FieldPlatform,
	FieldType,
	FieldCredentials,
	FieldExtra,
	FieldProxyID,
	FieldConcurrency,
	FieldPriority,
	FieldStatus,
	FieldErrorMessage,
	FieldLastUsedAt,
	FieldSchedulable,
	FieldRateLimitedAt,
	FieldRateLimitResetAt,
	FieldOverloadUntil,
	FieldSessionWindowStart,
	FieldSessionWindowEnd,
	FieldSessionWindowStatus,
}

var (
	// GroupsPrimaryKey and GroupsColumn2 are the table columns denoting the
	// primary key for the groups relation (M2M).
	GroupsPrimaryKey = []string{"account_id", "group_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
}

// Note that the variables below are initialized by the runtime
// package on the initialization of the application. Therefore,
// it should be imported in the main as follows:
//
//	import _ "github.com/Wei-Shaw/sub2api/ent/runtime"
var (
	Hooks        [1]ent.Hook
	Interceptors [1]ent.Interceptor
	// 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
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// PlatformValidator is a validator for the "platform" field. It is called by the builders before save.
	PlatformValidator func(string) error
	// TypeValidator is a validator for the "type" field. It is called by the builders before save.
	TypeValidator func(string) error
	// DefaultCredentials holds the default value on creation for the "credentials" field.
	DefaultCredentials func() map[string]interface{}
	// DefaultExtra holds the default value on creation for the "extra" field.
	DefaultExtra func() map[string]interface{}
	// DefaultConcurrency holds the default value on creation for the "concurrency" field.
	DefaultConcurrency int
	// DefaultPriority holds the default value on creation for the "priority" field.
	DefaultPriority int
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus string
	// StatusValidator is a validator for the "status" field. It is called by the builders before save.
	StatusValidator func(string) error
	// DefaultSchedulable holds the default value on creation for the "schedulable" field.
	DefaultSchedulable bool
	// SessionWindowStatusValidator is a validator for the "session_window_status" field. It is called by the builders before save.
	SessionWindowStatusValidator func(string) error
)

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

// ByDeletedAt orders the results by the deleted_at field.
func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
}

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

// ByNotes orders the results by the notes field.
func ByNotes(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNotes, opts...).ToFunc()
}

// ByPlatform orders the results by the platform field.
func ByPlatform(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPlatform, opts...).ToFunc()
}

// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldType, opts...).ToFunc()
}

// ByProxyID orders the results by the proxy_id field.
func ByProxyID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProxyID, opts...).ToFunc()
}

// ByConcurrency orders the results by the concurrency field.
func ByConcurrency(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldConcurrency, opts...).ToFunc()
}

// ByPriority orders the results by the priority field.
func ByPriority(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPriority, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByErrorMessage orders the results by the error_message field.
func ByErrorMessage(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldErrorMessage, opts...).ToFunc()
}

// ByLastUsedAt orders the results by the last_used_at field.
func ByLastUsedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLastUsedAt, opts...).ToFunc()
}

// BySchedulable orders the results by the schedulable field.
func BySchedulable(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSchedulable, opts...).ToFunc()
}

// ByRateLimitedAt orders the results by the rate_limited_at field.
func ByRateLimitedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRateLimitedAt, opts...).ToFunc()
}

// ByRateLimitResetAt orders the results by the rate_limit_reset_at field.
func ByRateLimitResetAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRateLimitResetAt, opts...).ToFunc()
}

// ByOverloadUntil orders the results by the overload_until field.
func ByOverloadUntil(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOverloadUntil, opts...).ToFunc()
}

// BySessionWindowStart orders the results by the session_window_start field.
func BySessionWindowStart(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSessionWindowStart, opts...).ToFunc()
}

// BySessionWindowEnd orders the results by the session_window_end field.
func BySessionWindowEnd(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSessionWindowEnd, opts...).ToFunc()
}

// BySessionWindowStatus orders the results by the session_window_status field.
func BySessionWindowStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSessionWindowStatus, opts...).ToFunc()
}

// ByGroupsCount orders the results by groups count.
func ByGroupsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newGroupsStep(), opts...)
	}
}

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

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

// ByUsageLogsCount orders the results by usage_logs count.
func ByUsageLogsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newUsageLogsStep(), opts...)
	}
}

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

// ByAccountGroupsCount orders the results by account_groups count.
func ByAccountGroupsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newAccountGroupsStep(), opts...)
	}
}

// ByAccountGroups orders the results by account_groups terms.
func ByAccountGroups(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newAccountGroupsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newGroupsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(GroupsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2M, false, GroupsTable, GroupsPrimaryKey...),
	)
}
func newProxyStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ProxyInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, false, ProxyTable, ProxyColumn),
	)
}
func newUsageLogsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(UsageLogsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, UsageLogsTable, UsageLogsColumn),
	)
}
func newAccountGroupsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AccountGroupsInverseTable, AccountGroupsColumn),
		sqlgraph.Edge(sqlgraph.O2M, true, AccountGroupsTable, AccountGroupsColumn),
	)
}
