// Code generated by ent, DO NOT EDIT.

package sopnode

import (
	"time"

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

const (
	// Label holds the string label denoting the sopnode type in the database.
	Label = "sop_node"
	// 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"
	// FieldStageID holds the string denoting the stage_id field in the database.
	FieldStageID = "stage_id"
	// FieldParentID holds the string denoting the parent_id field in the database.
	FieldParentID = "parent_id"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldConditionType holds the string denoting the condition_type field in the database.
	FieldConditionType = "condition_type"
	// FieldConditionList holds the string denoting the condition_list field in the database.
	FieldConditionList = "condition_list"
	// FieldNoReplyCondition holds the string denoting the no_reply_condition field in the database.
	FieldNoReplyCondition = "no_reply_condition"
	// FieldNoReplyUnit holds the string denoting the no_reply_unit field in the database.
	FieldNoReplyUnit = "no_reply_unit"
	// FieldActionMessage holds the string denoting the action_message field in the database.
	FieldActionMessage = "action_message"
	// FieldActionLabelAdd holds the string denoting the action_label_add field in the database.
	FieldActionLabelAdd = "action_label_add"
	// FieldActionLabelDel holds the string denoting the action_label_del field in the database.
	FieldActionLabelDel = "action_label_del"
	// FieldActionForward holds the string denoting the action_forward field in the database.
	FieldActionForward = "action_forward"
	// EdgeSopStage holds the string denoting the sop_stage edge name in mutations.
	EdgeSopStage = "sop_stage"
	// EdgeNodeMessages holds the string denoting the node_messages edge name in mutations.
	EdgeNodeMessages = "node_messages"
	// Table holds the table name of the sopnode in the database.
	Table = "sop_node"
	// SopStageTable is the table that holds the sop_stage relation/edge.
	SopStageTable = "sop_node"
	// SopStageInverseTable is the table name for the SopStage entity.
	// It exists in this package in order to avoid circular dependency with the "sopstage" package.
	SopStageInverseTable = "sop_stage"
	// SopStageColumn is the table column denoting the sop_stage relation/edge.
	SopStageColumn = "stage_id"
	// NodeMessagesTable is the table that holds the node_messages relation/edge.
	NodeMessagesTable = "message_records"
	// NodeMessagesInverseTable is the table name for the MessageRecords entity.
	// It exists in this package in order to avoid circular dependency with the "messagerecords" package.
	NodeMessagesInverseTable = "message_records"
	// NodeMessagesColumn is the table column denoting the node_messages relation/edge.
	NodeMessagesColumn = "sub_source_id"
)

// Columns holds all SQL columns for sopnode fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldStageID,
	FieldParentID,
	FieldName,
	FieldConditionType,
	FieldConditionList,
	FieldNoReplyCondition,
	FieldNoReplyUnit,
	FieldActionMessage,
	FieldActionLabelAdd,
	FieldActionLabelDel,
	FieldActionForward,
}

// 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
	// DefaultName holds the default value on creation for the "name" field.
	DefaultName string
	// DefaultConditionType holds the default value on creation for the "condition_type" field.
	DefaultConditionType int
	// DefaultNoReplyCondition holds the default value on creation for the "no_reply_condition" field.
	DefaultNoReplyCondition uint64
	// DefaultNoReplyUnit holds the default value on creation for the "no_reply_unit" field.
	DefaultNoReplyUnit string
)

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

// ByStageID orders the results by the stage_id field.
func ByStageID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStageID, opts...).ToFunc()
}

// ByParentID orders the results by the parent_id field.
func ByParentID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldParentID, opts...).ToFunc()
}

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

// ByConditionType orders the results by the condition_type field.
func ByConditionType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldConditionType, opts...).ToFunc()
}

// ByNoReplyCondition orders the results by the no_reply_condition field.
func ByNoReplyCondition(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNoReplyCondition, opts...).ToFunc()
}

// ByNoReplyUnit orders the results by the no_reply_unit field.
func ByNoReplyUnit(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNoReplyUnit, opts...).ToFunc()
}

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

// ByNodeMessagesCount orders the results by node_messages count.
func ByNodeMessagesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newNodeMessagesStep(), opts...)
	}
}

// ByNodeMessages orders the results by node_messages terms.
func ByNodeMessages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newNodeMessagesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newSopStageStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(SopStageInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, SopStageTable, SopStageColumn),
	)
}
func newNodeMessagesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(NodeMessagesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, NodeMessagesTable, NodeMessagesColumn),
	)
}
