// Code generated by ent, DO NOT EDIT.

package compapiasynctask

import (
	"time"

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

const (
	// Label holds the string label denoting the compapiasynctask type in the database.
	Label = "compapi_asynctask"
	// 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"
	// FieldAuthToken holds the string denoting the auth_token field in the database.
	FieldAuthToken = "auth_token"
	// FieldEventType holds the string denoting the event_type field in the database.
	FieldEventType = "event_type"
	// FieldChatID holds the string denoting the chat_id field in the database.
	FieldChatID = "chat_id"
	// FieldResponseChatItemID holds the string denoting the response_chat_item_id field in the database.
	FieldResponseChatItemID = "response_chat_item_id"
	// FieldOrganizationID holds the string denoting the organization_id field in the database.
	FieldOrganizationID = "organization_id"
	// FieldOpenaiBase holds the string denoting the openai_base field in the database.
	FieldOpenaiBase = "openai_base"
	// FieldOpenaiKey holds the string denoting the openai_key field in the database.
	FieldOpenaiKey = "openai_key"
	// FieldRequestRaw holds the string denoting the request_raw field in the database.
	FieldRequestRaw = "request_raw"
	// FieldResponseRaw holds the string denoting the response_raw field in the database.
	FieldResponseRaw = "response_raw"
	// FieldCallbackURL holds the string denoting the callback_url field in the database.
	FieldCallbackURL = "callback_url"
	// FieldCallbackResponseRaw holds the string denoting the callback_response_raw field in the database.
	FieldCallbackResponseRaw = "callback_response_raw"
	// FieldModel holds the string denoting the model field in the database.
	FieldModel = "model"
	// FieldTaskStatus holds the string denoting the task_status field in the database.
	FieldTaskStatus = "task_status"
	// FieldRetryCount holds the string denoting the retry_count field in the database.
	FieldRetryCount = "retry_count"
	// FieldLastError holds the string denoting the last_error field in the database.
	FieldLastError = "last_error"
	// Table holds the table name of the compapiasynctask in the database.
	Table = "compapi_asynctask"
)

// Columns holds all SQL columns for compapiasynctask fields.
var Columns = []string{
	FieldID,
	FieldCreatedAt,
	FieldUpdatedAt,
	FieldAuthToken,
	FieldEventType,
	FieldChatID,
	FieldResponseChatItemID,
	FieldOrganizationID,
	FieldOpenaiBase,
	FieldOpenaiKey,
	FieldRequestRaw,
	FieldResponseRaw,
	FieldCallbackURL,
	FieldCallbackResponseRaw,
	FieldModel,
	FieldTaskStatus,
	FieldRetryCount,
	FieldLastError,
}

// 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
	// DefaultEventType holds the default value on creation for the "event_type" field.
	DefaultEventType string
	// DefaultChatID holds the default value on creation for the "chat_id" field.
	DefaultChatID string
	// DefaultResponseChatItemID holds the default value on creation for the "response_chat_item_id" field.
	DefaultResponseChatItemID string
	// OrganizationIDValidator is a validator for the "organization_id" field. It is called by the builders before save.
	OrganizationIDValidator func(uint64) error
	// DefaultResponseRaw holds the default value on creation for the "response_raw" field.
	DefaultResponseRaw string
	// CallbackURLValidator is a validator for the "callback_url" field. It is called by the builders before save.
	CallbackURLValidator func(string) error
	// DefaultCallbackResponseRaw holds the default value on creation for the "callback_response_raw" field.
	DefaultCallbackResponseRaw string
	// DefaultModel holds the default value on creation for the "model" field.
	DefaultModel string
	// DefaultTaskStatus holds the default value on creation for the "task_status" field.
	DefaultTaskStatus int8
	// DefaultRetryCount holds the default value on creation for the "retry_count" field.
	DefaultRetryCount int8
	// DefaultLastError holds the default value on creation for the "last_error" field.
	DefaultLastError string
)

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

// ByAuthToken orders the results by the auth_token field.
func ByAuthToken(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldAuthToken, opts...).ToFunc()
}

// ByEventType orders the results by the event_type field.
func ByEventType(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldEventType, opts...).ToFunc()
}

// ByChatID orders the results by the chat_id field.
func ByChatID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldChatID, opts...).ToFunc()
}

// ByResponseChatItemID orders the results by the response_chat_item_id field.
func ByResponseChatItemID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldResponseChatItemID, opts...).ToFunc()
}

// ByOrganizationID orders the results by the organization_id field.
func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
}

// ByOpenaiBase orders the results by the openai_base field.
func ByOpenaiBase(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOpenaiBase, opts...).ToFunc()
}

// ByOpenaiKey orders the results by the openai_key field.
func ByOpenaiKey(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldOpenaiKey, opts...).ToFunc()
}

// ByRequestRaw orders the results by the request_raw field.
func ByRequestRaw(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRequestRaw, opts...).ToFunc()
}

// ByResponseRaw orders the results by the response_raw field.
func ByResponseRaw(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldResponseRaw, opts...).ToFunc()
}

// ByCallbackURL orders the results by the callback_url field.
func ByCallbackURL(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCallbackURL, opts...).ToFunc()
}

// ByCallbackResponseRaw orders the results by the callback_response_raw field.
func ByCallbackResponseRaw(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldCallbackResponseRaw, opts...).ToFunc()
}

// ByModel orders the results by the model field.
func ByModel(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldModel, opts...).ToFunc()
}

// ByTaskStatus orders the results by the task_status field.
func ByTaskStatus(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldTaskStatus, opts...).ToFunc()
}

// ByRetryCount orders the results by the retry_count field.
func ByRetryCount(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldRetryCount, opts...).ToFunc()
}

// ByLastError orders the results by the last_error field.
func ByLastError(opts ...sql.OrderTermOption) OrderOption {
	return sql.OrderByField(FieldLastError, opts...).ToFunc()
}
