// Code generated by ent, DO NOT EDIT.

package principal

import (
	"fmt"
	"time"

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

const (
	// Label holds the string label denoting the principal type in the database.
	Label = "principal"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldAstraID holds the string denoting the astra_id field in the database.
	FieldAstraID = "astra_id"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldTrust holds the string denoting the trust field in the database.
	FieldTrust = "trust"
	// FieldBuilder holds the string denoting the builder field in the database.
	FieldBuilder = "builder"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// FieldCompleteness holds the string denoting the completeness field in the database.
	FieldCompleteness = "completeness"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// Table holds the table name of the principal in the database.
	Table = "principals"
)

// Columns holds all SQL columns for principal fields.
var Columns = []string{
	FieldID,
	FieldAstraID,
	FieldName,
	FieldTrust,
	FieldBuilder,
	FieldMetadata,
	FieldCompleteness,
	FieldCreatedAt,
}

// 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 (
	// AstraIDValidator is a validator for the "astra_id" field. It is called by the builders before save.
	AstraIDValidator func(string) error
	// DefaultName holds the default value on creation for the "name" field.
	DefaultName string
	// DefaultTrust holds the default value on creation for the "trust" field.
	DefaultTrust string
	// DefaultBuilder holds the default value on creation for the "builder" field.
	DefaultBuilder string
	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
	DefaultCreatedAt func() time.Time
)

// Completeness defines the type for the "completeness" enum field.
type Completeness string

// CompletenessComplete is the default value of the Completeness enum.
const DefaultCompleteness = CompletenessComplete

// Completeness values.
const (
	CompletenessComplete   Completeness = "complete"
	CompletenessIncomplete Completeness = "incomplete"
)

func (c Completeness) String() string {
	return string(c)
}

// CompletenessValidator is a validator for the "completeness" field enum values. It is called by the builders before save.
func CompletenessValidator(c Completeness) error {
	switch c {
	case CompletenessComplete, CompletenessIncomplete:
		return nil
	default:
		return fmt.Errorf("principal: invalid enum value for completeness field: %q", c)
	}
}

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

// ByAstraID orders the results by the astra_id field.
func ByAstraID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAstraID, opts...).ToFunc()
}

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

// ByTrust orders the results by the trust field.
func ByTrust(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTrust, opts...).ToFunc()
}

// ByBuilder orders the results by the builder field.
func ByBuilder(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBuilder, opts...).ToFunc()
}

// ByCompleteness orders the results by the completeness field.
func ByCompleteness(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCompleteness, opts...).ToFunc()
}

// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
