// Code generated by ent, DO NOT EDIT.

package calendar

import (
	"time"

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

const (
	// Label holds the string label denoting the calendar type in the database.
	Label = "calendar"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldRemoteID holds the string denoting the remote_id field in the database.
	FieldRemoteID = "remote_id"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldNameOverride holds the string denoting the name_override field in the database.
	FieldNameOverride = "name_override"
	// FieldDescription holds the string denoting the description field in the database.
	FieldDescription = "description"
	// FieldColor holds the string denoting the color field in the database.
	FieldColor = "color"
	// FieldTimeZone holds the string denoting the time_zone field in the database.
	FieldTimeZone = "time_zone"
	// FieldReadOnly holds the string denoting the read_only field in the database.
	FieldReadOnly = "read_only"
	// FieldHidden holds the string denoting the hidden field in the database.
	FieldHidden = "hidden"
	// FieldSyncDisabled holds the string denoting the sync_disabled field in the database.
	FieldSyncDisabled = "sync_disabled"
	// FieldReminderOverrides holds the string denoting the reminder_overrides field in the database.
	FieldReminderOverrides = "reminder_overrides"
	// FieldSyncToken holds the string denoting the sync_token field in the database.
	FieldSyncToken = "sync_token"
	// FieldSupportedComponents holds the string denoting the supported_components field in the database.
	FieldSupportedComponents = "supported_components"
	// 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"
	// EdgeAccount holds the string denoting the account edge name in mutations.
	EdgeAccount = "account"
	// EdgeEvents holds the string denoting the events edge name in mutations.
	EdgeEvents = "events"
	// EdgeTasks holds the string denoting the tasks edge name in mutations.
	EdgeTasks = "tasks"
	// Table holds the table name of the calendar in the database.
	Table = "calendars"
	// AccountTable is the table that holds the account relation/edge.
	AccountTable = "calendars"
	// AccountInverseTable is the table name for the Account entity.
	// It exists in this package in order to avoid circular dependency with the "account" package.
	AccountInverseTable = "accounts"
	// AccountColumn is the table column denoting the account relation/edge.
	AccountColumn = "account_calendars"
	// EventsTable is the table that holds the events relation/edge.
	EventsTable = "events"
	// EventsInverseTable is the table name for the Event entity.
	// It exists in this package in order to avoid circular dependency with the "event" package.
	EventsInverseTable = "events"
	// EventsColumn is the table column denoting the events relation/edge.
	EventsColumn = "calendar_events"
	// TasksTable is the table that holds the tasks relation/edge.
	TasksTable = "tasks"
	// TasksInverseTable is the table name for the Task entity.
	// It exists in this package in order to avoid circular dependency with the "task" package.
	TasksInverseTable = "tasks"
	// TasksColumn is the table column denoting the tasks relation/edge.
	TasksColumn = "calendar_tasks"
)

// Columns holds all SQL columns for calendar fields.
var Columns = []string{
	FieldID,
	FieldRemoteID,
	FieldName,
	FieldNameOverride,
	FieldDescription,
	FieldColor,
	FieldTimeZone,
	FieldReadOnly,
	FieldHidden,
	FieldSyncDisabled,
	FieldReminderOverrides,
	FieldSyncToken,
	FieldSupportedComponents,
	FieldCreatedAt,
	FieldUpdatedAt,
}

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

// 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 (
	// RemoteIDValidator is a validator for the "remote_id" field. It is called by the builders before save.
	RemoteIDValidator func(string) error
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// DefaultReadOnly holds the default value on creation for the "read_only" field.
	DefaultReadOnly bool
	// DefaultHidden holds the default value on creation for the "hidden" field.
	DefaultHidden bool
	// DefaultSyncDisabled holds the default value on creation for the "sync_disabled" field.
	DefaultSyncDisabled bool
	// 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
	// IDValidator is a validator for the "id" field. It is called by the builders before save.
	IDValidator func(string) error
)

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

// ByRemoteID orders the results by the remote_id field.
func ByRemoteID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRemoteID, opts...).ToFunc()
}

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

// ByNameOverride orders the results by the name_override field.
func ByNameOverride(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldNameOverride, opts...).ToFunc()
}

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

// ByColor orders the results by the color field.
func ByColor(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldColor, opts...).ToFunc()
}

// ByTimeZone orders the results by the time_zone field.
func ByTimeZone(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTimeZone, opts...).ToFunc()
}

// ByReadOnly orders the results by the read_only field.
func ByReadOnly(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldReadOnly, opts...).ToFunc()
}

// ByHidden orders the results by the hidden field.
func ByHidden(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldHidden, opts...).ToFunc()
}

// BySyncDisabled orders the results by the sync_disabled field.
func BySyncDisabled(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSyncDisabled, opts...).ToFunc()
}

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

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

// ByEventsCount orders the results by events count.
func ByEventsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newEventsStep(), opts...)
	}
}

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

// ByTasksCount orders the results by tasks count.
func ByTasksCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newTasksStep(), opts...)
	}
}

// ByTasks orders the results by tasks terms.
func ByTasks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newTasksStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newAccountStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(AccountInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, AccountTable, AccountColumn),
	)
}
func newEventsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(EventsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, EventsTable, EventsColumn),
	)
}
func newTasksStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(TasksInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, false, TasksTable, TasksColumn),
	)
}
