// Code generated by ent, DO NOT EDIT.

package whatsapp

import (
	"time"

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

const (
	// Label holds the string label denoting the whatsapp type in the database.
	Label = "whatsapp"
	// 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"
	// FieldWaID holds the string denoting the wa_id field in the database.
	FieldWaID = "wa_id"
	// FieldWaName holds the string denoting the wa_name field in the database.
	FieldWaName = "wa_name"
	// FieldCallback holds the string denoting the callback field in the database.
	FieldCallback = "callback"
	// FieldAgentID holds the string denoting the agent_id field in the database.
	FieldAgentID = "agent_id"
	// FieldAccount holds the string denoting the account field in the database.
	FieldAccount = "account"
	// FieldCc holds the string denoting the cc field in the database.
	FieldCc = "cc"
	// FieldPhone holds the string denoting the phone field in the database.
	FieldPhone = "phone"
	// FieldCcPhone holds the string denoting the cc_phone field in the database.
	FieldCcPhone = "cc_phone"
	// FieldPhoneName holds the string denoting the phone_name field in the database.
	FieldPhoneName = "phone_name"
	// FieldPhoneStatus holds the string denoting the phone_status field in the database.
	FieldPhoneStatus = "phone_status"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_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"
	// EdgeAgent holds the string denoting the agent edge name in mutations.
	EdgeAgent = "agent"
	// Table holds the table name of the whatsapp in the database.
	Table = "whatsapp"
	// AgentTable is the table that holds the agent relation/edge.
	AgentTable = "whatsapp"
	// 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 whatsapp fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldWaID,
	FieldWaName,
	FieldCallback,
	FieldAgentID,
	FieldAccount,
	FieldCc,
	FieldPhone,
	FieldCcPhone,
	FieldPhoneName,
	FieldPhoneStatus,
	FieldOrganizationID,
	FieldAPIBase,
	FieldAPIKey,
	FieldAllowList,
	FieldGroupAllowList,
	FieldBlockList,
	FieldGroupBlockList,
}

// 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
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus uint8
	// DefaultWaID holds the default value on creation for the "wa_id" field.
	DefaultWaID string
	// DefaultWaName holds the default value on creation for the "wa_name" field.
	DefaultWaName string
	// DefaultCallback holds the default value on creation for the "callback" field.
	DefaultCallback string
	// DefaultAgentID holds the default value on creation for the "agent_id" field.
	DefaultAgentID uint64
	// DefaultAccount holds the default value on creation for the "account" field.
	DefaultAccount string
	// DefaultCc holds the default value on creation for the "cc" field.
	DefaultCc string
	// DefaultPhone holds the default value on creation for the "phone" field.
	DefaultPhone string
	// DefaultCcPhone holds the default value on creation for the "cc_phone" field.
	DefaultCcPhone string
	// DefaultPhoneName holds the default value on creation for the "phone_name" field.
	DefaultPhoneName string
	// DefaultPhoneStatus holds the default value on creation for the "phone_status" field.
	DefaultPhoneStatus int8
	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
	DefaultOrganizationID 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
)

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

// ByWaID orders the results by the wa_id field.
func ByWaID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWaID, opts...).ToFunc()
}

// ByWaName orders the results by the wa_name field.
func ByWaName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldWaName, opts...).ToFunc()
}

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

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

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

// ByCc orders the results by the cc field.
func ByCc(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCc, opts...).ToFunc()
}

// ByPhone orders the results by the phone field.
func ByPhone(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPhone, opts...).ToFunc()
}

// ByCcPhone orders the results by the cc_phone field.
func ByCcPhone(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCcPhone, opts...).ToFunc()
}

// ByPhoneName orders the results by the phone_name field.
func ByPhoneName(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPhoneName, opts...).ToFunc()
}

// ByPhoneStatus orders the results by the phone_status field.
func ByPhoneStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPhoneStatus, opts...).ToFunc()
}

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

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