// Code generated by ent, DO NOT EDIT.

package channelmonitorrequesttemplate

import (
	"fmt"
	"time"

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

const (
	// Label holds the string label denoting the channelmonitorrequesttemplate type in the database.
	Label = "channel_monitor_request_template"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// 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"
	// FieldName holds the string denoting the name field in the database.
	FieldName = "name"
	// FieldProvider holds the string denoting the provider field in the database.
	FieldProvider = "provider"
	// FieldDescription holds the string denoting the description field in the database.
	FieldDescription = "description"
	// FieldExtraHeaders holds the string denoting the extra_headers field in the database.
	FieldExtraHeaders = "extra_headers"
	// FieldBodyOverrideMode holds the string denoting the body_override_mode field in the database.
	FieldBodyOverrideMode = "body_override_mode"
	// FieldBodyOverride holds the string denoting the body_override field in the database.
	FieldBodyOverride = "body_override"
	// EdgeMonitors holds the string denoting the monitors edge name in mutations.
	EdgeMonitors = "monitors"
	// Table holds the table name of the channelmonitorrequesttemplate in the database.
	Table = "channel_monitor_request_templates"
	// MonitorsTable is the table that holds the monitors relation/edge.
	MonitorsTable = "channel_monitors"
	// MonitorsInverseTable is the table name for the ChannelMonitor entity.
	// It exists in this package in order to avoid circular dependency with the "channelmonitor" package.
	MonitorsInverseTable = "channel_monitors"
	// MonitorsColumn is the table column denoting the monitors relation/edge.
	MonitorsColumn = "template_id"
)

// Columns holds all SQL columns for channelmonitorrequesttemplate fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldName,
	FieldProvider,
	FieldDescription,
	FieldExtraHeaders,
	FieldBodyOverrideMode,
	FieldBodyOverride,
}

// 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 (
	// 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
	// NameValidator is a validator for the "name" field. It is called by the builders before save.
	NameValidator func(string) error
	// DefaultDescription holds the default value on creation for the "description" field.
	DefaultDescription string
	// DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
	DescriptionValidator func(string) error
	// DefaultExtraHeaders holds the default value on creation for the "extra_headers" field.
	DefaultExtraHeaders map[string]string
	// DefaultBodyOverrideMode holds the default value on creation for the "body_override_mode" field.
	DefaultBodyOverrideMode string
	// BodyOverrideModeValidator is a validator for the "body_override_mode" field. It is called by the builders before save.
	BodyOverrideModeValidator func(string) error
)

// Provider defines the type for the "provider" enum field.
type Provider string

// Provider values.
const (
	ProviderOpenai    Provider = "openai"
	ProviderAnthropic Provider = "anthropic"
	ProviderGemini    Provider = "gemini"
)

func (pr Provider) String() string {
	return string(pr)
}

// ProviderValidator is a validator for the "provider" field enum values. It is called by the builders before save.
func ProviderValidator(pr Provider) error {
	switch pr {
	case ProviderOpenai, ProviderAnthropic, ProviderGemini:
		return nil
	default:
		return fmt.Errorf("channelmonitorrequesttemplate: invalid enum value for provider field: %q", pr)
	}
}

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

// 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()
}

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

// ByProvider orders the results by the provider field.
func ByProvider(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldProvider, opts...).ToFunc()
}

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

// ByBodyOverrideMode orders the results by the body_override_mode field.
func ByBodyOverrideMode(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldBodyOverrideMode, opts...).ToFunc()
}

// ByMonitorsCount orders the results by monitors count.
func ByMonitorsCount(opts ...sql.OrderTermOption) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborsCount(s, newMonitorsStep(), opts...)
	}
}

// ByMonitors orders the results by monitors terms.
func ByMonitors(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
	return func(s *sql.Selector) {
		sqlgraph.OrderByNeighborTerms(s, newMonitorsStep(), append([]sql.OrderTerm{term}, terms...)...)
	}
}
func newMonitorsStep() *sqlgraph.Step {
	return sqlgraph.NewStep(
		sqlgraph.From(Table, FieldID),
		sqlgraph.To(MonitorsInverseTable, FieldID),
		sqlgraph.Edge(sqlgraph.O2M, true, MonitorsTable, MonitorsColumn),
	)
}
