// Code generated by ent, DO NOT EDIT.

package token

import (
	"time"

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

const (
	// Label holds the string label denoting the token type in the database.
	Label = "token"
	// 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"
	// FieldExpireAt holds the string denoting the expire_at field in the database.
	FieldExpireAt = "expire_at"
	// FieldToken holds the string denoting the token field in the database.
	FieldToken = "token"
	// FieldMAC holds the string denoting the mac field in the database.
	FieldMAC = "mac"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// FieldAgentID holds the string denoting the agent_id field in the database.
	FieldAgentID = "agent_id"
	// FieldCustomAgentBase holds the string denoting the custom_agent_base field in the database.
	FieldCustomAgentBase = "custom_agent_base"
	// FieldCustomAgentKey holds the string denoting the custom_agent_key field in the database.
	FieldCustomAgentKey = "custom_agent_key"
	// FieldOpenaiBase holds the string denoting the openai_base field in the database.
	FieldOpenaiBase = "openai_base"
	// FieldOpenaiKey holds the string denoting the openai_key field in the database.
	FieldOpenaiKey = "openai_key"
	// EdgeAgent holds the string denoting the agent edge name in mutations.
	EdgeAgent = "agent"
	// Table holds the table name of the token in the database.
	Table = "token"
	// AgentTable is the table that holds the agent relation/edge.
	AgentTable = "token"
	// AgentInverseTable is the table name for the Agent entity.
	// It exists in this package in order to avoid circular dependency with the "agent" package.
	AgentInverseTable = "agent"
	// AgentColumn is the table column denoting the agent relation/edge.
	AgentColumn = "agent_id"
)

// Columns holds all SQL columns for token fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldExpireAt,
	FieldToken,
	FieldMAC,
	FieldOrganizationID,
	FieldAgentID,
	FieldCustomAgentBase,
	FieldCustomAgentKey,
	FieldOpenaiBase,
	FieldOpenaiKey,
}

// 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 _ "wechat-api/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
	// DefaultToken holds the default value on creation for the "token" field.
	DefaultToken string
	// DefaultMAC holds the default value on creation for the "mac" field.
	DefaultMAC string
	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
	DefaultOrganizationID uint64
	// DefaultAgentID holds the default value on creation for the "agent_id" field.
	DefaultAgentID uint64
	// DefaultCustomAgentBase holds the default value on creation for the "custom_agent_base" field.
	DefaultCustomAgentBase string
	// DefaultCustomAgentKey holds the default value on creation for the "custom_agent_key" field.
	DefaultCustomAgentKey string
	// DefaultOpenaiBase holds the default value on creation for the "openai_base" field.
	DefaultOpenaiBase string
	// DefaultOpenaiKey holds the default value on creation for the "openai_key" field.
	DefaultOpenaiKey string
)

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

// ByExpireAt orders the results by the expire_at field.
func ByExpireAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldExpireAt, opts...).ToFunc()
}

// ByToken orders the results by the token field.
func ByToken(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldToken, opts...).ToFunc()
}

// ByMAC orders the results by the mac field.
func ByMAC(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMAC, opts...).ToFunc()
}

// ByOrganizationID orders the results by the organization_id field.
func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
}

// ByAgentID orders the results by the agent_id field.
func ByAgentID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAgentID, opts...).ToFunc()
}

// ByCustomAgentBase orders the results by the custom_agent_base field.
func ByCustomAgentBase(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCustomAgentBase, opts...).ToFunc()
}

// ByCustomAgentKey orders the results by the custom_agent_key field.
func ByCustomAgentKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCustomAgentKey, opts...).ToFunc()
}

// ByOpenaiBase orders the results by the openai_base field.
func ByOpenaiBase(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOpenaiBase, opts...).ToFunc()
}

// ByOpenaiKey orders the results by the openai_key field.
func ByOpenaiKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOpenaiKey, opts...).ToFunc()
}

// ByAgentField orders the results by agent field.
func ByAgentField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newAgentStep(), sql.OrderByField(field, opts...))
	}
}
func newAgentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AgentInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, AgentTable, AgentColumn),
	)
}
