// Code generated by ent, DO NOT EDIT.

package wx

import (
	"time"

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

const (
	// Label holds the string label denoting the wx type in the database.
	Label = "wx"
	// 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"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
	FieldDeletedAt = "deleted_at"
	// FieldServerID holds the string denoting the server_id field in the database.
	FieldServerID = "server_id"
	// FieldPort holds the string denoting the port field in the database.
	FieldPort = "port"
	// FieldProcessID holds the string denoting the process_id field in the database.
	FieldProcessID = "process_id"
	// FieldCallback holds the string denoting the callback field in the database.
	FieldCallback = "callback"
	// FieldWxid holds the string denoting the wxid field in the database.
	FieldWxid = "wxid"
	// FieldAccount holds the string denoting the account field in the database.
	FieldAccount = "account"
	// FieldNickname holds the string denoting the nickname field in the database.
	FieldNickname = "nickname"
	// FieldTel holds the string denoting the tel field in the database.
	FieldTel = "tel"
	// FieldHeadBig holds the string denoting the head_big field in the database.
	FieldHeadBig = "head_big"
	// 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"
	// FieldAPIBase holds the string denoting the api_base field in the database.
	FieldAPIBase = "api_base"
	// FieldAPIKey holds the string denoting the api_key field in the database.
	FieldAPIKey = "api_key"
	// FieldAllowList holds the string denoting the allow_list field in the database.
	FieldAllowList = "allow_list"
	// FieldGroupAllowList holds the string denoting the group_allow_list field in the database.
	FieldGroupAllowList = "group_allow_list"
	// FieldBlockList holds the string denoting the block_list field in the database.
	FieldBlockList = "block_list"
	// FieldGroupBlockList holds the string denoting the group_block_list field in the database.
	FieldGroupBlockList = "group_block_list"
	// FieldCtype holds the string denoting the ctype field in the database.
	FieldCtype = "ctype"
	// EdgeServer holds the string denoting the server edge name in mutations.
	EdgeServer = "server"
	// EdgeAgent holds the string denoting the agent edge name in mutations.
	EdgeAgent = "agent"
	// Table holds the table name of the wx in the database.
	Table = "wx"
	// ServerTable is the table that holds the server relation/edge.
	ServerTable = "wx"
	// ServerInverseTable is the table name for the Server entity.
	// It exists in this package in order to avoid circular dependency with the "server" package.
	ServerInverseTable = "server"
	// ServerColumn is the table column denoting the server relation/edge.
	ServerColumn = "server_id"
	// AgentTable is the table that holds the agent relation/edge.
	AgentTable = "wx"
	// 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 wx fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldServerID,
	FieldPort,
	FieldProcessID,
	FieldCallback,
	FieldWxid,
	FieldAccount,
	FieldNickname,
	FieldTel,
	FieldHeadBig,
	FieldOrganizationID,
	FieldAgentID,
	FieldAPIBase,
	FieldAPIKey,
	FieldAllowList,
	FieldGroupAllowList,
	FieldBlockList,
	FieldGroupBlockList,
	FieldCtype,
}

// ForeignKeys holds the SQL foreign-keys that are owned by the "wx"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
	"agent_base_wx_agent",
}

// 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
		}
	}
	for i := range ForeignKeys {
		if column == ForeignKeys[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
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus uint8
	// DefaultServerID holds the default value on creation for the "server_id" field.
	DefaultServerID uint64
	// DefaultPort holds the default value on creation for the "port" field.
	DefaultPort string
	// DefaultProcessID holds the default value on creation for the "process_id" field.
	DefaultProcessID string
	// DefaultCallback holds the default value on creation for the "callback" field.
	DefaultCallback string
	// DefaultWxid holds the default value on creation for the "wxid" field.
	DefaultWxid string
	// DefaultAccount holds the default value on creation for the "account" field.
	DefaultAccount string
	// DefaultNickname holds the default value on creation for the "nickname" field.
	DefaultNickname string
	// DefaultTel holds the default value on creation for the "tel" field.
	DefaultTel string
	// DefaultHeadBig holds the default value on creation for the "head_big" field.
	DefaultHeadBig 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
	// DefaultAPIBase holds the default value on creation for the "api_base" field.
	DefaultAPIBase string
	// DefaultAPIKey holds the default value on creation for the "api_key" field.
	DefaultAPIKey string
	// DefaultCtype holds the default value on creation for the "ctype" field.
	DefaultCtype uint64
)

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

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

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

// ByServerID orders the results by the server_id field.
func ByServerID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldServerID, opts...).ToFunc()
}

// ByPort orders the results by the port field.
func ByPort(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPort, opts...).ToFunc()
}

// ByProcessID orders the results by the process_id field.
func ByProcessID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProcessID, opts...).ToFunc()
}

// ByCallback orders the results by the callback field.
func ByCallback(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCallback, opts...).ToFunc()
}

// ByWxid orders the results by the wxid field.
func ByWxid(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWxid, opts...).ToFunc()
}

// ByAccount orders the results by the account field.
func ByAccount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAccount, opts...).ToFunc()
}

// ByNickname orders the results by the nickname field.
func ByNickname(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNickname, opts...).ToFunc()
}

// ByTel orders the results by the tel field.
func ByTel(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTel, opts...).ToFunc()
}

// ByHeadBig orders the results by the head_big field.
func ByHeadBig(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldHeadBig, 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()
}

// ByAPIBase orders the results by the api_base field.
func ByAPIBase(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAPIBase, opts...).ToFunc()
}

// ByAPIKey orders the results by the api_key field.
func ByAPIKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAPIKey, opts...).ToFunc()
}

// ByCtype orders the results by the ctype field.
func ByCtype(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCtype, opts...).ToFunc()
}

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

// 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 newServerStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ServerInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, ServerTable, ServerColumn),
	)
}
func newAgentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AgentInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, AgentTable, AgentColumn),
	)
}
