// Code generated by ent, DO NOT EDIT.

package agent

import (
	"time"

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

const (
	// Label holds the string label denoting the agent type in the database.
	Label = "agent"
	// 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"
	// FieldRole holds the string denoting the role field in the database.
	FieldRole = "role"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldBackground holds the string denoting the background field in the database.
	FieldBackground = "background"
	// FieldExamples holds the string denoting the examples field in the database.
	FieldExamples = "examples"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// FieldDatasetID holds the string denoting the dataset_id field in the database.
	FieldDatasetID = "dataset_id"
	// FieldCollectionID holds the string denoting the collection_id field in the database.
	FieldCollectionID = "collection_id"
	// EdgeWxAgent holds the string denoting the wx_agent edge name in mutations.
	EdgeWxAgent = "wx_agent"
	// EdgeTokenAgent holds the string denoting the token_agent edge name in mutations.
	EdgeTokenAgent = "token_agent"
	// EdgeWaAgent holds the string denoting the wa_agent edge name in mutations.
	EdgeWaAgent = "wa_agent"
	// EdgeKeyAgent holds the string denoting the key_agent edge name in mutations.
	EdgeKeyAgent = "key_agent"
	// Table holds the table name of the agent in the database.
	Table = "agent"
	// WxAgentTable is the table that holds the wx_agent relation/edge.
	WxAgentTable = "wx"
	// WxAgentInverseTable is the table name for the Wx entity.
	// It exists in this package in order to avoid circular dependency with the "wx" package.
	WxAgentInverseTable = "wx"
	// WxAgentColumn is the table column denoting the wx_agent relation/edge.
	WxAgentColumn = "agent_id"
	// TokenAgentTable is the table that holds the token_agent relation/edge.
	TokenAgentTable = "token"
	// TokenAgentInverseTable is the table name for the Token entity.
	// It exists in this package in order to avoid circular dependency with the "token" package.
	TokenAgentInverseTable = "token"
	// TokenAgentColumn is the table column denoting the token_agent relation/edge.
	TokenAgentColumn = "agent_id"
	// WaAgentTable is the table that holds the wa_agent relation/edge.
	WaAgentTable = "whatsapp"
	// WaAgentInverseTable is the table name for the Whatsapp entity.
	// It exists in this package in order to avoid circular dependency with the "whatsapp" package.
	WaAgentInverseTable = "whatsapp"
	// WaAgentColumn is the table column denoting the wa_agent relation/edge.
	WaAgentColumn = "agent_id"
	// KeyAgentTable is the table that holds the key_agent relation/edge.
	KeyAgentTable = "api_key"
	// KeyAgentInverseTable is the table name for the ApiKey entity.
	// It exists in this package in order to avoid circular dependency with the "apikey" package.
	KeyAgentInverseTable = "api_key"
	// KeyAgentColumn is the table column denoting the key_agent relation/edge.
	KeyAgentColumn = "agent_id"
)

// Columns holds all SQL columns for agent fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldName,
	FieldRole,
	FieldStatus,
	FieldBackground,
	FieldExamples,
	FieldOrganizationID,
	FieldDatasetID,
	FieldCollectionID,
}

// 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
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// DefaultStatus holds the default value on creation for the "status" field.
	DefaultStatus int
	// StatusValidator is a validator for the "status" field. It is called by the builders before save.
	StatusValidator func(int) error
	// DefaultBackground holds the default value on creation for the "background" field.
	DefaultBackground string
	// DefaultExamples holds the default value on creation for the "examples" field.
	DefaultExamples string
	// OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
	OrganizationIDValidator func(uint64) error
	// DefaultDatasetID holds the default value on creation for the "dataset_id" field.
	DefaultDatasetID string
	// DatasetIDValidator is a validator for the "dataset_id" field. It is called by the builders before save.
	DatasetIDValidator func(string) error
	// DefaultCollectionID holds the default value on creation for the "collection_id" field.
	DefaultCollectionID string
	// CollectionIDValidator is a validator for the "collection_id" field. It is called by the builders before save.
	CollectionIDValidator func(string) error
)

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

// ByRole orders the results by the role field.
func ByRole(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRole, opts...).ToFunc()
}

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

// ByBackground orders the results by the background field.
func ByBackground(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBackground, opts...).ToFunc()
}

// ByExamples orders the results by the examples field.
func ByExamples(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldExamples, opts...).ToFunc()
}

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

// ByDatasetID orders the results by the dataset_id field.
func ByDatasetID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDatasetID, opts...).ToFunc()
}

// ByCollectionID orders the results by the collection_id field.
func ByCollectionID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCollectionID, opts...).ToFunc()
}

// ByWxAgentCount orders the results by wx_agent count.
func ByWxAgentCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newWxAgentStep(), opts...)
	}
}

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

// ByTokenAgentCount orders the results by token_agent count.
func ByTokenAgentCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newTokenAgentStep(), opts...)
	}
}

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

// ByWaAgentCount orders the results by wa_agent count.
func ByWaAgentCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newWaAgentStep(), opts...)
	}
}

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

// ByKeyAgentCount orders the results by key_agent count.
func ByKeyAgentCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newKeyAgentStep(), opts...)
	}
}

// ByKeyAgent orders the results by key_agent terms.
func ByKeyAgent(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newKeyAgentStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newWxAgentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(WxAgentInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, WxAgentTable, WxAgentColumn),
	)
}
func newTokenAgentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TokenAgentInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, TokenAgentTable, TokenAgentColumn),
	)
}
func newWaAgentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(WaAgentInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, WaAgentTable, WaAgentColumn),
	)
}
func newKeyAgentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(KeyAgentInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, KeyAgentTable, KeyAgentColumn),
	)
}
