// Code generated by ent, DO NOT EDIT.

package emplacement

import (
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"github.com/google/uuid"
)

const (
	// Label holds the string label denoting the emplacement type in the database.
	Label = "emplacement"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldNom holds the string denoting the nom field in the database.
	FieldNom = "nom"
	// FieldParentID holds the string denoting the parent_id field in the database.
	FieldParentID = "parent_id"
	// FieldSlug holds the string denoting the slug field in the database.
	FieldSlug = "slug"
	// FieldPiece holds the string denoting the piece field in the database.
	FieldPiece = "piece"
	// FieldMeuble holds the string denoting the meuble field in the database.
	FieldMeuble = "meuble"
	// FieldNumeroBoite holds the string denoting the numero_boite field in the database.
	FieldNumeroBoite = "numero_boite"
	// FieldIcone holds the string denoting the icone field in the database.
	FieldIcone = "icone"
	// 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"
	// EdgeParent holds the string denoting the parent edge name in mutations.
	EdgeParent = "parent"
	// EdgeEnfants holds the string denoting the enfants edge name in mutations.
	EdgeEnfants = "enfants"
	// EdgeLiensObjets holds the string denoting the liens_objets edge name in mutations.
	EdgeLiensObjets = "liens_objets"
	// Table holds the table name of the emplacement in the database.
	Table = "emplacement"
	// ParentTable is the table that holds the parent relation/edge.
	ParentTable = "emplacement"
	// ParentColumn is the table column denoting the parent relation/edge.
	ParentColumn = "parent_id"
	// EnfantsTable is the table that holds the enfants relation/edge.
	EnfantsTable = "emplacement"
	// EnfantsColumn is the table column denoting the enfants relation/edge.
	EnfantsColumn = "parent_id"
	// LiensObjetsTable is the table that holds the liens_objets relation/edge.
	LiensObjetsTable = "lien_objet_emplacement"
	// LiensObjetsInverseTable is the table name for the LienObjetEmplacement entity.
	// It exists in this package in order to avoid circular dependency with the "lienobjetemplacement" package.
	LiensObjetsInverseTable = "lien_objet_emplacement"
	// LiensObjetsColumn is the table column denoting the liens_objets relation/edge.
	LiensObjetsColumn = "emplacement_id"
)

// Columns holds all SQL columns for emplacement fields.
var Columns = []string{
	FieldID,
	FieldNom,
	FieldParentID,
	FieldSlug,
	FieldPiece,
	FieldMeuble,
	FieldNumeroBoite,
	FieldIcone,
	FieldCreatedAt,
	FieldUpdatedAt,
}

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

var (
	// NomValidator is a validator for the "nom" field. It is called by the builders before save.
	NomValidator func(string) error
	// 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
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

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

// ByNom orders the results by the nom field.
func ByNom(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNom, opts...).ToFunc()
}

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

// BySlug orders the results by the slug field.
func BySlug(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSlug, opts...).ToFunc()
}

// ByPiece orders the results by the piece field.
func ByPiece(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPiece, opts...).ToFunc()
}

// ByMeuble orders the results by the meuble field.
func ByMeuble(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldMeuble, opts...).ToFunc()
}

// ByNumeroBoite orders the results by the numero_boite field.
func ByNumeroBoite(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNumeroBoite, opts...).ToFunc()
}

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

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

// ByEnfantsCount orders the results by enfants count.
func ByEnfantsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newEnfantsStep(), opts...)
	}
}

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

// ByLiensObjetsCount orders the results by liens_objets count.
func ByLiensObjetsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newLiensObjetsStep(), opts...)
	}
}

// ByLiensObjets orders the results by liens_objets terms.
func ByLiensObjets(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newLiensObjetsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newParentStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(Table, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, ParentTable, ParentColumn),
	)
}
func newEnfantsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(Table, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, EnfantsTable, EnfantsColumn),
	)
}
func newLiensObjetsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(LiensObjetsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, LiensObjetsTable, LiensObjetsColumn),
	)
}
