// Code generated by ent, DO NOT EDIT.

package attestationcollection

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

const (
	// Label holds the string label denoting the attestationcollection type in the database.
	Label = "attestation_collection"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// EdgeAttestations holds the string denoting the attestations edge name in mutations.
	EdgeAttestations = "attestations"
	// EdgeStatement holds the string denoting the statement edge name in mutations.
	EdgeStatement = "statement"
	// Table holds the table name of the attestationcollection in the database.
	Table = "attestation_collections"
	// AttestationsTable is the table that holds the attestations relation/edge.
	AttestationsTable = "attestations"
	// AttestationsInverseTable is the table name for the Attestation entity.
	// It exists in this package in order to avoid circular dependency with the "attestation" package.
	AttestationsInverseTable = "attestations"
	// AttestationsColumn is the table column denoting the attestations relation/edge.
	AttestationsColumn = "attestation_collection_attestations"
	// StatementTable is the table that holds the statement relation/edge.
	StatementTable = "attestation_collections"
	// StatementInverseTable is the table name for the Statement entity.
	// It exists in this package in order to avoid circular dependency with the "statement" package.
	StatementInverseTable = "statements"
	// StatementColumn is the table column denoting the statement relation/edge.
	StatementColumn = "statement_attestation_collections"
)

// Columns holds all SQL columns for attestationcollection fields.
var Columns = []string{
	FieldID,
	FieldName,
}

// ForeignKeys holds the SQL foreign-keys that are owned by the "attestation_collections"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
	"statement_attestation_collections",
}

// 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
		}
	}
	for i := range ForeignKeys {
		if column == ForeignKeys[i] {
			return true
		}
	}
	return false
}

var (
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// DefaultID holds the default value on creation for the "id" field.
	DefaultID func() uuid.UUID
)

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

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

// ByAttestationsCount orders the results by attestations count.
func ByAttestationsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newAttestationsStep(), opts...)
	}
}

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

// ByStatementField orders the results by statement field.
func ByStatementField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newStatementStep(), sql.OrderByField(field, opts...))
	}
}
func newAttestationsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AttestationsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, AttestationsTable, AttestationsColumn),
	)
}
func newStatementStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(StatementInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, true, StatementTable, StatementColumn),
	)
}
