// Code generated by ent, DO NOT EDIT.

package orderstatelogs

import (
	"time"

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

const (
	// Label holds the string label denoting the orderstatelogs type in the database.
	Label = "order_state_logs"
	// FieldID holds the string denoting the id field in the database.
	FieldID = "id"
	// FieldOrderID holds the string denoting the order_id field in the database.
	FieldOrderID = "order_id"
	// FieldFromStatus holds the string denoting the from_status field in the database.
	FieldFromStatus = "from_status"
	// FieldToStatus holds the string denoting the to_status field in the database.
	FieldToStatus = "to_status"
	// FieldAction holds the string denoting the action field in the database.
	FieldAction = "action"
	// FieldActorID holds the string denoting the actor_id field in the database.
	FieldActorID = "actor_id"
	// FieldActorRole holds the string denoting the actor_role field in the database.
	FieldActorRole = "actor_role"
	// FieldMetadata holds the string denoting the metadata field in the database.
	FieldMetadata = "metadata"
	// FieldCreatedAt holds the string denoting the created_at field in the database.
	FieldCreatedAt = "created_at"
	// Table holds the table name of the orderstatelogs in the database.
	Table = "order_state_logs"
)

// Columns holds all SQL columns for orderstatelogs fields.
var Columns = []string{
	FieldID,
	FieldOrderID,
	FieldFromStatus,
	FieldToStatus,
	FieldAction,
	FieldActorID,
	FieldActorRole,
	FieldMetadata,
	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 (
	// FromStatusValidator is a validator for the "from_status" field. It is called by the builders before save.
	FromStatusValidator func(string) error
	// ToStatusValidator is a validator for the "to_status" field. It is called by the builders before save.
	ToStatusValidator func(string) error
	// ActionValidator is a validator for the "action" field. It is called by the builders before save.
	ActionValidator func(string) error
	// ActorRoleValidator is a validator for the "actor_role" field. It is called by the builders before save.
	ActorRoleValidator func(string) error
	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
	DefaultCreatedAt func() time.Time
)

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

// ByOrderID orders the results by the order_id field.
func ByOrderID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOrderID, opts...).ToFunc()
}

// ByFromStatus orders the results by the from_status field.
func ByFromStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldFromStatus, opts...).ToFunc()
}

// ByToStatus orders the results by the to_status field.
func ByToStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldToStatus, opts...).ToFunc()
}

// ByAction orders the results by the action field.
func ByAction(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAction, opts...).ToFunc()
}

// ByActorID orders the results by the actor_id field.
func ByActorID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldActorID, opts...).ToFunc()
}

// ByActorRole orders the results by the actor_role field.
func ByActorRole(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldActorRole, opts...).ToFunc()
}

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