// Code generated by ent, DO NOT EDIT.

package userattributedefinition

import (
	"time"

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

const (
	// Label holds the string label denoting the userattributedefinition type in the database.
	Label = "user_attribute_definition"
	// 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"
	// FieldKey holds the string denoting the key field in the database.
	FieldKey = "key"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldDescription holds the string denoting the description field in the database.
	FieldDescription = "description"
	// FieldType holds the string denoting the type field in the database.
	FieldType = "type"
	// FieldOptions holds the string denoting the options field in the database.
	FieldOptions = "options"
	// FieldRequired holds the string denoting the required field in the database.
	FieldRequired = "required"
	// FieldValidation holds the string denoting the validation field in the database.
	FieldValidation = "validation"
	// FieldPlaceholder holds the string denoting the placeholder field in the database.
	FieldPlaceholder = "placeholder"
	// FieldDisplayOrder holds the string denoting the display_order field in the database.
	FieldDisplayOrder = "display_order"
	// FieldEnabled holds the string denoting the enabled field in the database.
	FieldEnabled = "enabled"
	// EdgeValues holds the string denoting the values edge name in mutations.
	EdgeValues = "values"
	// Table holds the table name of the userattributedefinition in the database.
	Table = "user_attribute_definitions"
	// ValuesTable is the table that holds the values relation/edge.
	ValuesTable = "user_attribute_values"
	// ValuesInverseTable is the table name for the UserAttributeValue entity.
	// It exists in this package in order to avoid circular dependency with the "userattributevalue" package.
	ValuesInverseTable = "user_attribute_values"
	// ValuesColumn is the table column denoting the values relation/edge.
	ValuesColumn = "attribute_id"
)

// Columns holds all SQL columns for userattributedefinition fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldDeletedAt,
	FieldKey,
	FieldName,
	FieldDescription,
	FieldType,
	FieldOptions,
	FieldRequired,
	FieldValidation,
	FieldPlaceholder,
	FieldDisplayOrder,
	FieldEnabled,
}

// 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 _ "github.com/Wei-Shaw/sub2api/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
	// KeyValidator is a validator for the "key" field. It is called by the builders before save.
	KeyValidator func(string) error
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// DefaultDescription holds the default value on creation for the "description" field.
	DefaultDescription string
	// TypeValidator is a validator for the "type" field. It is called by the builders before save.
	TypeValidator func(string) error
	// DefaultOptions holds the default value on creation for the "options" field.
	DefaultOptions []map[string]interface{}
	// DefaultRequired holds the default value on creation for the "required" field.
	DefaultRequired bool
	// DefaultValidation holds the default value on creation for the "validation" field.
	DefaultValidation map[string]interface{}
	// DefaultPlaceholder holds the default value on creation for the "placeholder" field.
	DefaultPlaceholder string
	// PlaceholderValidator is a validator for the "placeholder" field. It is called by the builders before save.
	PlaceholderValidator func(string) error
	// DefaultDisplayOrder holds the default value on creation for the "display_order" field.
	DefaultDisplayOrder int
	// DefaultEnabled holds the default value on creation for the "enabled" field.
	DefaultEnabled bool
)

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

// ByKey orders the results by the key field.
func ByKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldKey, opts...).ToFunc()
}

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

// ByDescription orders the results by the description field.
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDescription, opts...).ToFunc()
}

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

// ByRequired orders the results by the required field.
func ByRequired(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRequired, opts...).ToFunc()
}

// ByPlaceholder orders the results by the placeholder field.
func ByPlaceholder(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPlaceholder, opts...).ToFunc()
}

// ByDisplayOrder orders the results by the display_order field.
func ByDisplayOrder(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDisplayOrder, opts...).ToFunc()
}

// ByEnabled orders the results by the enabled field.
func ByEnabled(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEnabled, opts...).ToFunc()
}

// ByValuesCount orders the results by values count.
func ByValuesCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newValuesStep(), opts...)
	}
}

// ByValues orders the results by values terms.
func ByValues(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newValuesStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newValuesStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(ValuesInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, ValuesTable, ValuesColumn),
	)
}
