// Code generated by ent, DO NOT EDIT.

package task

import (
	"fmt"
	"time"

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

const (
	// Label holds the string label denoting the task type in the database.
	Label = "task"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldUID holds the string denoting the uid field in the database.
	FieldUID = "uid"
	// FieldRemoteID holds the string denoting the remote_id field in the database.
	FieldRemoteID = "remote_id"
	// FieldEtag holds the string denoting the etag field in the database.
	FieldEtag = "etag"
	// FieldSummary holds the string denoting the summary field in the database.
	FieldSummary = "summary"
	// FieldDescription holds the string denoting the description field in the database.
	FieldDescription = "description"
	// FieldLocation holds the string denoting the location field in the database.
	FieldLocation = "location"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldPriority holds the string denoting the priority field in the database.
	FieldPriority = "priority"
	// FieldPercentComplete holds the string denoting the percent_complete field in the database.
	FieldPercentComplete = "percent_complete"
	// FieldDue holds the string denoting the due field in the database.
	FieldDue = "due"
	// FieldStart holds the string denoting the start field in the database.
	FieldStart = "start"
	// FieldCompleted holds the string denoting the completed field in the database.
	FieldCompleted = "completed"
	// FieldAllDay holds the string denoting the all_day field in the database.
	FieldAllDay = "all_day"
	// FieldDueTz holds the string denoting the due_tz field in the database.
	FieldDueTz = "due_tz"
	// FieldStartTz holds the string denoting the start_tz field in the database.
	FieldStartTz = "start_tz"
	// FieldParentUID holds the string denoting the parent_uid field in the database.
	FieldParentUID = "parent_uid"
	// FieldRecurrence holds the string denoting the recurrence field in the database.
	FieldRecurrence = "recurrence"
	// FieldReminders holds the string denoting the reminders field in the database.
	FieldReminders = "reminders"
	// FieldCategories holds the string denoting the categories field in the database.
	FieldCategories = "categories"
	// FieldRawIcs holds the string denoting the raw_ics field in the database.
	FieldRawIcs = "raw_ics"
	// FieldCreated holds the string denoting the created field in the database.
	FieldCreated = "created"
	// FieldUpdated holds the string denoting the updated field in the database.
	FieldUpdated = "updated"
	// EdgeCalendar holds the string denoting the calendar edge name in mutations.
	EdgeCalendar = "calendar"
	// Table holds the table name of the task in the database.
	Table = "tasks"
	// CalendarTable is the table that holds the calendar relation/edge.
	CalendarTable = "tasks"
	// CalendarInverseTable is the table name for the Calendar entity.
	// It exists in this package in order to avoid circular dependency with the "calendar" package.
	CalendarInverseTable = "calendars"
	// CalendarColumn is the table column denoting the calendar relation/edge.
	CalendarColumn = "calendar_tasks"
)

// Columns holds all SQL columns for task fields.
var Columns = []string{
	FieldID,
	FieldUID,
	FieldRemoteID,
	FieldEtag,
	FieldSummary,
	FieldDescription,
	FieldLocation,
	FieldStatus,
	FieldPriority,
	FieldPercentComplete,
	FieldDue,
	FieldStart,
	FieldCompleted,
	FieldAllDay,
	FieldDueTz,
	FieldStartTz,
	FieldParentUID,
	FieldRecurrence,
	FieldReminders,
	FieldCategories,
	FieldRawIcs,
	FieldCreated,
	FieldUpdated,
}

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

// 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 (
	// UIDValidator is a validator for the "uid" field. It is called by the builders before save.
	UIDValidator func(string) error
	// DefaultPriority holds the default value on creation for the "priority" field.
	DefaultPriority int
	// DefaultPercentComplete holds the default value on creation for the "percent_complete" field.
	DefaultPercentComplete int
	// DefaultAllDay holds the default value on creation for the "all_day" field.
	DefaultAllDay bool
	// DefaultCreated holds the default value on creation for the "created" field.
	DefaultCreated func() time.Time
	// DefaultUpdated holds the default value on creation for the "updated" field.
	DefaultUpdated func() time.Time
	// UpdateDefaultUpdated holds the default value on update for the "updated" field.
	UpdateDefaultUpdated func() time.Time
	// IDValidator is a validator for the "id" field. It is called by the builders before save.
	IDValidator func(string) error
)

// Status defines the type for the "status" enum field.
type Status string

// StatusNeedsAction is the default value of the Status enum.
const DefaultStatus = StatusNeedsAction

// Status values.
const (
	StatusNeedsAction Status = "needs_action"
	StatusInProcess   Status = "in_process"
	StatusCompleted   Status = "completed"
	StatusCancelled   Status = "cancelled"
)

func (s Status) String() string {
	return string(s)
}

// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
func StatusValidator(s Status) error {
	switch s {
	case StatusNeedsAction, StatusInProcess, StatusCompleted, StatusCancelled:
		return nil
	default:
		return fmt.Errorf("task: invalid enum value for status field: %q", s)
	}
}

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

// ByUID orders the results by the uid field.
func ByUID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUID, opts...).ToFunc()
}

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

// ByEtag orders the results by the etag field.
func ByEtag(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEtag, opts...).ToFunc()
}

// BySummary orders the results by the summary field.
func BySummary(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldSummary, opts...).ToFunc()
}

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

// ByLocation orders the results by the location field.
func ByLocation(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLocation, opts...).ToFunc()
}

// ByStatus orders the results by the status field.
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStatus, opts...).ToFunc()
}

// ByPriority orders the results by the priority field.
func ByPriority(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPriority, opts...).ToFunc()
}

// ByPercentComplete orders the results by the percent_complete field.
func ByPercentComplete(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldPercentComplete, opts...).ToFunc()
}

// ByDue orders the results by the due field.
func ByDue(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDue, opts...).ToFunc()
}

// ByStart orders the results by the start field.
func ByStart(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStart, opts...).ToFunc()
}

// ByCompleted orders the results by the completed field.
func ByCompleted(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCompleted, opts...).ToFunc()
}

// ByAllDay orders the results by the all_day field.
func ByAllDay(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAllDay, opts...).ToFunc()
}

// ByDueTz orders the results by the due_tz field.
func ByDueTz(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldDueTz, opts...).ToFunc()
}

// ByStartTz orders the results by the start_tz field.
func ByStartTz(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldStartTz, opts...).ToFunc()
}

// ByParentUID orders the results by the parent_uid field.
func ByParentUID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldParentUID, opts...).ToFunc()
}

// ByRawIcs orders the results by the raw_ics field.
func ByRawIcs(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRawIcs, opts...).ToFunc()
}

// ByCreated orders the results by the created field.
func ByCreated(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCreated, opts...).ToFunc()
}

// ByUpdated orders the results by the updated field.
func ByUpdated(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldUpdated, opts...).ToFunc()
}

// ByCalendarField orders the results by calendar field.
func ByCalendarField(field string, opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newCalendarStep(), sql.OrderByField(field, opts...))
	}
}
func newCalendarStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(CalendarInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.M2O, true, CalendarTable, CalendarColumn),
	)
}
