// Code generated by ent, DO NOT EDIT.

package soptask

import (
	"time"

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

const (
	// Label holds the string label denoting the soptask type in the database.
	Label = "sop_task"
	// 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"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldBotWxidList holds the string denoting the bot_wxid_list field in the database.
	FieldBotWxidList = "bot_wxid_list"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldPlanStartTime holds the string denoting the plan_start_time field in the database.
	FieldPlanStartTime = "plan_start_time"
	// FieldPlanEndTime holds the string denoting the plan_end_time field in the database.
	FieldPlanEndTime = "plan_end_time"
	// FieldCreatorID holds the string denoting the creator_id field in the database.
	FieldCreatorID = "creator_id"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// FieldToken holds the string denoting the token field in the database.
	FieldToken = "token"
	// EdgeTaskStages holds the string denoting the task_stages edge name in mutations.
	EdgeTaskStages = "task_stages"
	// Table holds the table name of the soptask in the database.
	Table = "sop_task"
	// TaskStagesTable is the table that holds the task_stages relation/edge.
	TaskStagesTable = "sop_stage"
	// TaskStagesInverseTable is the table name for the SopStage entity.
	// It exists in this package in order to avoid circular dependency with the "sopstage" package.
	TaskStagesInverseTable = "sop_stage"
	// TaskStagesColumn is the table column denoting the task_stages relation/edge.
	TaskStagesColumn = "task_id"
)

// Columns holds all SQL columns for soptask fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldStatus,
	FieldDeletedAt,
	FieldName,
	FieldBotWxidList,
	FieldType,
	FieldPlanStartTime,
	FieldPlanEndTime,
	FieldCreatorID,
	FieldOrganizationID,
	FieldToken,
}

// 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
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// DefaultType holds the default value on creation for the "type" field.
	DefaultType int
	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
	DefaultOrganizationID uint64
)

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

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

// ByType orders the results by the type field.
func ByType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldType, opts...).ToFunc()
}

// ByPlanStartTime orders the results by the plan_start_time field.
func ByPlanStartTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPlanStartTime, opts...).ToFunc()
}

// ByPlanEndTime orders the results by the plan_end_time field.
func ByPlanEndTime(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPlanEndTime, opts...).ToFunc()
}

// ByCreatorID orders the results by the creator_id field.
func ByCreatorID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatorID, opts...).ToFunc()
}

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

// ByTaskStagesCount orders the results by task_stages count.
func ByTaskStagesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newTaskStagesStep(), opts...)
	}
}

// ByTaskStages orders the results by task_stages terms.
func ByTaskStages(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newTaskStagesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newTaskStagesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TaskStagesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, TaskStagesTable, TaskStagesColumn),
	)
}
