// Code generated by ent, DO NOT EDIT.

package idempotencyrecord

import (
	"time"

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

const (
	// Label holds the string label denoting the idempotencyrecord type in the database.
	Label = "idempotency_record"
	// 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"
	// FieldScope holds the string denoting the scope field in the database.
	FieldScope = "scope"
	// FieldIdempotencyKeyHash holds the string denoting the idempotency_key_hash field in the database.
	FieldIdempotencyKeyHash = "idempotency_key_hash"
	// FieldRequestFingerprint holds the string denoting the request_fingerprint field in the database.
	FieldRequestFingerprint = "request_fingerprint"
	// FieldStatus holds the string denoting the status field in the database.
	FieldStatus = "status"
	// FieldResponseStatus holds the string denoting the response_status field in the database.
	FieldResponseStatus = "response_status"
	// FieldResponseBody holds the string denoting the response_body field in the database.
	FieldResponseBody = "response_body"
	// FieldErrorReason holds the string denoting the error_reason field in the database.
	FieldErrorReason = "error_reason"
	// FieldLockedUntil holds the string denoting the locked_until field in the database.
	FieldLockedUntil = "locked_until"
	// FieldExpiresAt holds the string denoting the expires_at field in the database.
	FieldExpiresAt = "expires_at"
	// Table holds the table name of the idempotencyrecord in the database.
	Table = "idempotency_records"
)

// Columns holds all SQL columns for idempotencyrecord fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldScope,
	FieldIdempotencyKeyHash,
	FieldRequestFingerprint,
	FieldStatus,
	FieldResponseStatus,
	FieldResponseBody,
	FieldErrorReason,
	FieldLockedUntil,
	FieldExpiresAt,
}

// 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
	// ScopeValidator is a validator for the "scope" field. It is called by the builders before save.
	ScopeValidator func(string) error
	// IdempotencyKeyHashValidator is a validator for the "idempotency_key_hash" field. It is called by the builders before save.
	IdempotencyKeyHashValidator func(string) error
	// RequestFingerprintValidator is a validator for the "request_fingerprint" field. It is called by the builders before save.
	RequestFingerprintValidator func(string) error
	// StatusValidator is a validator for the "status" field. It is called by the builders before save.
	StatusValidator func(string) error
	// ErrorReasonValidator is a validator for the "error_reason" field. It is called by the builders before save.
	ErrorReasonValidator func(string) error
)

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

// ByScope orders the results by the scope field.
func ByScope(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldScope, opts...).ToFunc()
}

// ByIdempotencyKeyHash orders the results by the idempotency_key_hash field.
func ByIdempotencyKeyHash(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldIdempotencyKeyHash, opts...).ToFunc()
}

// ByRequestFingerprint orders the results by the request_fingerprint field.
func ByRequestFingerprint(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRequestFingerprint, opts...).ToFunc()
}

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

// ByResponseStatus orders the results by the response_status field.
func ByResponseStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldResponseStatus, opts...).ToFunc()
}

// ByResponseBody orders the results by the response_body field.
func ByResponseBody(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldResponseBody, opts...).ToFunc()
}

// ByErrorReason orders the results by the error_reason field.
func ByErrorReason(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldErrorReason, opts...).ToFunc()
}

// ByLockedUntil orders the results by the locked_until field.
func ByLockedUntil(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLockedUntil, opts...).ToFunc()
}

// ByExpiresAt orders the results by the expires_at field.
func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
}
