// Code generated by ent, DO NOT EDIT.

package ent

import (
	"context"
	"errors"
	"fmt"
	"time"

	"entgo.io/ent/dialect/sql"
	"entgo.io/ent/dialect/sql/sqlgraph"
	"entgo.io/ent/schema/field"
	"github.com/Wei-Shaw/sub2api/ent/batchimagejob"
	"github.com/Wei-Shaw/sub2api/ent/predicate"
)

// BatchImageJobUpdate is the builder for updating BatchImageJob entities.
type BatchImageJobUpdate struct {
	config
	hooks    []Hook
	mutation *BatchImageJobMutation
}

// Where appends a list predicates to the BatchImageJobUpdate builder.
func (_u *BatchImageJobUpdate) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdate {
	_u.mutation.Where(ps...)
	return _u
}

// SetUserID sets the "user_id" field.
func (_u *BatchImageJobUpdate) SetUserID(v int64) *BatchImageJobUpdate {
	_u.mutation.ResetUserID()
	_u.mutation.SetUserID(v)
	return _u
}

// SetNillableUserID sets the "user_id" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableUserID(v *int64) *BatchImageJobUpdate {
	if v != nil {
		_u.SetUserID(*v)
	}
	return _u
}

// AddUserID adds value to the "user_id" field.
func (_u *BatchImageJobUpdate) AddUserID(v int64) *BatchImageJobUpdate {
	_u.mutation.AddUserID(v)
	return _u
}

// SetAPIKeyID sets the "api_key_id" field.
func (_u *BatchImageJobUpdate) SetAPIKeyID(v int64) *BatchImageJobUpdate {
	_u.mutation.ResetAPIKeyID()
	_u.mutation.SetAPIKeyID(v)
	return _u
}

// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdate {
	if v != nil {
		_u.SetAPIKeyID(*v)
	}
	return _u
}

// AddAPIKeyID adds value to the "api_key_id" field.
func (_u *BatchImageJobUpdate) AddAPIKeyID(v int64) *BatchImageJobUpdate {
	_u.mutation.AddAPIKeyID(v)
	return _u
}

// ClearAPIKeyID clears the value of the "api_key_id" field.
func (_u *BatchImageJobUpdate) ClearAPIKeyID() *BatchImageJobUpdate {
	_u.mutation.ClearAPIKeyID()
	return _u
}

// SetAccountID sets the "account_id" field.
func (_u *BatchImageJobUpdate) SetAccountID(v int64) *BatchImageJobUpdate {
	_u.mutation.ResetAccountID()
	_u.mutation.SetAccountID(v)
	return _u
}

// SetNillableAccountID sets the "account_id" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableAccountID(v *int64) *BatchImageJobUpdate {
	if v != nil {
		_u.SetAccountID(*v)
	}
	return _u
}

// AddAccountID adds value to the "account_id" field.
func (_u *BatchImageJobUpdate) AddAccountID(v int64) *BatchImageJobUpdate {
	_u.mutation.AddAccountID(v)
	return _u
}

// ClearAccountID clears the value of the "account_id" field.
func (_u *BatchImageJobUpdate) ClearAccountID() *BatchImageJobUpdate {
	_u.mutation.ClearAccountID()
	return _u
}

// SetProvider sets the "provider" field.
func (_u *BatchImageJobUpdate) SetProvider(v string) *BatchImageJobUpdate {
	_u.mutation.SetProvider(v)
	return _u
}

// SetNillableProvider sets the "provider" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableProvider(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetProvider(*v)
	}
	return _u
}

// SetModel sets the "model" field.
func (_u *BatchImageJobUpdate) SetModel(v string) *BatchImageJobUpdate {
	_u.mutation.SetModel(v)
	return _u
}

// SetNillableModel sets the "model" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableModel(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetModel(*v)
	}
	return _u
}

// SetTaskName sets the "task_name" field.
func (_u *BatchImageJobUpdate) SetTaskName(v string) *BatchImageJobUpdate {
	_u.mutation.SetTaskName(v)
	return _u
}

// SetNillableTaskName sets the "task_name" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableTaskName(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetTaskName(*v)
	}
	return _u
}

// SetStatus sets the "status" field.
func (_u *BatchImageJobUpdate) SetStatus(v string) *BatchImageJobUpdate {
	_u.mutation.SetStatus(v)
	return _u
}

// SetNillableStatus sets the "status" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableStatus(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetStatus(*v)
	}
	return _u
}

// SetProviderJobName sets the "provider_job_name" field.
func (_u *BatchImageJobUpdate) SetProviderJobName(v string) *BatchImageJobUpdate {
	_u.mutation.SetProviderJobName(v)
	return _u
}

// SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableProviderJobName(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetProviderJobName(*v)
	}
	return _u
}

// ClearProviderJobName clears the value of the "provider_job_name" field.
func (_u *BatchImageJobUpdate) ClearProviderJobName() *BatchImageJobUpdate {
	_u.mutation.ClearProviderJobName()
	return _u
}

// SetProviderInputRef sets the "provider_input_ref" field.
func (_u *BatchImageJobUpdate) SetProviderInputRef(v string) *BatchImageJobUpdate {
	_u.mutation.SetProviderInputRef(v)
	return _u
}

// SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableProviderInputRef(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetProviderInputRef(*v)
	}
	return _u
}

// ClearProviderInputRef clears the value of the "provider_input_ref" field.
func (_u *BatchImageJobUpdate) ClearProviderInputRef() *BatchImageJobUpdate {
	_u.mutation.ClearProviderInputRef()
	return _u
}

// SetProviderOutputRef sets the "provider_output_ref" field.
func (_u *BatchImageJobUpdate) SetProviderOutputRef(v string) *BatchImageJobUpdate {
	_u.mutation.SetProviderOutputRef(v)
	return _u
}

// SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetProviderOutputRef(*v)
	}
	return _u
}

// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
func (_u *BatchImageJobUpdate) ClearProviderOutputRef() *BatchImageJobUpdate {
	_u.mutation.ClearProviderOutputRef()
	return _u
}

// SetGcsInputURI sets the "gcs_input_uri" field.
func (_u *BatchImageJobUpdate) SetGcsInputURI(v string) *BatchImageJobUpdate {
	_u.mutation.SetGcsInputURI(v)
	return _u
}

// SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableGcsInputURI(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetGcsInputURI(*v)
	}
	return _u
}

// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
func (_u *BatchImageJobUpdate) ClearGcsInputURI() *BatchImageJobUpdate {
	_u.mutation.ClearGcsInputURI()
	return _u
}

// SetGcsOutputURI sets the "gcs_output_uri" field.
func (_u *BatchImageJobUpdate) SetGcsOutputURI(v string) *BatchImageJobUpdate {
	_u.mutation.SetGcsOutputURI(v)
	return _u
}

// SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetGcsOutputURI(*v)
	}
	return _u
}

// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
func (_u *BatchImageJobUpdate) ClearGcsOutputURI() *BatchImageJobUpdate {
	_u.mutation.ClearGcsOutputURI()
	return _u
}

// SetItemCount sets the "item_count" field.
func (_u *BatchImageJobUpdate) SetItemCount(v int) *BatchImageJobUpdate {
	_u.mutation.ResetItemCount()
	_u.mutation.SetItemCount(v)
	return _u
}

// SetNillableItemCount sets the "item_count" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableItemCount(v *int) *BatchImageJobUpdate {
	if v != nil {
		_u.SetItemCount(*v)
	}
	return _u
}

// AddItemCount adds value to the "item_count" field.
func (_u *BatchImageJobUpdate) AddItemCount(v int) *BatchImageJobUpdate {
	_u.mutation.AddItemCount(v)
	return _u
}

// SetSuccessCount sets the "success_count" field.
func (_u *BatchImageJobUpdate) SetSuccessCount(v int) *BatchImageJobUpdate {
	_u.mutation.ResetSuccessCount()
	_u.mutation.SetSuccessCount(v)
	return _u
}

// SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableSuccessCount(v *int) *BatchImageJobUpdate {
	if v != nil {
		_u.SetSuccessCount(*v)
	}
	return _u
}

// AddSuccessCount adds value to the "success_count" field.
func (_u *BatchImageJobUpdate) AddSuccessCount(v int) *BatchImageJobUpdate {
	_u.mutation.AddSuccessCount(v)
	return _u
}

// SetFailCount sets the "fail_count" field.
func (_u *BatchImageJobUpdate) SetFailCount(v int) *BatchImageJobUpdate {
	_u.mutation.ResetFailCount()
	_u.mutation.SetFailCount(v)
	return _u
}

// SetNillableFailCount sets the "fail_count" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableFailCount(v *int) *BatchImageJobUpdate {
	if v != nil {
		_u.SetFailCount(*v)
	}
	return _u
}

// AddFailCount adds value to the "fail_count" field.
func (_u *BatchImageJobUpdate) AddFailCount(v int) *BatchImageJobUpdate {
	_u.mutation.AddFailCount(v)
	return _u
}

// SetCancelledCount sets the "cancelled_count" field.
func (_u *BatchImageJobUpdate) SetCancelledCount(v int) *BatchImageJobUpdate {
	_u.mutation.ResetCancelledCount()
	_u.mutation.SetCancelledCount(v)
	return _u
}

// SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableCancelledCount(v *int) *BatchImageJobUpdate {
	if v != nil {
		_u.SetCancelledCount(*v)
	}
	return _u
}

// AddCancelledCount adds value to the "cancelled_count" field.
func (_u *BatchImageJobUpdate) AddCancelledCount(v int) *BatchImageJobUpdate {
	_u.mutation.AddCancelledCount(v)
	return _u
}

// SetEstimatedCost sets the "estimated_cost" field.
func (_u *BatchImageJobUpdate) SetEstimatedCost(v float64) *BatchImageJobUpdate {
	_u.mutation.ResetEstimatedCost()
	_u.mutation.SetEstimatedCost(v)
	return _u
}

// SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdate {
	if v != nil {
		_u.SetEstimatedCost(*v)
	}
	return _u
}

// AddEstimatedCost adds value to the "estimated_cost" field.
func (_u *BatchImageJobUpdate) AddEstimatedCost(v float64) *BatchImageJobUpdate {
	_u.mutation.AddEstimatedCost(v)
	return _u
}

// SetHoldAmount sets the "hold_amount" field.
func (_u *BatchImageJobUpdate) SetHoldAmount(v float64) *BatchImageJobUpdate {
	_u.mutation.ResetHoldAmount()
	_u.mutation.SetHoldAmount(v)
	return _u
}

// SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableHoldAmount(v *float64) *BatchImageJobUpdate {
	if v != nil {
		_u.SetHoldAmount(*v)
	}
	return _u
}

// AddHoldAmount adds value to the "hold_amount" field.
func (_u *BatchImageJobUpdate) AddHoldAmount(v float64) *BatchImageJobUpdate {
	_u.mutation.AddHoldAmount(v)
	return _u
}

// ClearHoldAmount clears the value of the "hold_amount" field.
func (_u *BatchImageJobUpdate) ClearHoldAmount() *BatchImageJobUpdate {
	_u.mutation.ClearHoldAmount()
	return _u
}

// SetActualCost sets the "actual_cost" field.
func (_u *BatchImageJobUpdate) SetActualCost(v float64) *BatchImageJobUpdate {
	_u.mutation.ResetActualCost()
	_u.mutation.SetActualCost(v)
	return _u
}

// SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableActualCost(v *float64) *BatchImageJobUpdate {
	if v != nil {
		_u.SetActualCost(*v)
	}
	return _u
}

// AddActualCost adds value to the "actual_cost" field.
func (_u *BatchImageJobUpdate) AddActualCost(v float64) *BatchImageJobUpdate {
	_u.mutation.AddActualCost(v)
	return _u
}

// ClearActualCost clears the value of the "actual_cost" field.
func (_u *BatchImageJobUpdate) ClearActualCost() *BatchImageJobUpdate {
	_u.mutation.ClearActualCost()
	return _u
}

// SetCurrency sets the "currency" field.
func (_u *BatchImageJobUpdate) SetCurrency(v string) *BatchImageJobUpdate {
	_u.mutation.SetCurrency(v)
	return _u
}

// SetNillableCurrency sets the "currency" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableCurrency(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetCurrency(*v)
	}
	return _u
}

// SetHoldID sets the "hold_id" field.
func (_u *BatchImageJobUpdate) SetHoldID(v string) *BatchImageJobUpdate {
	_u.mutation.SetHoldID(v)
	return _u
}

// SetNillableHoldID sets the "hold_id" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableHoldID(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetHoldID(*v)
	}
	return _u
}

// ClearHoldID clears the value of the "hold_id" field.
func (_u *BatchImageJobUpdate) ClearHoldID() *BatchImageJobUpdate {
	_u.mutation.ClearHoldID()
	return _u
}

// SetIdempotencyKey sets the "idempotency_key" field.
func (_u *BatchImageJobUpdate) SetIdempotencyKey(v string) *BatchImageJobUpdate {
	_u.mutation.SetIdempotencyKey(v)
	return _u
}

// SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetIdempotencyKey(*v)
	}
	return _u
}

// ClearIdempotencyKey clears the value of the "idempotency_key" field.
func (_u *BatchImageJobUpdate) ClearIdempotencyKey() *BatchImageJobUpdate {
	_u.mutation.ClearIdempotencyKey()
	return _u
}

// SetRequestHash sets the "request_hash" field.
func (_u *BatchImageJobUpdate) SetRequestHash(v string) *BatchImageJobUpdate {
	_u.mutation.SetRequestHash(v)
	return _u
}

// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableRequestHash(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetRequestHash(*v)
	}
	return _u
}

// ClearRequestHash clears the value of the "request_hash" field.
func (_u *BatchImageJobUpdate) ClearRequestHash() *BatchImageJobUpdate {
	_u.mutation.ClearRequestHash()
	return _u
}

// SetManifestHash sets the "manifest_hash" field.
func (_u *BatchImageJobUpdate) SetManifestHash(v string) *BatchImageJobUpdate {
	_u.mutation.SetManifestHash(v)
	return _u
}

// SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableManifestHash(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetManifestHash(*v)
	}
	return _u
}

// ClearManifestHash clears the value of the "manifest_hash" field.
func (_u *BatchImageJobUpdate) ClearManifestHash() *BatchImageJobUpdate {
	_u.mutation.ClearManifestHash()
	return _u
}

// SetRetryCount sets the "retry_count" field.
func (_u *BatchImageJobUpdate) SetRetryCount(v int) *BatchImageJobUpdate {
	_u.mutation.ResetRetryCount()
	_u.mutation.SetRetryCount(v)
	return _u
}

// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableRetryCount(v *int) *BatchImageJobUpdate {
	if v != nil {
		_u.SetRetryCount(*v)
	}
	return _u
}

// AddRetryCount adds value to the "retry_count" field.
func (_u *BatchImageJobUpdate) AddRetryCount(v int) *BatchImageJobUpdate {
	_u.mutation.AddRetryCount(v)
	return _u
}

// SetVersion sets the "version" field.
func (_u *BatchImageJobUpdate) SetVersion(v int) *BatchImageJobUpdate {
	_u.mutation.ResetVersion()
	_u.mutation.SetVersion(v)
	return _u
}

// SetNillableVersion sets the "version" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableVersion(v *int) *BatchImageJobUpdate {
	if v != nil {
		_u.SetVersion(*v)
	}
	return _u
}

// AddVersion adds value to the "version" field.
func (_u *BatchImageJobUpdate) AddVersion(v int) *BatchImageJobUpdate {
	_u.mutation.AddVersion(v)
	return _u
}

// SetOutputExpiresAt sets the "output_expires_at" field.
func (_u *BatchImageJobUpdate) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetOutputExpiresAt(v)
	return _u
}

// SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetOutputExpiresAt(*v)
	}
	return _u
}

// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
func (_u *BatchImageJobUpdate) ClearOutputExpiresAt() *BatchImageJobUpdate {
	_u.mutation.ClearOutputExpiresAt()
	return _u
}

// SetInputDeletedAt sets the "input_deleted_at" field.
func (_u *BatchImageJobUpdate) SetInputDeletedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetInputDeletedAt(v)
	return _u
}

// SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetInputDeletedAt(*v)
	}
	return _u
}

// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
func (_u *BatchImageJobUpdate) ClearInputDeletedAt() *BatchImageJobUpdate {
	_u.mutation.ClearInputDeletedAt()
	return _u
}

// SetOutputDeletedAt sets the "output_deleted_at" field.
func (_u *BatchImageJobUpdate) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetOutputDeletedAt(v)
	return _u
}

// SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetOutputDeletedAt(*v)
	}
	return _u
}

// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
func (_u *BatchImageJobUpdate) ClearOutputDeletedAt() *BatchImageJobUpdate {
	_u.mutation.ClearOutputDeletedAt()
	return _u
}

// SetDownloadedAt sets the "downloaded_at" field.
func (_u *BatchImageJobUpdate) SetDownloadedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetDownloadedAt(v)
	return _u
}

// SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetDownloadedAt(*v)
	}
	return _u
}

// ClearDownloadedAt clears the value of the "downloaded_at" field.
func (_u *BatchImageJobUpdate) ClearDownloadedAt() *BatchImageJobUpdate {
	_u.mutation.ClearDownloadedAt()
	return _u
}

// SetUserDeletedAt sets the "user_deleted_at" field.
func (_u *BatchImageJobUpdate) SetUserDeletedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetUserDeletedAt(v)
	return _u
}

// SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetUserDeletedAt(*v)
	}
	return _u
}

// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
func (_u *BatchImageJobUpdate) ClearUserDeletedAt() *BatchImageJobUpdate {
	_u.mutation.ClearUserDeletedAt()
	return _u
}

// SetLastErrorCode sets the "last_error_code" field.
func (_u *BatchImageJobUpdate) SetLastErrorCode(v string) *BatchImageJobUpdate {
	_u.mutation.SetLastErrorCode(v)
	return _u
}

// SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableLastErrorCode(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetLastErrorCode(*v)
	}
	return _u
}

// ClearLastErrorCode clears the value of the "last_error_code" field.
func (_u *BatchImageJobUpdate) ClearLastErrorCode() *BatchImageJobUpdate {
	_u.mutation.ClearLastErrorCode()
	return _u
}

// SetLastErrorMessage sets the "last_error_message" field.
func (_u *BatchImageJobUpdate) SetLastErrorMessage(v string) *BatchImageJobUpdate {
	_u.mutation.SetLastErrorMessage(v)
	return _u
}

// SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdate {
	if v != nil {
		_u.SetLastErrorMessage(*v)
	}
	return _u
}

// ClearLastErrorMessage clears the value of the "last_error_message" field.
func (_u *BatchImageJobUpdate) ClearLastErrorMessage() *BatchImageJobUpdate {
	_u.mutation.ClearLastErrorMessage()
	return _u
}

// SetUpdatedAt sets the "updated_at" field.
func (_u *BatchImageJobUpdate) SetUpdatedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetUpdatedAt(v)
	return _u
}

// SetSubmittedAt sets the "submitted_at" field.
func (_u *BatchImageJobUpdate) SetSubmittedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetSubmittedAt(v)
	return _u
}

// SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetSubmittedAt(*v)
	}
	return _u
}

// ClearSubmittedAt clears the value of the "submitted_at" field.
func (_u *BatchImageJobUpdate) ClearSubmittedAt() *BatchImageJobUpdate {
	_u.mutation.ClearSubmittedAt()
	return _u
}

// SetStartedAt sets the "started_at" field.
func (_u *BatchImageJobUpdate) SetStartedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetStartedAt(v)
	return _u
}

// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetStartedAt(*v)
	}
	return _u
}

// ClearStartedAt clears the value of the "started_at" field.
func (_u *BatchImageJobUpdate) ClearStartedAt() *BatchImageJobUpdate {
	_u.mutation.ClearStartedAt()
	return _u
}

// SetFinishedAt sets the "finished_at" field.
func (_u *BatchImageJobUpdate) SetFinishedAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetFinishedAt(v)
	return _u
}

// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetFinishedAt(*v)
	}
	return _u
}

// ClearFinishedAt clears the value of the "finished_at" field.
func (_u *BatchImageJobUpdate) ClearFinishedAt() *BatchImageJobUpdate {
	_u.mutation.ClearFinishedAt()
	return _u
}

// SetSettledAt sets the "settled_at" field.
func (_u *BatchImageJobUpdate) SetSettledAt(v time.Time) *BatchImageJobUpdate {
	_u.mutation.SetSettledAt(v)
	return _u
}

// SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
func (_u *BatchImageJobUpdate) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdate {
	if v != nil {
		_u.SetSettledAt(*v)
	}
	return _u
}

// ClearSettledAt clears the value of the "settled_at" field.
func (_u *BatchImageJobUpdate) ClearSettledAt() *BatchImageJobUpdate {
	_u.mutation.ClearSettledAt()
	return _u
}

// Mutation returns the BatchImageJobMutation object of the builder.
func (_u *BatchImageJobUpdate) Mutation() *BatchImageJobMutation {
	return _u.mutation
}

// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *BatchImageJobUpdate) Save(ctx context.Context) (int, error) {
	_u.defaults()
	return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}

// SaveX is like Save, but panics if an error occurs.
func (_u *BatchImageJobUpdate) SaveX(ctx context.Context) int {
	affected, err := _u.Save(ctx)
	if err != nil {
		panic(err)
	}
	return affected
}

// Exec executes the query.
func (_u *BatchImageJobUpdate) Exec(ctx context.Context) error {
	_, err := _u.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (_u *BatchImageJobUpdate) ExecX(ctx context.Context) {
	if err := _u.Exec(ctx); err != nil {
		panic(err)
	}
}

// defaults sets the default values of the builder before save.
func (_u *BatchImageJobUpdate) defaults() {
	if _, ok := _u.mutation.UpdatedAt(); !ok {
		v := batchimagejob.UpdateDefaultUpdatedAt()
		_u.mutation.SetUpdatedAt(v)
	}
}

// check runs all checks and user-defined validators on the builder.
func (_u *BatchImageJobUpdate) check() error {
	if v, ok := _u.mutation.Provider(); ok {
		if err := batchimagejob.ProviderValidator(v); err != nil {
			return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
		}
	}
	if v, ok := _u.mutation.Model(); ok {
		if err := batchimagejob.ModelValidator(v); err != nil {
			return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
		}
	}
	if v, ok := _u.mutation.TaskName(); ok {
		if err := batchimagejob.TaskNameValidator(v); err != nil {
			return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
		}
	}
	if v, ok := _u.mutation.Status(); ok {
		if err := batchimagejob.StatusValidator(v); err != nil {
			return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ProviderJobName(); ok {
		if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
			return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ProviderInputRef(); ok {
		if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
			return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ProviderOutputRef(); ok {
		if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
			return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
		}
	}
	if v, ok := _u.mutation.GcsInputURI(); ok {
		if err := batchimagejob.GcsInputURIValidator(v); err != nil {
			return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
		}
	}
	if v, ok := _u.mutation.GcsOutputURI(); ok {
		if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
			return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
		}
	}
	if v, ok := _u.mutation.Currency(); ok {
		if err := batchimagejob.CurrencyValidator(v); err != nil {
			return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
		}
	}
	if v, ok := _u.mutation.HoldID(); ok {
		if err := batchimagejob.HoldIDValidator(v); err != nil {
			return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
		}
	}
	if v, ok := _u.mutation.IdempotencyKey(); ok {
		if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
			return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
		}
	}
	if v, ok := _u.mutation.RequestHash(); ok {
		if err := batchimagejob.RequestHashValidator(v); err != nil {
			return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ManifestHash(); ok {
		if err := batchimagejob.ManifestHashValidator(v); err != nil {
			return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
		}
	}
	if v, ok := _u.mutation.LastErrorCode(); ok {
		if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
			return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
		}
	}
	return nil
}

func (_u *BatchImageJobUpdate) sqlSave(ctx context.Context) (_node int, err error) {
	if err := _u.check(); err != nil {
		return _node, err
	}
	_spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
	if ps := _u.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := _u.mutation.UserID(); ok {
		_spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.AddedUserID(); ok {
		_spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.APIKeyID(); ok {
		_spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.AddedAPIKeyID(); ok {
		_spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
	}
	if _u.mutation.APIKeyIDCleared() {
		_spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
	}
	if value, ok := _u.mutation.AccountID(); ok {
		_spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.AddedAccountID(); ok {
		_spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
	}
	if _u.mutation.AccountIDCleared() {
		_spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
	}
	if value, ok := _u.mutation.Provider(); ok {
		_spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
	}
	if value, ok := _u.mutation.Model(); ok {
		_spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
	}
	if value, ok := _u.mutation.TaskName(); ok {
		_spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
	}
	if value, ok := _u.mutation.Status(); ok {
		_spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
	}
	if value, ok := _u.mutation.ProviderJobName(); ok {
		_spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
	}
	if _u.mutation.ProviderJobNameCleared() {
		_spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
	}
	if value, ok := _u.mutation.ProviderInputRef(); ok {
		_spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
	}
	if _u.mutation.ProviderInputRefCleared() {
		_spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
	}
	if value, ok := _u.mutation.ProviderOutputRef(); ok {
		_spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
	}
	if _u.mutation.ProviderOutputRefCleared() {
		_spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
	}
	if value, ok := _u.mutation.GcsInputURI(); ok {
		_spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
	}
	if _u.mutation.GcsInputURICleared() {
		_spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
	}
	if value, ok := _u.mutation.GcsOutputURI(); ok {
		_spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
	}
	if _u.mutation.GcsOutputURICleared() {
		_spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
	}
	if value, ok := _u.mutation.ItemCount(); ok {
		_spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedItemCount(); ok {
		_spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.SuccessCount(); ok {
		_spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedSuccessCount(); ok {
		_spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.FailCount(); ok {
		_spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedFailCount(); ok {
		_spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.CancelledCount(); ok {
		_spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedCancelledCount(); ok {
		_spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.EstimatedCost(); ok {
		_spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.AddedEstimatedCost(); ok {
		_spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.HoldAmount(); ok {
		_spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.AddedHoldAmount(); ok {
		_spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
	}
	if _u.mutation.HoldAmountCleared() {
		_spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
	}
	if value, ok := _u.mutation.ActualCost(); ok {
		_spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.AddedActualCost(); ok {
		_spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
	}
	if _u.mutation.ActualCostCleared() {
		_spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
	}
	if value, ok := _u.mutation.Currency(); ok {
		_spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
	}
	if value, ok := _u.mutation.HoldID(); ok {
		_spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
	}
	if _u.mutation.HoldIDCleared() {
		_spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
	}
	if value, ok := _u.mutation.IdempotencyKey(); ok {
		_spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
	}
	if _u.mutation.IdempotencyKeyCleared() {
		_spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
	}
	if value, ok := _u.mutation.RequestHash(); ok {
		_spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
	}
	if _u.mutation.RequestHashCleared() {
		_spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
	}
	if value, ok := _u.mutation.ManifestHash(); ok {
		_spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
	}
	if _u.mutation.ManifestHashCleared() {
		_spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
	}
	if value, ok := _u.mutation.RetryCount(); ok {
		_spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedRetryCount(); ok {
		_spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.Version(); ok {
		_spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedVersion(); ok {
		_spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
	}
	if value, ok := _u.mutation.OutputExpiresAt(); ok {
		_spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
	}
	if _u.mutation.OutputExpiresAtCleared() {
		_spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
	}
	if value, ok := _u.mutation.InputDeletedAt(); ok {
		_spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
	}
	if _u.mutation.InputDeletedAtCleared() {
		_spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.OutputDeletedAt(); ok {
		_spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
	}
	if _u.mutation.OutputDeletedAtCleared() {
		_spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.DownloadedAt(); ok {
		_spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
	}
	if _u.mutation.DownloadedAtCleared() {
		_spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.UserDeletedAt(); ok {
		_spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
	}
	if _u.mutation.UserDeletedAtCleared() {
		_spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.LastErrorCode(); ok {
		_spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
	}
	if _u.mutation.LastErrorCodeCleared() {
		_spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
	}
	if value, ok := _u.mutation.LastErrorMessage(); ok {
		_spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
	}
	if _u.mutation.LastErrorMessageCleared() {
		_spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
	}
	if value, ok := _u.mutation.UpdatedAt(); ok {
		_spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
	}
	if value, ok := _u.mutation.SubmittedAt(); ok {
		_spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
	}
	if _u.mutation.SubmittedAtCleared() {
		_spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.StartedAt(); ok {
		_spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
	}
	if _u.mutation.StartedAtCleared() {
		_spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.FinishedAt(); ok {
		_spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
	}
	if _u.mutation.FinishedAtCleared() {
		_spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.SettledAt(); ok {
		_spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
	}
	if _u.mutation.SettledAtCleared() {
		_spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
	}
	if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{batchimagejob.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return 0, err
	}
	_u.mutation.done = true
	return _node, nil
}

// BatchImageJobUpdateOne is the builder for updating a single BatchImageJob entity.
type BatchImageJobUpdateOne struct {
	config
	fields   []string
	hooks    []Hook
	mutation *BatchImageJobMutation
}

// SetUserID sets the "user_id" field.
func (_u *BatchImageJobUpdateOne) SetUserID(v int64) *BatchImageJobUpdateOne {
	_u.mutation.ResetUserID()
	_u.mutation.SetUserID(v)
	return _u
}

// SetNillableUserID sets the "user_id" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableUserID(v *int64) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetUserID(*v)
	}
	return _u
}

// AddUserID adds value to the "user_id" field.
func (_u *BatchImageJobUpdateOne) AddUserID(v int64) *BatchImageJobUpdateOne {
	_u.mutation.AddUserID(v)
	return _u
}

// SetAPIKeyID sets the "api_key_id" field.
func (_u *BatchImageJobUpdateOne) SetAPIKeyID(v int64) *BatchImageJobUpdateOne {
	_u.mutation.ResetAPIKeyID()
	_u.mutation.SetAPIKeyID(v)
	return _u
}

// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableAPIKeyID(v *int64) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetAPIKeyID(*v)
	}
	return _u
}

// AddAPIKeyID adds value to the "api_key_id" field.
func (_u *BatchImageJobUpdateOne) AddAPIKeyID(v int64) *BatchImageJobUpdateOne {
	_u.mutation.AddAPIKeyID(v)
	return _u
}

// ClearAPIKeyID clears the value of the "api_key_id" field.
func (_u *BatchImageJobUpdateOne) ClearAPIKeyID() *BatchImageJobUpdateOne {
	_u.mutation.ClearAPIKeyID()
	return _u
}

// SetAccountID sets the "account_id" field.
func (_u *BatchImageJobUpdateOne) SetAccountID(v int64) *BatchImageJobUpdateOne {
	_u.mutation.ResetAccountID()
	_u.mutation.SetAccountID(v)
	return _u
}

// SetNillableAccountID sets the "account_id" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableAccountID(v *int64) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetAccountID(*v)
	}
	return _u
}

// AddAccountID adds value to the "account_id" field.
func (_u *BatchImageJobUpdateOne) AddAccountID(v int64) *BatchImageJobUpdateOne {
	_u.mutation.AddAccountID(v)
	return _u
}

// ClearAccountID clears the value of the "account_id" field.
func (_u *BatchImageJobUpdateOne) ClearAccountID() *BatchImageJobUpdateOne {
	_u.mutation.ClearAccountID()
	return _u
}

// SetProvider sets the "provider" field.
func (_u *BatchImageJobUpdateOne) SetProvider(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetProvider(v)
	return _u
}

// SetNillableProvider sets the "provider" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableProvider(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetProvider(*v)
	}
	return _u
}

// SetModel sets the "model" field.
func (_u *BatchImageJobUpdateOne) SetModel(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetModel(v)
	return _u
}

// SetNillableModel sets the "model" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableModel(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetModel(*v)
	}
	return _u
}

// SetTaskName sets the "task_name" field.
func (_u *BatchImageJobUpdateOne) SetTaskName(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetTaskName(v)
	return _u
}

// SetNillableTaskName sets the "task_name" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableTaskName(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetTaskName(*v)
	}
	return _u
}

// SetStatus sets the "status" field.
func (_u *BatchImageJobUpdateOne) SetStatus(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetStatus(v)
	return _u
}

// SetNillableStatus sets the "status" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableStatus(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetStatus(*v)
	}
	return _u
}

// SetProviderJobName sets the "provider_job_name" field.
func (_u *BatchImageJobUpdateOne) SetProviderJobName(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetProviderJobName(v)
	return _u
}

// SetNillableProviderJobName sets the "provider_job_name" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableProviderJobName(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetProviderJobName(*v)
	}
	return _u
}

// ClearProviderJobName clears the value of the "provider_job_name" field.
func (_u *BatchImageJobUpdateOne) ClearProviderJobName() *BatchImageJobUpdateOne {
	_u.mutation.ClearProviderJobName()
	return _u
}

// SetProviderInputRef sets the "provider_input_ref" field.
func (_u *BatchImageJobUpdateOne) SetProviderInputRef(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetProviderInputRef(v)
	return _u
}

// SetNillableProviderInputRef sets the "provider_input_ref" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableProviderInputRef(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetProviderInputRef(*v)
	}
	return _u
}

// ClearProviderInputRef clears the value of the "provider_input_ref" field.
func (_u *BatchImageJobUpdateOne) ClearProviderInputRef() *BatchImageJobUpdateOne {
	_u.mutation.ClearProviderInputRef()
	return _u
}

// SetProviderOutputRef sets the "provider_output_ref" field.
func (_u *BatchImageJobUpdateOne) SetProviderOutputRef(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetProviderOutputRef(v)
	return _u
}

// SetNillableProviderOutputRef sets the "provider_output_ref" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableProviderOutputRef(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetProviderOutputRef(*v)
	}
	return _u
}

// ClearProviderOutputRef clears the value of the "provider_output_ref" field.
func (_u *BatchImageJobUpdateOne) ClearProviderOutputRef() *BatchImageJobUpdateOne {
	_u.mutation.ClearProviderOutputRef()
	return _u
}

// SetGcsInputURI sets the "gcs_input_uri" field.
func (_u *BatchImageJobUpdateOne) SetGcsInputURI(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetGcsInputURI(v)
	return _u
}

// SetNillableGcsInputURI sets the "gcs_input_uri" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableGcsInputURI(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetGcsInputURI(*v)
	}
	return _u
}

// ClearGcsInputURI clears the value of the "gcs_input_uri" field.
func (_u *BatchImageJobUpdateOne) ClearGcsInputURI() *BatchImageJobUpdateOne {
	_u.mutation.ClearGcsInputURI()
	return _u
}

// SetGcsOutputURI sets the "gcs_output_uri" field.
func (_u *BatchImageJobUpdateOne) SetGcsOutputURI(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetGcsOutputURI(v)
	return _u
}

// SetNillableGcsOutputURI sets the "gcs_output_uri" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableGcsOutputURI(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetGcsOutputURI(*v)
	}
	return _u
}

// ClearGcsOutputURI clears the value of the "gcs_output_uri" field.
func (_u *BatchImageJobUpdateOne) ClearGcsOutputURI() *BatchImageJobUpdateOne {
	_u.mutation.ClearGcsOutputURI()
	return _u
}

// SetItemCount sets the "item_count" field.
func (_u *BatchImageJobUpdateOne) SetItemCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.ResetItemCount()
	_u.mutation.SetItemCount(v)
	return _u
}

// SetNillableItemCount sets the "item_count" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableItemCount(v *int) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetItemCount(*v)
	}
	return _u
}

// AddItemCount adds value to the "item_count" field.
func (_u *BatchImageJobUpdateOne) AddItemCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.AddItemCount(v)
	return _u
}

// SetSuccessCount sets the "success_count" field.
func (_u *BatchImageJobUpdateOne) SetSuccessCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.ResetSuccessCount()
	_u.mutation.SetSuccessCount(v)
	return _u
}

// SetNillableSuccessCount sets the "success_count" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableSuccessCount(v *int) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetSuccessCount(*v)
	}
	return _u
}

// AddSuccessCount adds value to the "success_count" field.
func (_u *BatchImageJobUpdateOne) AddSuccessCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.AddSuccessCount(v)
	return _u
}

// SetFailCount sets the "fail_count" field.
func (_u *BatchImageJobUpdateOne) SetFailCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.ResetFailCount()
	_u.mutation.SetFailCount(v)
	return _u
}

// SetNillableFailCount sets the "fail_count" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableFailCount(v *int) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetFailCount(*v)
	}
	return _u
}

// AddFailCount adds value to the "fail_count" field.
func (_u *BatchImageJobUpdateOne) AddFailCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.AddFailCount(v)
	return _u
}

// SetCancelledCount sets the "cancelled_count" field.
func (_u *BatchImageJobUpdateOne) SetCancelledCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.ResetCancelledCount()
	_u.mutation.SetCancelledCount(v)
	return _u
}

// SetNillableCancelledCount sets the "cancelled_count" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableCancelledCount(v *int) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetCancelledCount(*v)
	}
	return _u
}

// AddCancelledCount adds value to the "cancelled_count" field.
func (_u *BatchImageJobUpdateOne) AddCancelledCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.AddCancelledCount(v)
	return _u
}

// SetEstimatedCost sets the "estimated_cost" field.
func (_u *BatchImageJobUpdateOne) SetEstimatedCost(v float64) *BatchImageJobUpdateOne {
	_u.mutation.ResetEstimatedCost()
	_u.mutation.SetEstimatedCost(v)
	return _u
}

// SetNillableEstimatedCost sets the "estimated_cost" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableEstimatedCost(v *float64) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetEstimatedCost(*v)
	}
	return _u
}

// AddEstimatedCost adds value to the "estimated_cost" field.
func (_u *BatchImageJobUpdateOne) AddEstimatedCost(v float64) *BatchImageJobUpdateOne {
	_u.mutation.AddEstimatedCost(v)
	return _u
}

// SetHoldAmount sets the "hold_amount" field.
func (_u *BatchImageJobUpdateOne) SetHoldAmount(v float64) *BatchImageJobUpdateOne {
	_u.mutation.ResetHoldAmount()
	_u.mutation.SetHoldAmount(v)
	return _u
}

// SetNillableHoldAmount sets the "hold_amount" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableHoldAmount(v *float64) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetHoldAmount(*v)
	}
	return _u
}

// AddHoldAmount adds value to the "hold_amount" field.
func (_u *BatchImageJobUpdateOne) AddHoldAmount(v float64) *BatchImageJobUpdateOne {
	_u.mutation.AddHoldAmount(v)
	return _u
}

// ClearHoldAmount clears the value of the "hold_amount" field.
func (_u *BatchImageJobUpdateOne) ClearHoldAmount() *BatchImageJobUpdateOne {
	_u.mutation.ClearHoldAmount()
	return _u
}

// SetActualCost sets the "actual_cost" field.
func (_u *BatchImageJobUpdateOne) SetActualCost(v float64) *BatchImageJobUpdateOne {
	_u.mutation.ResetActualCost()
	_u.mutation.SetActualCost(v)
	return _u
}

// SetNillableActualCost sets the "actual_cost" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableActualCost(v *float64) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetActualCost(*v)
	}
	return _u
}

// AddActualCost adds value to the "actual_cost" field.
func (_u *BatchImageJobUpdateOne) AddActualCost(v float64) *BatchImageJobUpdateOne {
	_u.mutation.AddActualCost(v)
	return _u
}

// ClearActualCost clears the value of the "actual_cost" field.
func (_u *BatchImageJobUpdateOne) ClearActualCost() *BatchImageJobUpdateOne {
	_u.mutation.ClearActualCost()
	return _u
}

// SetCurrency sets the "currency" field.
func (_u *BatchImageJobUpdateOne) SetCurrency(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetCurrency(v)
	return _u
}

// SetNillableCurrency sets the "currency" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableCurrency(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetCurrency(*v)
	}
	return _u
}

// SetHoldID sets the "hold_id" field.
func (_u *BatchImageJobUpdateOne) SetHoldID(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetHoldID(v)
	return _u
}

// SetNillableHoldID sets the "hold_id" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableHoldID(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetHoldID(*v)
	}
	return _u
}

// ClearHoldID clears the value of the "hold_id" field.
func (_u *BatchImageJobUpdateOne) ClearHoldID() *BatchImageJobUpdateOne {
	_u.mutation.ClearHoldID()
	return _u
}

// SetIdempotencyKey sets the "idempotency_key" field.
func (_u *BatchImageJobUpdateOne) SetIdempotencyKey(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetIdempotencyKey(v)
	return _u
}

// SetNillableIdempotencyKey sets the "idempotency_key" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableIdempotencyKey(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetIdempotencyKey(*v)
	}
	return _u
}

// ClearIdempotencyKey clears the value of the "idempotency_key" field.
func (_u *BatchImageJobUpdateOne) ClearIdempotencyKey() *BatchImageJobUpdateOne {
	_u.mutation.ClearIdempotencyKey()
	return _u
}

// SetRequestHash sets the "request_hash" field.
func (_u *BatchImageJobUpdateOne) SetRequestHash(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetRequestHash(v)
	return _u
}

// SetNillableRequestHash sets the "request_hash" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableRequestHash(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetRequestHash(*v)
	}
	return _u
}

// ClearRequestHash clears the value of the "request_hash" field.
func (_u *BatchImageJobUpdateOne) ClearRequestHash() *BatchImageJobUpdateOne {
	_u.mutation.ClearRequestHash()
	return _u
}

// SetManifestHash sets the "manifest_hash" field.
func (_u *BatchImageJobUpdateOne) SetManifestHash(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetManifestHash(v)
	return _u
}

// SetNillableManifestHash sets the "manifest_hash" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableManifestHash(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetManifestHash(*v)
	}
	return _u
}

// ClearManifestHash clears the value of the "manifest_hash" field.
func (_u *BatchImageJobUpdateOne) ClearManifestHash() *BatchImageJobUpdateOne {
	_u.mutation.ClearManifestHash()
	return _u
}

// SetRetryCount sets the "retry_count" field.
func (_u *BatchImageJobUpdateOne) SetRetryCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.ResetRetryCount()
	_u.mutation.SetRetryCount(v)
	return _u
}

// SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableRetryCount(v *int) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetRetryCount(*v)
	}
	return _u
}

// AddRetryCount adds value to the "retry_count" field.
func (_u *BatchImageJobUpdateOne) AddRetryCount(v int) *BatchImageJobUpdateOne {
	_u.mutation.AddRetryCount(v)
	return _u
}

// SetVersion sets the "version" field.
func (_u *BatchImageJobUpdateOne) SetVersion(v int) *BatchImageJobUpdateOne {
	_u.mutation.ResetVersion()
	_u.mutation.SetVersion(v)
	return _u
}

// SetNillableVersion sets the "version" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableVersion(v *int) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetVersion(*v)
	}
	return _u
}

// AddVersion adds value to the "version" field.
func (_u *BatchImageJobUpdateOne) AddVersion(v int) *BatchImageJobUpdateOne {
	_u.mutation.AddVersion(v)
	return _u
}

// SetOutputExpiresAt sets the "output_expires_at" field.
func (_u *BatchImageJobUpdateOne) SetOutputExpiresAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetOutputExpiresAt(v)
	return _u
}

// SetNillableOutputExpiresAt sets the "output_expires_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableOutputExpiresAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetOutputExpiresAt(*v)
	}
	return _u
}

// ClearOutputExpiresAt clears the value of the "output_expires_at" field.
func (_u *BatchImageJobUpdateOne) ClearOutputExpiresAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearOutputExpiresAt()
	return _u
}

// SetInputDeletedAt sets the "input_deleted_at" field.
func (_u *BatchImageJobUpdateOne) SetInputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetInputDeletedAt(v)
	return _u
}

// SetNillableInputDeletedAt sets the "input_deleted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableInputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetInputDeletedAt(*v)
	}
	return _u
}

// ClearInputDeletedAt clears the value of the "input_deleted_at" field.
func (_u *BatchImageJobUpdateOne) ClearInputDeletedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearInputDeletedAt()
	return _u
}

// SetOutputDeletedAt sets the "output_deleted_at" field.
func (_u *BatchImageJobUpdateOne) SetOutputDeletedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetOutputDeletedAt(v)
	return _u
}

// SetNillableOutputDeletedAt sets the "output_deleted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableOutputDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetOutputDeletedAt(*v)
	}
	return _u
}

// ClearOutputDeletedAt clears the value of the "output_deleted_at" field.
func (_u *BatchImageJobUpdateOne) ClearOutputDeletedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearOutputDeletedAt()
	return _u
}

// SetDownloadedAt sets the "downloaded_at" field.
func (_u *BatchImageJobUpdateOne) SetDownloadedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetDownloadedAt(v)
	return _u
}

// SetNillableDownloadedAt sets the "downloaded_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableDownloadedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetDownloadedAt(*v)
	}
	return _u
}

// ClearDownloadedAt clears the value of the "downloaded_at" field.
func (_u *BatchImageJobUpdateOne) ClearDownloadedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearDownloadedAt()
	return _u
}

// SetUserDeletedAt sets the "user_deleted_at" field.
func (_u *BatchImageJobUpdateOne) SetUserDeletedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetUserDeletedAt(v)
	return _u
}

// SetNillableUserDeletedAt sets the "user_deleted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableUserDeletedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetUserDeletedAt(*v)
	}
	return _u
}

// ClearUserDeletedAt clears the value of the "user_deleted_at" field.
func (_u *BatchImageJobUpdateOne) ClearUserDeletedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearUserDeletedAt()
	return _u
}

// SetLastErrorCode sets the "last_error_code" field.
func (_u *BatchImageJobUpdateOne) SetLastErrorCode(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetLastErrorCode(v)
	return _u
}

// SetNillableLastErrorCode sets the "last_error_code" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableLastErrorCode(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetLastErrorCode(*v)
	}
	return _u
}

// ClearLastErrorCode clears the value of the "last_error_code" field.
func (_u *BatchImageJobUpdateOne) ClearLastErrorCode() *BatchImageJobUpdateOne {
	_u.mutation.ClearLastErrorCode()
	return _u
}

// SetLastErrorMessage sets the "last_error_message" field.
func (_u *BatchImageJobUpdateOne) SetLastErrorMessage(v string) *BatchImageJobUpdateOne {
	_u.mutation.SetLastErrorMessage(v)
	return _u
}

// SetNillableLastErrorMessage sets the "last_error_message" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableLastErrorMessage(v *string) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetLastErrorMessage(*v)
	}
	return _u
}

// ClearLastErrorMessage clears the value of the "last_error_message" field.
func (_u *BatchImageJobUpdateOne) ClearLastErrorMessage() *BatchImageJobUpdateOne {
	_u.mutation.ClearLastErrorMessage()
	return _u
}

// SetUpdatedAt sets the "updated_at" field.
func (_u *BatchImageJobUpdateOne) SetUpdatedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetUpdatedAt(v)
	return _u
}

// SetSubmittedAt sets the "submitted_at" field.
func (_u *BatchImageJobUpdateOne) SetSubmittedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetSubmittedAt(v)
	return _u
}

// SetNillableSubmittedAt sets the "submitted_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableSubmittedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetSubmittedAt(*v)
	}
	return _u
}

// ClearSubmittedAt clears the value of the "submitted_at" field.
func (_u *BatchImageJobUpdateOne) ClearSubmittedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearSubmittedAt()
	return _u
}

// SetStartedAt sets the "started_at" field.
func (_u *BatchImageJobUpdateOne) SetStartedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetStartedAt(v)
	return _u
}

// SetNillableStartedAt sets the "started_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableStartedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetStartedAt(*v)
	}
	return _u
}

// ClearStartedAt clears the value of the "started_at" field.
func (_u *BatchImageJobUpdateOne) ClearStartedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearStartedAt()
	return _u
}

// SetFinishedAt sets the "finished_at" field.
func (_u *BatchImageJobUpdateOne) SetFinishedAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetFinishedAt(v)
	return _u
}

// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableFinishedAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetFinishedAt(*v)
	}
	return _u
}

// ClearFinishedAt clears the value of the "finished_at" field.
func (_u *BatchImageJobUpdateOne) ClearFinishedAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearFinishedAt()
	return _u
}

// SetSettledAt sets the "settled_at" field.
func (_u *BatchImageJobUpdateOne) SetSettledAt(v time.Time) *BatchImageJobUpdateOne {
	_u.mutation.SetSettledAt(v)
	return _u
}

// SetNillableSettledAt sets the "settled_at" field if the given value is not nil.
func (_u *BatchImageJobUpdateOne) SetNillableSettledAt(v *time.Time) *BatchImageJobUpdateOne {
	if v != nil {
		_u.SetSettledAt(*v)
	}
	return _u
}

// ClearSettledAt clears the value of the "settled_at" field.
func (_u *BatchImageJobUpdateOne) ClearSettledAt() *BatchImageJobUpdateOne {
	_u.mutation.ClearSettledAt()
	return _u
}

// Mutation returns the BatchImageJobMutation object of the builder.
func (_u *BatchImageJobUpdateOne) Mutation() *BatchImageJobMutation {
	return _u.mutation
}

// Where appends a list predicates to the BatchImageJobUpdate builder.
func (_u *BatchImageJobUpdateOne) Where(ps ...predicate.BatchImageJob) *BatchImageJobUpdateOne {
	_u.mutation.Where(ps...)
	return _u
}

// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (_u *BatchImageJobUpdateOne) Select(field string, fields ...string) *BatchImageJobUpdateOne {
	_u.fields = append([]string{field}, fields...)
	return _u
}

// Save executes the query and returns the updated BatchImageJob entity.
func (_u *BatchImageJobUpdateOne) Save(ctx context.Context) (*BatchImageJob, error) {
	_u.defaults()
	return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}

// SaveX is like Save, but panics if an error occurs.
func (_u *BatchImageJobUpdateOne) SaveX(ctx context.Context) *BatchImageJob {
	node, err := _u.Save(ctx)
	if err != nil {
		panic(err)
	}
	return node
}

// Exec executes the query on the entity.
func (_u *BatchImageJobUpdateOne) Exec(ctx context.Context) error {
	_, err := _u.Save(ctx)
	return err
}

// ExecX is like Exec, but panics if an error occurs.
func (_u *BatchImageJobUpdateOne) ExecX(ctx context.Context) {
	if err := _u.Exec(ctx); err != nil {
		panic(err)
	}
}

// defaults sets the default values of the builder before save.
func (_u *BatchImageJobUpdateOne) defaults() {
	if _, ok := _u.mutation.UpdatedAt(); !ok {
		v := batchimagejob.UpdateDefaultUpdatedAt()
		_u.mutation.SetUpdatedAt(v)
	}
}

// check runs all checks and user-defined validators on the builder.
func (_u *BatchImageJobUpdateOne) check() error {
	if v, ok := _u.mutation.Provider(); ok {
		if err := batchimagejob.ProviderValidator(v); err != nil {
			return &ValidationError{Name: "provider", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider": %w`, err)}
		}
	}
	if v, ok := _u.mutation.Model(); ok {
		if err := batchimagejob.ModelValidator(v); err != nil {
			return &ValidationError{Name: "model", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.model": %w`, err)}
		}
	}
	if v, ok := _u.mutation.TaskName(); ok {
		if err := batchimagejob.TaskNameValidator(v); err != nil {
			return &ValidationError{Name: "task_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.task_name": %w`, err)}
		}
	}
	if v, ok := _u.mutation.Status(); ok {
		if err := batchimagejob.StatusValidator(v); err != nil {
			return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.status": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ProviderJobName(); ok {
		if err := batchimagejob.ProviderJobNameValidator(v); err != nil {
			return &ValidationError{Name: "provider_job_name", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_job_name": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ProviderInputRef(); ok {
		if err := batchimagejob.ProviderInputRefValidator(v); err != nil {
			return &ValidationError{Name: "provider_input_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_input_ref": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ProviderOutputRef(); ok {
		if err := batchimagejob.ProviderOutputRefValidator(v); err != nil {
			return &ValidationError{Name: "provider_output_ref", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.provider_output_ref": %w`, err)}
		}
	}
	if v, ok := _u.mutation.GcsInputURI(); ok {
		if err := batchimagejob.GcsInputURIValidator(v); err != nil {
			return &ValidationError{Name: "gcs_input_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_input_uri": %w`, err)}
		}
	}
	if v, ok := _u.mutation.GcsOutputURI(); ok {
		if err := batchimagejob.GcsOutputURIValidator(v); err != nil {
			return &ValidationError{Name: "gcs_output_uri", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.gcs_output_uri": %w`, err)}
		}
	}
	if v, ok := _u.mutation.Currency(); ok {
		if err := batchimagejob.CurrencyValidator(v); err != nil {
			return &ValidationError{Name: "currency", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.currency": %w`, err)}
		}
	}
	if v, ok := _u.mutation.HoldID(); ok {
		if err := batchimagejob.HoldIDValidator(v); err != nil {
			return &ValidationError{Name: "hold_id", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.hold_id": %w`, err)}
		}
	}
	if v, ok := _u.mutation.IdempotencyKey(); ok {
		if err := batchimagejob.IdempotencyKeyValidator(v); err != nil {
			return &ValidationError{Name: "idempotency_key", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.idempotency_key": %w`, err)}
		}
	}
	if v, ok := _u.mutation.RequestHash(); ok {
		if err := batchimagejob.RequestHashValidator(v); err != nil {
			return &ValidationError{Name: "request_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.request_hash": %w`, err)}
		}
	}
	if v, ok := _u.mutation.ManifestHash(); ok {
		if err := batchimagejob.ManifestHashValidator(v); err != nil {
			return &ValidationError{Name: "manifest_hash", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.manifest_hash": %w`, err)}
		}
	}
	if v, ok := _u.mutation.LastErrorCode(); ok {
		if err := batchimagejob.LastErrorCodeValidator(v); err != nil {
			return &ValidationError{Name: "last_error_code", err: fmt.Errorf(`ent: validator failed for field "BatchImageJob.last_error_code": %w`, err)}
		}
	}
	return nil
}

func (_u *BatchImageJobUpdateOne) sqlSave(ctx context.Context) (_node *BatchImageJob, err error) {
	if err := _u.check(); err != nil {
		return _node, err
	}
	_spec := sqlgraph.NewUpdateSpec(batchimagejob.Table, batchimagejob.Columns, sqlgraph.NewFieldSpec(batchimagejob.FieldID, field.TypeInt64))
	id, ok := _u.mutation.ID()
	if !ok {
		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "BatchImageJob.id" for update`)}
	}
	_spec.Node.ID.Value = id
	if fields := _u.fields; len(fields) > 0 {
		_spec.Node.Columns = make([]string, 0, len(fields))
		_spec.Node.Columns = append(_spec.Node.Columns, batchimagejob.FieldID)
		for _, f := range fields {
			if !batchimagejob.ValidColumn(f) {
				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
			}
			if f != batchimagejob.FieldID {
				_spec.Node.Columns = append(_spec.Node.Columns, f)
			}
		}
	}
	if ps := _u.mutation.predicates; len(ps) > 0 {
		_spec.Predicate = func(selector *sql.Selector) {
			for i := range ps {
				ps[i](selector)
			}
		}
	}
	if value, ok := _u.mutation.UserID(); ok {
		_spec.SetField(batchimagejob.FieldUserID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.AddedUserID(); ok {
		_spec.AddField(batchimagejob.FieldUserID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.APIKeyID(); ok {
		_spec.SetField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.AddedAPIKeyID(); ok {
		_spec.AddField(batchimagejob.FieldAPIKeyID, field.TypeInt64, value)
	}
	if _u.mutation.APIKeyIDCleared() {
		_spec.ClearField(batchimagejob.FieldAPIKeyID, field.TypeInt64)
	}
	if value, ok := _u.mutation.AccountID(); ok {
		_spec.SetField(batchimagejob.FieldAccountID, field.TypeInt64, value)
	}
	if value, ok := _u.mutation.AddedAccountID(); ok {
		_spec.AddField(batchimagejob.FieldAccountID, field.TypeInt64, value)
	}
	if _u.mutation.AccountIDCleared() {
		_spec.ClearField(batchimagejob.FieldAccountID, field.TypeInt64)
	}
	if value, ok := _u.mutation.Provider(); ok {
		_spec.SetField(batchimagejob.FieldProvider, field.TypeString, value)
	}
	if value, ok := _u.mutation.Model(); ok {
		_spec.SetField(batchimagejob.FieldModel, field.TypeString, value)
	}
	if value, ok := _u.mutation.TaskName(); ok {
		_spec.SetField(batchimagejob.FieldTaskName, field.TypeString, value)
	}
	if value, ok := _u.mutation.Status(); ok {
		_spec.SetField(batchimagejob.FieldStatus, field.TypeString, value)
	}
	if value, ok := _u.mutation.ProviderJobName(); ok {
		_spec.SetField(batchimagejob.FieldProviderJobName, field.TypeString, value)
	}
	if _u.mutation.ProviderJobNameCleared() {
		_spec.ClearField(batchimagejob.FieldProviderJobName, field.TypeString)
	}
	if value, ok := _u.mutation.ProviderInputRef(); ok {
		_spec.SetField(batchimagejob.FieldProviderInputRef, field.TypeString, value)
	}
	if _u.mutation.ProviderInputRefCleared() {
		_spec.ClearField(batchimagejob.FieldProviderInputRef, field.TypeString)
	}
	if value, ok := _u.mutation.ProviderOutputRef(); ok {
		_spec.SetField(batchimagejob.FieldProviderOutputRef, field.TypeString, value)
	}
	if _u.mutation.ProviderOutputRefCleared() {
		_spec.ClearField(batchimagejob.FieldProviderOutputRef, field.TypeString)
	}
	if value, ok := _u.mutation.GcsInputURI(); ok {
		_spec.SetField(batchimagejob.FieldGcsInputURI, field.TypeString, value)
	}
	if _u.mutation.GcsInputURICleared() {
		_spec.ClearField(batchimagejob.FieldGcsInputURI, field.TypeString)
	}
	if value, ok := _u.mutation.GcsOutputURI(); ok {
		_spec.SetField(batchimagejob.FieldGcsOutputURI, field.TypeString, value)
	}
	if _u.mutation.GcsOutputURICleared() {
		_spec.ClearField(batchimagejob.FieldGcsOutputURI, field.TypeString)
	}
	if value, ok := _u.mutation.ItemCount(); ok {
		_spec.SetField(batchimagejob.FieldItemCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedItemCount(); ok {
		_spec.AddField(batchimagejob.FieldItemCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.SuccessCount(); ok {
		_spec.SetField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedSuccessCount(); ok {
		_spec.AddField(batchimagejob.FieldSuccessCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.FailCount(); ok {
		_spec.SetField(batchimagejob.FieldFailCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedFailCount(); ok {
		_spec.AddField(batchimagejob.FieldFailCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.CancelledCount(); ok {
		_spec.SetField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedCancelledCount(); ok {
		_spec.AddField(batchimagejob.FieldCancelledCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.EstimatedCost(); ok {
		_spec.SetField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.AddedEstimatedCost(); ok {
		_spec.AddField(batchimagejob.FieldEstimatedCost, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.HoldAmount(); ok {
		_spec.SetField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.AddedHoldAmount(); ok {
		_spec.AddField(batchimagejob.FieldHoldAmount, field.TypeFloat64, value)
	}
	if _u.mutation.HoldAmountCleared() {
		_spec.ClearField(batchimagejob.FieldHoldAmount, field.TypeFloat64)
	}
	if value, ok := _u.mutation.ActualCost(); ok {
		_spec.SetField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
	}
	if value, ok := _u.mutation.AddedActualCost(); ok {
		_spec.AddField(batchimagejob.FieldActualCost, field.TypeFloat64, value)
	}
	if _u.mutation.ActualCostCleared() {
		_spec.ClearField(batchimagejob.FieldActualCost, field.TypeFloat64)
	}
	if value, ok := _u.mutation.Currency(); ok {
		_spec.SetField(batchimagejob.FieldCurrency, field.TypeString, value)
	}
	if value, ok := _u.mutation.HoldID(); ok {
		_spec.SetField(batchimagejob.FieldHoldID, field.TypeString, value)
	}
	if _u.mutation.HoldIDCleared() {
		_spec.ClearField(batchimagejob.FieldHoldID, field.TypeString)
	}
	if value, ok := _u.mutation.IdempotencyKey(); ok {
		_spec.SetField(batchimagejob.FieldIdempotencyKey, field.TypeString, value)
	}
	if _u.mutation.IdempotencyKeyCleared() {
		_spec.ClearField(batchimagejob.FieldIdempotencyKey, field.TypeString)
	}
	if value, ok := _u.mutation.RequestHash(); ok {
		_spec.SetField(batchimagejob.FieldRequestHash, field.TypeString, value)
	}
	if _u.mutation.RequestHashCleared() {
		_spec.ClearField(batchimagejob.FieldRequestHash, field.TypeString)
	}
	if value, ok := _u.mutation.ManifestHash(); ok {
		_spec.SetField(batchimagejob.FieldManifestHash, field.TypeString, value)
	}
	if _u.mutation.ManifestHashCleared() {
		_spec.ClearField(batchimagejob.FieldManifestHash, field.TypeString)
	}
	if value, ok := _u.mutation.RetryCount(); ok {
		_spec.SetField(batchimagejob.FieldRetryCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedRetryCount(); ok {
		_spec.AddField(batchimagejob.FieldRetryCount, field.TypeInt, value)
	}
	if value, ok := _u.mutation.Version(); ok {
		_spec.SetField(batchimagejob.FieldVersion, field.TypeInt, value)
	}
	if value, ok := _u.mutation.AddedVersion(); ok {
		_spec.AddField(batchimagejob.FieldVersion, field.TypeInt, value)
	}
	if value, ok := _u.mutation.OutputExpiresAt(); ok {
		_spec.SetField(batchimagejob.FieldOutputExpiresAt, field.TypeTime, value)
	}
	if _u.mutation.OutputExpiresAtCleared() {
		_spec.ClearField(batchimagejob.FieldOutputExpiresAt, field.TypeTime)
	}
	if value, ok := _u.mutation.InputDeletedAt(); ok {
		_spec.SetField(batchimagejob.FieldInputDeletedAt, field.TypeTime, value)
	}
	if _u.mutation.InputDeletedAtCleared() {
		_spec.ClearField(batchimagejob.FieldInputDeletedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.OutputDeletedAt(); ok {
		_spec.SetField(batchimagejob.FieldOutputDeletedAt, field.TypeTime, value)
	}
	if _u.mutation.OutputDeletedAtCleared() {
		_spec.ClearField(batchimagejob.FieldOutputDeletedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.DownloadedAt(); ok {
		_spec.SetField(batchimagejob.FieldDownloadedAt, field.TypeTime, value)
	}
	if _u.mutation.DownloadedAtCleared() {
		_spec.ClearField(batchimagejob.FieldDownloadedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.UserDeletedAt(); ok {
		_spec.SetField(batchimagejob.FieldUserDeletedAt, field.TypeTime, value)
	}
	if _u.mutation.UserDeletedAtCleared() {
		_spec.ClearField(batchimagejob.FieldUserDeletedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.LastErrorCode(); ok {
		_spec.SetField(batchimagejob.FieldLastErrorCode, field.TypeString, value)
	}
	if _u.mutation.LastErrorCodeCleared() {
		_spec.ClearField(batchimagejob.FieldLastErrorCode, field.TypeString)
	}
	if value, ok := _u.mutation.LastErrorMessage(); ok {
		_spec.SetField(batchimagejob.FieldLastErrorMessage, field.TypeString, value)
	}
	if _u.mutation.LastErrorMessageCleared() {
		_spec.ClearField(batchimagejob.FieldLastErrorMessage, field.TypeString)
	}
	if value, ok := _u.mutation.UpdatedAt(); ok {
		_spec.SetField(batchimagejob.FieldUpdatedAt, field.TypeTime, value)
	}
	if value, ok := _u.mutation.SubmittedAt(); ok {
		_spec.SetField(batchimagejob.FieldSubmittedAt, field.TypeTime, value)
	}
	if _u.mutation.SubmittedAtCleared() {
		_spec.ClearField(batchimagejob.FieldSubmittedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.StartedAt(); ok {
		_spec.SetField(batchimagejob.FieldStartedAt, field.TypeTime, value)
	}
	if _u.mutation.StartedAtCleared() {
		_spec.ClearField(batchimagejob.FieldStartedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.FinishedAt(); ok {
		_spec.SetField(batchimagejob.FieldFinishedAt, field.TypeTime, value)
	}
	if _u.mutation.FinishedAtCleared() {
		_spec.ClearField(batchimagejob.FieldFinishedAt, field.TypeTime)
	}
	if value, ok := _u.mutation.SettledAt(); ok {
		_spec.SetField(batchimagejob.FieldSettledAt, field.TypeTime, value)
	}
	if _u.mutation.SettledAtCleared() {
		_spec.ClearField(batchimagejob.FieldSettledAt, field.TypeTime)
	}
	_node = &BatchImageJob{config: _u.config}
	_spec.Assign = _node.assignValues
	_spec.ScanValues = _node.scanValues
	if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
		if _, ok := err.(*sqlgraph.NotFoundError); ok {
			err = &NotFoundError{batchimagejob.Label}
		} else if sqlgraph.IsConstraintError(err) {
			err = &ConstraintError{msg: err.Error(), wrap: err}
		}
		return nil, err
	}
	_u.mutation.done = true
	return _node, nil
}
