// Code generated by ent, DO NOT EDIT.

package statement

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

const (
	// Label holds the string label denoting the statement type in the database.
	Label = "statement"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldPredicate holds the string denoting the predicate field in the database.
	FieldPredicate = "predicate"
	// EdgeSubjects holds the string denoting the subjects edge name in mutations.
	EdgeSubjects = "subjects"
	// EdgePolicy holds the string denoting the policy edge name in mutations.
	EdgePolicy = "policy"
	// EdgeAttestationCollections holds the string denoting the attestation_collections edge name in mutations.
	EdgeAttestationCollections = "attestation_collections"
	// EdgeDsse holds the string denoting the dsse edge name in mutations.
	EdgeDsse = "dsse"
	// Table holds the table name of the statement in the database.
	Table = "statements"
	// SubjectsTable is the table that holds the subjects relation/edge.
	SubjectsTable = "subjects"
	// SubjectsInverseTable is the table name for the Subject entity.
	// It exists in this package in order to avoid circular dependency with the "subject" package.
	SubjectsInverseTable = "subjects"
	// SubjectsColumn is the table column denoting the subjects relation/edge.
	SubjectsColumn = "statement_subjects"
	// PolicyTable is the table that holds the policy relation/edge.
	PolicyTable = "attestation_policies"
	// PolicyInverseTable is the table name for the AttestationPolicy entity.
	// It exists in this package in order to avoid circular dependency with the "attestationpolicy" package.
	PolicyInverseTable = "attestation_policies"
	// PolicyColumn is the table column denoting the policy relation/edge.
	PolicyColumn = "statement_policy"
	// AttestationCollectionsTable is the table that holds the attestation_collections relation/edge.
	AttestationCollectionsTable = "attestation_collections"
	// AttestationCollectionsInverseTable is the table name for the AttestationCollection entity.
	// It exists in this package in order to avoid circular dependency with the "attestationcollection" package.
	AttestationCollectionsInverseTable = "attestation_collections"
	// AttestationCollectionsColumn is the table column denoting the attestation_collections relation/edge.
	AttestationCollectionsColumn = "statement_attestation_collections"
	// DsseTable is the table that holds the dsse relation/edge.
	DsseTable = "dsses"
	// DsseInverseTable is the table name for the Dsse entity.
	// It exists in this package in order to avoid circular dependency with the "dsse" package.
	DsseInverseTable = "dsses"
	// DsseColumn is the table column denoting the dsse relation/edge.
	DsseColumn = "dsse_statement"
)

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

// 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 (
	// PredicateValidator is a validator for the "predicate" field. It is called by the builders before save.
	PredicateValidator 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 Statement 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()
}

// ByPredicate orders the results by the predicate field.
func ByPredicate(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPredicate, opts...).ToFunc()
}

// BySubjectsCount orders the results by subjects count.
func BySubjectsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newSubjectsStep(), opts...)
	}
}

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

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

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

// ByDsseCount orders the results by dsse count.
func ByDsseCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newDsseStep(), opts...)
	}
}

// ByDsse orders the results by dsse terms.
func ByDsse(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newDsseStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newSubjectsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(SubjectsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, SubjectsTable, SubjectsColumn),
	)
}
func newPolicyStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(PolicyInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, false, PolicyTable, PolicyColumn),
	)
}
func newAttestationCollectionsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AttestationCollectionsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2O, false, AttestationCollectionsTable, AttestationCollectionsColumn),
	)
}
func newDsseStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(DsseInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, true, DsseTable, DsseColumn),
	)
}
