// Code generated by ent, DO NOT EDIT.

package models

import (
	"context"
	"errors"
	"fmt"
	"juwan-backend/app/order/rpc/internal/models/orders"
	"juwan-backend/app/order/rpc/internal/models/orderstatelogs"
	"juwan-backend/app/order/rpc/internal/models/predicate"
	"sync"
	"time"

	"entgo.io/ent"
	"entgo.io/ent/dialect/sql"
	"github.com/shopspring/decimal"
)

const (
	// Operation types.
	OpCreate    = ent.OpCreate
	OpDelete    = ent.OpDelete
	OpDeleteOne = ent.OpDeleteOne
	OpUpdate    = ent.OpUpdate
	OpUpdateOne = ent.OpUpdateOne

	// Node types.
	TypeOrderStateLogs = "OrderStateLogs"
	TypeOrders         = "Orders"
)

// OrderStateLogsMutation represents an operation that mutates the OrderStateLogs nodes in the graph.
type OrderStateLogsMutation struct {
	config
	op            Op
	typ           string
	id            *int64
	order_id      *int64
	addorder_id   *int64
	from_status   *string
	to_status     *string
	action        *string
	actor_id      *int64
	addactor_id   *int64
	actor_role    *string
	metadata      *map[string]interface{}
	created_at    *time.Time
	clearedFields map[string]struct{}
	done          bool
	oldValue      func(context.Context) (*OrderStateLogs, error)
	predicates    []predicate.OrderStateLogs
}

var _ ent.Mutation = (*OrderStateLogsMutation)(nil)

// orderstatelogsOption allows management of the mutation configuration using functional options.
type orderstatelogsOption func(*OrderStateLogsMutation)

// newOrderStateLogsMutation creates new mutation for the OrderStateLogs entity.
func newOrderStateLogsMutation(c config, op Op, opts ...orderstatelogsOption) *OrderStateLogsMutation {
	m := &OrderStateLogsMutation{
		config:        c,
		op:            op,
		typ:           TypeOrderStateLogs,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}

// withOrderStateLogsID sets the ID field of the mutation.
func withOrderStateLogsID(id int64) orderstatelogsOption {
	return func(m *OrderStateLogsMutation) {
		var (
			err   error
			once  sync.Once
			value *OrderStateLogs
		)
		m.oldValue = func(ctx context.Context) (*OrderStateLogs, error) {
			once.Do(func() {
				if m.done {
					err = errors.New("querying old values post mutation is not allowed")
				} else {
					value, err = m.Client().OrderStateLogs.Get(ctx, id)
				}
			})
			return value, err
		}
		m.id = &id
	}
}

// withOrderStateLogs sets the old OrderStateLogs of the mutation.
func withOrderStateLogs(node *OrderStateLogs) orderstatelogsOption {
	return func(m *OrderStateLogsMutation) {
		m.oldValue = func(context.Context) (*OrderStateLogs, error) {
			return node, nil
		}
		m.id = &node.ID
	}
}

// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m OrderStateLogsMutation) Client() *Client {
	client := &Client{config: m.config}
	client.init()
	return client
}

// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m OrderStateLogsMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, errors.New("models: mutation is not running in a transaction")
	}
	tx := &Tx{config: m.config}
	tx.init()
	return tx, nil
}

// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of OrderStateLogs entities.
func (m *OrderStateLogsMutation) SetID(id int64) {
	m.id = &id
}

// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *OrderStateLogsMutation) ID() (id int64, exists bool) {
	if m.id == nil {
		return
	}
	return *m.id, true
}

// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *OrderStateLogsMutation) IDs(ctx context.Context) ([]int64, error) {
	switch {
	case m.op.Is(OpUpdateOne | OpDeleteOne):
		id, exists := m.ID()
		if exists {
			return []int64{id}, nil
		}
		fallthrough
	case m.op.Is(OpUpdate | OpDelete):
		return m.Client().OrderStateLogs.Query().Where(m.predicates...).IDs(ctx)
	default:
		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
	}
}

// SetOrderID sets the "order_id" field.
func (m *OrderStateLogsMutation) SetOrderID(i int64) {
	m.order_id = &i
	m.addorder_id = nil
}

// OrderID returns the value of the "order_id" field in the mutation.
func (m *OrderStateLogsMutation) OrderID() (r int64, exists bool) {
	v := m.order_id
	if v == nil {
		return
	}
	return *v, true
}

// OldOrderID returns the old "order_id" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldOrderID(ctx context.Context) (v int64, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldOrderID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldOrderID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldOrderID: %w", err)
	}
	return oldValue.OrderID, nil
}

// AddOrderID adds i to the "order_id" field.
func (m *OrderStateLogsMutation) AddOrderID(i int64) {
	if m.addorder_id != nil {
		*m.addorder_id += i
	} else {
		m.addorder_id = &i
	}
}

// AddedOrderID returns the value that was added to the "order_id" field in this mutation.
func (m *OrderStateLogsMutation) AddedOrderID() (r int64, exists bool) {
	v := m.addorder_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetOrderID resets all changes to the "order_id" field.
func (m *OrderStateLogsMutation) ResetOrderID() {
	m.order_id = nil
	m.addorder_id = nil
}

// SetFromStatus sets the "from_status" field.
func (m *OrderStateLogsMutation) SetFromStatus(s string) {
	m.from_status = &s
}

// FromStatus returns the value of the "from_status" field in the mutation.
func (m *OrderStateLogsMutation) FromStatus() (r string, exists bool) {
	v := m.from_status
	if v == nil {
		return
	}
	return *v, true
}

// OldFromStatus returns the old "from_status" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldFromStatus(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldFromStatus is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldFromStatus requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldFromStatus: %w", err)
	}
	return oldValue.FromStatus, nil
}

// ClearFromStatus clears the value of the "from_status" field.
func (m *OrderStateLogsMutation) ClearFromStatus() {
	m.from_status = nil
	m.clearedFields[orderstatelogs.FieldFromStatus] = struct{}{}
}

// FromStatusCleared returns if the "from_status" field was cleared in this mutation.
func (m *OrderStateLogsMutation) FromStatusCleared() bool {
	_, ok := m.clearedFields[orderstatelogs.FieldFromStatus]
	return ok
}

// ResetFromStatus resets all changes to the "from_status" field.
func (m *OrderStateLogsMutation) ResetFromStatus() {
	m.from_status = nil
	delete(m.clearedFields, orderstatelogs.FieldFromStatus)
}

// SetToStatus sets the "to_status" field.
func (m *OrderStateLogsMutation) SetToStatus(s string) {
	m.to_status = &s
}

// ToStatus returns the value of the "to_status" field in the mutation.
func (m *OrderStateLogsMutation) ToStatus() (r string, exists bool) {
	v := m.to_status
	if v == nil {
		return
	}
	return *v, true
}

// OldToStatus returns the old "to_status" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldToStatus(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldToStatus is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldToStatus requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldToStatus: %w", err)
	}
	return oldValue.ToStatus, nil
}

// ResetToStatus resets all changes to the "to_status" field.
func (m *OrderStateLogsMutation) ResetToStatus() {
	m.to_status = nil
}

// SetAction sets the "action" field.
func (m *OrderStateLogsMutation) SetAction(s string) {
	m.action = &s
}

// Action returns the value of the "action" field in the mutation.
func (m *OrderStateLogsMutation) Action() (r string, exists bool) {
	v := m.action
	if v == nil {
		return
	}
	return *v, true
}

// OldAction returns the old "action" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldAction(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldAction is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldAction requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldAction: %w", err)
	}
	return oldValue.Action, nil
}

// ResetAction resets all changes to the "action" field.
func (m *OrderStateLogsMutation) ResetAction() {
	m.action = nil
}

// SetActorID sets the "actor_id" field.
func (m *OrderStateLogsMutation) SetActorID(i int64) {
	m.actor_id = &i
	m.addactor_id = nil
}

// ActorID returns the value of the "actor_id" field in the mutation.
func (m *OrderStateLogsMutation) ActorID() (r int64, exists bool) {
	v := m.actor_id
	if v == nil {
		return
	}
	return *v, true
}

// OldActorID returns the old "actor_id" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldActorID(ctx context.Context) (v int64, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldActorID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldActorID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldActorID: %w", err)
	}
	return oldValue.ActorID, nil
}

// AddActorID adds i to the "actor_id" field.
func (m *OrderStateLogsMutation) AddActorID(i int64) {
	if m.addactor_id != nil {
		*m.addactor_id += i
	} else {
		m.addactor_id = &i
	}
}

// AddedActorID returns the value that was added to the "actor_id" field in this mutation.
func (m *OrderStateLogsMutation) AddedActorID() (r int64, exists bool) {
	v := m.addactor_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetActorID resets all changes to the "actor_id" field.
func (m *OrderStateLogsMutation) ResetActorID() {
	m.actor_id = nil
	m.addactor_id = nil
}

// SetActorRole sets the "actor_role" field.
func (m *OrderStateLogsMutation) SetActorRole(s string) {
	m.actor_role = &s
}

// ActorRole returns the value of the "actor_role" field in the mutation.
func (m *OrderStateLogsMutation) ActorRole() (r string, exists bool) {
	v := m.actor_role
	if v == nil {
		return
	}
	return *v, true
}

// OldActorRole returns the old "actor_role" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldActorRole(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldActorRole is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldActorRole requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldActorRole: %w", err)
	}
	return oldValue.ActorRole, nil
}

// ResetActorRole resets all changes to the "actor_role" field.
func (m *OrderStateLogsMutation) ResetActorRole() {
	m.actor_role = nil
}

// SetMetadata sets the "metadata" field.
func (m *OrderStateLogsMutation) SetMetadata(value map[string]interface{}) {
	m.metadata = &value
}

// Metadata returns the value of the "metadata" field in the mutation.
func (m *OrderStateLogsMutation) Metadata() (r map[string]interface{}, exists bool) {
	v := m.metadata
	if v == nil {
		return
	}
	return *v, true
}

// OldMetadata returns the old "metadata" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldMetadata(ctx context.Context) (v map[string]interface{}, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldMetadata is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldMetadata requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldMetadata: %w", err)
	}
	return oldValue.Metadata, nil
}

// ClearMetadata clears the value of the "metadata" field.
func (m *OrderStateLogsMutation) ClearMetadata() {
	m.metadata = nil
	m.clearedFields[orderstatelogs.FieldMetadata] = struct{}{}
}

// MetadataCleared returns if the "metadata" field was cleared in this mutation.
func (m *OrderStateLogsMutation) MetadataCleared() bool {
	_, ok := m.clearedFields[orderstatelogs.FieldMetadata]
	return ok
}

// ResetMetadata resets all changes to the "metadata" field.
func (m *OrderStateLogsMutation) ResetMetadata() {
	m.metadata = nil
	delete(m.clearedFields, orderstatelogs.FieldMetadata)
}

// SetCreatedAt sets the "created_at" field.
func (m *OrderStateLogsMutation) SetCreatedAt(t time.Time) {
	m.created_at = &t
}

// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *OrderStateLogsMutation) CreatedAt() (r time.Time, exists bool) {
	v := m.created_at
	if v == nil {
		return
	}
	return *v, true
}

// OldCreatedAt returns the old "created_at" field's value of the OrderStateLogs entity.
// If the OrderStateLogs object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrderStateLogsMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
	}
	return oldValue.CreatedAt, nil
}

// ResetCreatedAt resets all changes to the "created_at" field.
func (m *OrderStateLogsMutation) ResetCreatedAt() {
	m.created_at = nil
}

// Where appends a list predicates to the OrderStateLogsMutation builder.
func (m *OrderStateLogsMutation) Where(ps ...predicate.OrderStateLogs) {
	m.predicates = append(m.predicates, ps...)
}

// WhereP appends storage-level predicates to the OrderStateLogsMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *OrderStateLogsMutation) WhereP(ps ...func(*sql.Selector)) {
	p := make([]predicate.OrderStateLogs, len(ps))
	for i := range ps {
		p[i] = ps[i]
	}
	m.Where(p...)
}

// Op returns the operation name.
func (m *OrderStateLogsMutation) Op() Op {
	return m.op
}

// SetOp allows setting the mutation operation.
func (m *OrderStateLogsMutation) SetOp(op Op) {
	m.op = op
}

// Type returns the node type of this mutation (OrderStateLogs).
func (m *OrderStateLogsMutation) Type() string {
	return m.typ
}

// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *OrderStateLogsMutation) Fields() []string {
	fields := make([]string, 0, 8)
	if m.order_id != nil {
		fields = append(fields, orderstatelogs.FieldOrderID)
	}
	if m.from_status != nil {
		fields = append(fields, orderstatelogs.FieldFromStatus)
	}
	if m.to_status != nil {
		fields = append(fields, orderstatelogs.FieldToStatus)
	}
	if m.action != nil {
		fields = append(fields, orderstatelogs.FieldAction)
	}
	if m.actor_id != nil {
		fields = append(fields, orderstatelogs.FieldActorID)
	}
	if m.actor_role != nil {
		fields = append(fields, orderstatelogs.FieldActorRole)
	}
	if m.metadata != nil {
		fields = append(fields, orderstatelogs.FieldMetadata)
	}
	if m.created_at != nil {
		fields = append(fields, orderstatelogs.FieldCreatedAt)
	}
	return fields
}

// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *OrderStateLogsMutation) Field(name string) (ent.Value, bool) {
	switch name {
	case orderstatelogs.FieldOrderID:
		return m.OrderID()
	case orderstatelogs.FieldFromStatus:
		return m.FromStatus()
	case orderstatelogs.FieldToStatus:
		return m.ToStatus()
	case orderstatelogs.FieldAction:
		return m.Action()
	case orderstatelogs.FieldActorID:
		return m.ActorID()
	case orderstatelogs.FieldActorRole:
		return m.ActorRole()
	case orderstatelogs.FieldMetadata:
		return m.Metadata()
	case orderstatelogs.FieldCreatedAt:
		return m.CreatedAt()
	}
	return nil, false
}

// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *OrderStateLogsMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
	switch name {
	case orderstatelogs.FieldOrderID:
		return m.OldOrderID(ctx)
	case orderstatelogs.FieldFromStatus:
		return m.OldFromStatus(ctx)
	case orderstatelogs.FieldToStatus:
		return m.OldToStatus(ctx)
	case orderstatelogs.FieldAction:
		return m.OldAction(ctx)
	case orderstatelogs.FieldActorID:
		return m.OldActorID(ctx)
	case orderstatelogs.FieldActorRole:
		return m.OldActorRole(ctx)
	case orderstatelogs.FieldMetadata:
		return m.OldMetadata(ctx)
	case orderstatelogs.FieldCreatedAt:
		return m.OldCreatedAt(ctx)
	}
	return nil, fmt.Errorf("unknown OrderStateLogs field %s", name)
}

// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *OrderStateLogsMutation) SetField(name string, value ent.Value) error {
	switch name {
	case orderstatelogs.FieldOrderID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetOrderID(v)
		return nil
	case orderstatelogs.FieldFromStatus:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetFromStatus(v)
		return nil
	case orderstatelogs.FieldToStatus:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetToStatus(v)
		return nil
	case orderstatelogs.FieldAction:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetAction(v)
		return nil
	case orderstatelogs.FieldActorID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetActorID(v)
		return nil
	case orderstatelogs.FieldActorRole:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetActorRole(v)
		return nil
	case orderstatelogs.FieldMetadata:
		v, ok := value.(map[string]interface{})
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetMetadata(v)
		return nil
	case orderstatelogs.FieldCreatedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCreatedAt(v)
		return nil
	}
	return fmt.Errorf("unknown OrderStateLogs field %s", name)
}

// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *OrderStateLogsMutation) AddedFields() []string {
	var fields []string
	if m.addorder_id != nil {
		fields = append(fields, orderstatelogs.FieldOrderID)
	}
	if m.addactor_id != nil {
		fields = append(fields, orderstatelogs.FieldActorID)
	}
	return fields
}

// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *OrderStateLogsMutation) AddedField(name string) (ent.Value, bool) {
	switch name {
	case orderstatelogs.FieldOrderID:
		return m.AddedOrderID()
	case orderstatelogs.FieldActorID:
		return m.AddedActorID()
	}
	return nil, false
}

// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *OrderStateLogsMutation) AddField(name string, value ent.Value) error {
	switch name {
	case orderstatelogs.FieldOrderID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddOrderID(v)
		return nil
	case orderstatelogs.FieldActorID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddActorID(v)
		return nil
	}
	return fmt.Errorf("unknown OrderStateLogs numeric field %s", name)
}

// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *OrderStateLogsMutation) ClearedFields() []string {
	var fields []string
	if m.FieldCleared(orderstatelogs.FieldFromStatus) {
		fields = append(fields, orderstatelogs.FieldFromStatus)
	}
	if m.FieldCleared(orderstatelogs.FieldMetadata) {
		fields = append(fields, orderstatelogs.FieldMetadata)
	}
	return fields
}

// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *OrderStateLogsMutation) FieldCleared(name string) bool {
	_, ok := m.clearedFields[name]
	return ok
}

// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *OrderStateLogsMutation) ClearField(name string) error {
	switch name {
	case orderstatelogs.FieldFromStatus:
		m.ClearFromStatus()
		return nil
	case orderstatelogs.FieldMetadata:
		m.ClearMetadata()
		return nil
	}
	return fmt.Errorf("unknown OrderStateLogs nullable field %s", name)
}

// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *OrderStateLogsMutation) ResetField(name string) error {
	switch name {
	case orderstatelogs.FieldOrderID:
		m.ResetOrderID()
		return nil
	case orderstatelogs.FieldFromStatus:
		m.ResetFromStatus()
		return nil
	case orderstatelogs.FieldToStatus:
		m.ResetToStatus()
		return nil
	case orderstatelogs.FieldAction:
		m.ResetAction()
		return nil
	case orderstatelogs.FieldActorID:
		m.ResetActorID()
		return nil
	case orderstatelogs.FieldActorRole:
		m.ResetActorRole()
		return nil
	case orderstatelogs.FieldMetadata:
		m.ResetMetadata()
		return nil
	case orderstatelogs.FieldCreatedAt:
		m.ResetCreatedAt()
		return nil
	}
	return fmt.Errorf("unknown OrderStateLogs field %s", name)
}

// AddedEdges returns all edge names that were set/added in this mutation.
func (m *OrderStateLogsMutation) AddedEdges() []string {
	edges := make([]string, 0, 0)
	return edges
}

// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *OrderStateLogsMutation) AddedIDs(name string) []ent.Value {
	return nil
}

// RemovedEdges returns all edge names that were removed in this mutation.
func (m *OrderStateLogsMutation) RemovedEdges() []string {
	edges := make([]string, 0, 0)
	return edges
}

// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *OrderStateLogsMutation) RemovedIDs(name string) []ent.Value {
	return nil
}

// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *OrderStateLogsMutation) ClearedEdges() []string {
	edges := make([]string, 0, 0)
	return edges
}

// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *OrderStateLogsMutation) EdgeCleared(name string) bool {
	return false
}

// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *OrderStateLogsMutation) ClearEdge(name string) error {
	return fmt.Errorf("unknown OrderStateLogs unique edge %s", name)
}

// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *OrderStateLogsMutation) ResetEdge(name string) error {
	return fmt.Errorf("unknown OrderStateLogs edge %s", name)
}

// OrdersMutation represents an operation that mutates the Orders nodes in the graph.
type OrdersMutation struct {
	config
	op               Op
	typ              string
	id               *int64
	consumer_id      *int64
	addconsumer_id   *int64
	player_id        *int64
	addplayer_id     *int64
	shop_id          *int64
	addshop_id       *int64
	service_snapshot *map[string]interface{}
	status           *string
	total_price      *decimal.Decimal
	note             *string
	version          *int
	addversion       *int
	timeout_job_id   *string
	search_text      *string
	created_at       *time.Time
	accepted_at      *time.Time
	closed_at        *time.Time
	completed_at     *time.Time
	cancelled_at     *time.Time
	updated_at       *time.Time
	clearedFields    map[string]struct{}
	done             bool
	oldValue         func(context.Context) (*Orders, error)
	predicates       []predicate.Orders
}

var _ ent.Mutation = (*OrdersMutation)(nil)

// ordersOption allows management of the mutation configuration using functional options.
type ordersOption func(*OrdersMutation)

// newOrdersMutation creates new mutation for the Orders entity.
func newOrdersMutation(c config, op Op, opts ...ordersOption) *OrdersMutation {
	m := &OrdersMutation{
		config:        c,
		op:            op,
		typ:           TypeOrders,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}

// withOrdersID sets the ID field of the mutation.
func withOrdersID(id int64) ordersOption {
	return func(m *OrdersMutation) {
		var (
			err   error
			once  sync.Once
			value *Orders
		)
		m.oldValue = func(ctx context.Context) (*Orders, error) {
			once.Do(func() {
				if m.done {
					err = errors.New("querying old values post mutation is not allowed")
				} else {
					value, err = m.Client().Orders.Get(ctx, id)
				}
			})
			return value, err
		}
		m.id = &id
	}
}

// withOrders sets the old Orders of the mutation.
func withOrders(node *Orders) ordersOption {
	return func(m *OrdersMutation) {
		m.oldValue = func(context.Context) (*Orders, error) {
			return node, nil
		}
		m.id = &node.ID
	}
}

// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m OrdersMutation) Client() *Client {
	client := &Client{config: m.config}
	client.init()
	return client
}

// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m OrdersMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, errors.New("models: mutation is not running in a transaction")
	}
	tx := &Tx{config: m.config}
	tx.init()
	return tx, nil
}

// SetID sets the value of the id field. Note that this
// operation is only accepted on creation of Orders entities.
func (m *OrdersMutation) SetID(id int64) {
	m.id = &id
}

// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *OrdersMutation) ID() (id int64, exists bool) {
	if m.id == nil {
		return
	}
	return *m.id, true
}

// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *OrdersMutation) IDs(ctx context.Context) ([]int64, error) {
	switch {
	case m.op.Is(OpUpdateOne | OpDeleteOne):
		id, exists := m.ID()
		if exists {
			return []int64{id}, nil
		}
		fallthrough
	case m.op.Is(OpUpdate | OpDelete):
		return m.Client().Orders.Query().Where(m.predicates...).IDs(ctx)
	default:
		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
	}
}

// SetConsumerID sets the "consumer_id" field.
func (m *OrdersMutation) SetConsumerID(i int64) {
	m.consumer_id = &i
	m.addconsumer_id = nil
}

// ConsumerID returns the value of the "consumer_id" field in the mutation.
func (m *OrdersMutation) ConsumerID() (r int64, exists bool) {
	v := m.consumer_id
	if v == nil {
		return
	}
	return *v, true
}

// OldConsumerID returns the old "consumer_id" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldConsumerID(ctx context.Context) (v int64, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldConsumerID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldConsumerID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldConsumerID: %w", err)
	}
	return oldValue.ConsumerID, nil
}

// AddConsumerID adds i to the "consumer_id" field.
func (m *OrdersMutation) AddConsumerID(i int64) {
	if m.addconsumer_id != nil {
		*m.addconsumer_id += i
	} else {
		m.addconsumer_id = &i
	}
}

// AddedConsumerID returns the value that was added to the "consumer_id" field in this mutation.
func (m *OrdersMutation) AddedConsumerID() (r int64, exists bool) {
	v := m.addconsumer_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetConsumerID resets all changes to the "consumer_id" field.
func (m *OrdersMutation) ResetConsumerID() {
	m.consumer_id = nil
	m.addconsumer_id = nil
}

// SetPlayerID sets the "player_id" field.
func (m *OrdersMutation) SetPlayerID(i int64) {
	m.player_id = &i
	m.addplayer_id = nil
}

// PlayerID returns the value of the "player_id" field in the mutation.
func (m *OrdersMutation) PlayerID() (r int64, exists bool) {
	v := m.player_id
	if v == nil {
		return
	}
	return *v, true
}

// OldPlayerID returns the old "player_id" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldPlayerID(ctx context.Context) (v int64, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldPlayerID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldPlayerID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldPlayerID: %w", err)
	}
	return oldValue.PlayerID, nil
}

// AddPlayerID adds i to the "player_id" field.
func (m *OrdersMutation) AddPlayerID(i int64) {
	if m.addplayer_id != nil {
		*m.addplayer_id += i
	} else {
		m.addplayer_id = &i
	}
}

// AddedPlayerID returns the value that was added to the "player_id" field in this mutation.
func (m *OrdersMutation) AddedPlayerID() (r int64, exists bool) {
	v := m.addplayer_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetPlayerID resets all changes to the "player_id" field.
func (m *OrdersMutation) ResetPlayerID() {
	m.player_id = nil
	m.addplayer_id = nil
}

// SetShopID sets the "shop_id" field.
func (m *OrdersMutation) SetShopID(i int64) {
	m.shop_id = &i
	m.addshop_id = nil
}

// ShopID returns the value of the "shop_id" field in the mutation.
func (m *OrdersMutation) ShopID() (r int64, exists bool) {
	v := m.shop_id
	if v == nil {
		return
	}
	return *v, true
}

// OldShopID returns the old "shop_id" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldShopID(ctx context.Context) (v *int64, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldShopID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldShopID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldShopID: %w", err)
	}
	return oldValue.ShopID, nil
}

// AddShopID adds i to the "shop_id" field.
func (m *OrdersMutation) AddShopID(i int64) {
	if m.addshop_id != nil {
		*m.addshop_id += i
	} else {
		m.addshop_id = &i
	}
}

// AddedShopID returns the value that was added to the "shop_id" field in this mutation.
func (m *OrdersMutation) AddedShopID() (r int64, exists bool) {
	v := m.addshop_id
	if v == nil {
		return
	}
	return *v, true
}

// ClearShopID clears the value of the "shop_id" field.
func (m *OrdersMutation) ClearShopID() {
	m.shop_id = nil
	m.addshop_id = nil
	m.clearedFields[orders.FieldShopID] = struct{}{}
}

// ShopIDCleared returns if the "shop_id" field was cleared in this mutation.
func (m *OrdersMutation) ShopIDCleared() bool {
	_, ok := m.clearedFields[orders.FieldShopID]
	return ok
}

// ResetShopID resets all changes to the "shop_id" field.
func (m *OrdersMutation) ResetShopID() {
	m.shop_id = nil
	m.addshop_id = nil
	delete(m.clearedFields, orders.FieldShopID)
}

// SetServiceSnapshot sets the "service_snapshot" field.
func (m *OrdersMutation) SetServiceSnapshot(value map[string]interface{}) {
	m.service_snapshot = &value
}

// ServiceSnapshot returns the value of the "service_snapshot" field in the mutation.
func (m *OrdersMutation) ServiceSnapshot() (r map[string]interface{}, exists bool) {
	v := m.service_snapshot
	if v == nil {
		return
	}
	return *v, true
}

// OldServiceSnapshot returns the old "service_snapshot" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldServiceSnapshot(ctx context.Context) (v map[string]interface{}, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldServiceSnapshot is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldServiceSnapshot requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldServiceSnapshot: %w", err)
	}
	return oldValue.ServiceSnapshot, nil
}

// ResetServiceSnapshot resets all changes to the "service_snapshot" field.
func (m *OrdersMutation) ResetServiceSnapshot() {
	m.service_snapshot = nil
}

// SetStatus sets the "status" field.
func (m *OrdersMutation) SetStatus(s string) {
	m.status = &s
}

// Status returns the value of the "status" field in the mutation.
func (m *OrdersMutation) Status() (r string, exists bool) {
	v := m.status
	if v == nil {
		return
	}
	return *v, true
}

// OldStatus returns the old "status" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldStatus(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldStatus requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
	}
	return oldValue.Status, nil
}

// ResetStatus resets all changes to the "status" field.
func (m *OrdersMutation) ResetStatus() {
	m.status = nil
}

// SetTotalPrice sets the "total_price" field.
func (m *OrdersMutation) SetTotalPrice(d decimal.Decimal) {
	m.total_price = &d
}

// TotalPrice returns the value of the "total_price" field in the mutation.
func (m *OrdersMutation) TotalPrice() (r decimal.Decimal, exists bool) {
	v := m.total_price
	if v == nil {
		return
	}
	return *v, true
}

// OldTotalPrice returns the old "total_price" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldTotalPrice(ctx context.Context) (v decimal.Decimal, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldTotalPrice is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldTotalPrice requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldTotalPrice: %w", err)
	}
	return oldValue.TotalPrice, nil
}

// ResetTotalPrice resets all changes to the "total_price" field.
func (m *OrdersMutation) ResetTotalPrice() {
	m.total_price = nil
}

// SetNote sets the "note" field.
func (m *OrdersMutation) SetNote(s string) {
	m.note = &s
}

// Note returns the value of the "note" field in the mutation.
func (m *OrdersMutation) Note() (r string, exists bool) {
	v := m.note
	if v == nil {
		return
	}
	return *v, true
}

// OldNote returns the old "note" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldNote(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldNote is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldNote requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldNote: %w", err)
	}
	return oldValue.Note, nil
}

// ClearNote clears the value of the "note" field.
func (m *OrdersMutation) ClearNote() {
	m.note = nil
	m.clearedFields[orders.FieldNote] = struct{}{}
}

// NoteCleared returns if the "note" field was cleared in this mutation.
func (m *OrdersMutation) NoteCleared() bool {
	_, ok := m.clearedFields[orders.FieldNote]
	return ok
}

// ResetNote resets all changes to the "note" field.
func (m *OrdersMutation) ResetNote() {
	m.note = nil
	delete(m.clearedFields, orders.FieldNote)
}

// SetVersion sets the "version" field.
func (m *OrdersMutation) SetVersion(i int) {
	m.version = &i
	m.addversion = nil
}

// Version returns the value of the "version" field in the mutation.
func (m *OrdersMutation) Version() (r int, exists bool) {
	v := m.version
	if v == nil {
		return
	}
	return *v, true
}

// OldVersion returns the old "version" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldVersion(ctx context.Context) (v int, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldVersion is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldVersion requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldVersion: %w", err)
	}
	return oldValue.Version, nil
}

// AddVersion adds i to the "version" field.
func (m *OrdersMutation) AddVersion(i int) {
	if m.addversion != nil {
		*m.addversion += i
	} else {
		m.addversion = &i
	}
}

// AddedVersion returns the value that was added to the "version" field in this mutation.
func (m *OrdersMutation) AddedVersion() (r int, exists bool) {
	v := m.addversion
	if v == nil {
		return
	}
	return *v, true
}

// ResetVersion resets all changes to the "version" field.
func (m *OrdersMutation) ResetVersion() {
	m.version = nil
	m.addversion = nil
}

// SetTimeoutJobID sets the "timeout_job_id" field.
func (m *OrdersMutation) SetTimeoutJobID(s string) {
	m.timeout_job_id = &s
}

// TimeoutJobID returns the value of the "timeout_job_id" field in the mutation.
func (m *OrdersMutation) TimeoutJobID() (r string, exists bool) {
	v := m.timeout_job_id
	if v == nil {
		return
	}
	return *v, true
}

// OldTimeoutJobID returns the old "timeout_job_id" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldTimeoutJobID(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldTimeoutJobID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldTimeoutJobID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldTimeoutJobID: %w", err)
	}
	return oldValue.TimeoutJobID, nil
}

// ClearTimeoutJobID clears the value of the "timeout_job_id" field.
func (m *OrdersMutation) ClearTimeoutJobID() {
	m.timeout_job_id = nil
	m.clearedFields[orders.FieldTimeoutJobID] = struct{}{}
}

// TimeoutJobIDCleared returns if the "timeout_job_id" field was cleared in this mutation.
func (m *OrdersMutation) TimeoutJobIDCleared() bool {
	_, ok := m.clearedFields[orders.FieldTimeoutJobID]
	return ok
}

// ResetTimeoutJobID resets all changes to the "timeout_job_id" field.
func (m *OrdersMutation) ResetTimeoutJobID() {
	m.timeout_job_id = nil
	delete(m.clearedFields, orders.FieldTimeoutJobID)
}

// SetSearchText sets the "search_text" field.
func (m *OrdersMutation) SetSearchText(s string) {
	m.search_text = &s
}

// SearchText returns the value of the "search_text" field in the mutation.
func (m *OrdersMutation) SearchText() (r string, exists bool) {
	v := m.search_text
	if v == nil {
		return
	}
	return *v, true
}

// OldSearchText returns the old "search_text" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldSearchText(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldSearchText is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldSearchText requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldSearchText: %w", err)
	}
	return oldValue.SearchText, nil
}

// ClearSearchText clears the value of the "search_text" field.
func (m *OrdersMutation) ClearSearchText() {
	m.search_text = nil
	m.clearedFields[orders.FieldSearchText] = struct{}{}
}

// SearchTextCleared returns if the "search_text" field was cleared in this mutation.
func (m *OrdersMutation) SearchTextCleared() bool {
	_, ok := m.clearedFields[orders.FieldSearchText]
	return ok
}

// ResetSearchText resets all changes to the "search_text" field.
func (m *OrdersMutation) ResetSearchText() {
	m.search_text = nil
	delete(m.clearedFields, orders.FieldSearchText)
}

// SetCreatedAt sets the "created_at" field.
func (m *OrdersMutation) SetCreatedAt(t time.Time) {
	m.created_at = &t
}

// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *OrdersMutation) CreatedAt() (r time.Time, exists bool) {
	v := m.created_at
	if v == nil {
		return
	}
	return *v, true
}

// OldCreatedAt returns the old "created_at" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
	}
	return oldValue.CreatedAt, nil
}

// ResetCreatedAt resets all changes to the "created_at" field.
func (m *OrdersMutation) ResetCreatedAt() {
	m.created_at = nil
}

// SetAcceptedAt sets the "accepted_at" field.
func (m *OrdersMutation) SetAcceptedAt(t time.Time) {
	m.accepted_at = &t
}

// AcceptedAt returns the value of the "accepted_at" field in the mutation.
func (m *OrdersMutation) AcceptedAt() (r time.Time, exists bool) {
	v := m.accepted_at
	if v == nil {
		return
	}
	return *v, true
}

// OldAcceptedAt returns the old "accepted_at" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldAcceptedAt(ctx context.Context) (v *time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldAcceptedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldAcceptedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldAcceptedAt: %w", err)
	}
	return oldValue.AcceptedAt, nil
}

// ClearAcceptedAt clears the value of the "accepted_at" field.
func (m *OrdersMutation) ClearAcceptedAt() {
	m.accepted_at = nil
	m.clearedFields[orders.FieldAcceptedAt] = struct{}{}
}

// AcceptedAtCleared returns if the "accepted_at" field was cleared in this mutation.
func (m *OrdersMutation) AcceptedAtCleared() bool {
	_, ok := m.clearedFields[orders.FieldAcceptedAt]
	return ok
}

// ResetAcceptedAt resets all changes to the "accepted_at" field.
func (m *OrdersMutation) ResetAcceptedAt() {
	m.accepted_at = nil
	delete(m.clearedFields, orders.FieldAcceptedAt)
}

// SetClosedAt sets the "closed_at" field.
func (m *OrdersMutation) SetClosedAt(t time.Time) {
	m.closed_at = &t
}

// ClosedAt returns the value of the "closed_at" field in the mutation.
func (m *OrdersMutation) ClosedAt() (r time.Time, exists bool) {
	v := m.closed_at
	if v == nil {
		return
	}
	return *v, true
}

// OldClosedAt returns the old "closed_at" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldClosedAt(ctx context.Context) (v *time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldClosedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldClosedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldClosedAt: %w", err)
	}
	return oldValue.ClosedAt, nil
}

// ClearClosedAt clears the value of the "closed_at" field.
func (m *OrdersMutation) ClearClosedAt() {
	m.closed_at = nil
	m.clearedFields[orders.FieldClosedAt] = struct{}{}
}

// ClosedAtCleared returns if the "closed_at" field was cleared in this mutation.
func (m *OrdersMutation) ClosedAtCleared() bool {
	_, ok := m.clearedFields[orders.FieldClosedAt]
	return ok
}

// ResetClosedAt resets all changes to the "closed_at" field.
func (m *OrdersMutation) ResetClosedAt() {
	m.closed_at = nil
	delete(m.clearedFields, orders.FieldClosedAt)
}

// SetCompletedAt sets the "completed_at" field.
func (m *OrdersMutation) SetCompletedAt(t time.Time) {
	m.completed_at = &t
}

// CompletedAt returns the value of the "completed_at" field in the mutation.
func (m *OrdersMutation) CompletedAt() (r time.Time, exists bool) {
	v := m.completed_at
	if v == nil {
		return
	}
	return *v, true
}

// OldCompletedAt returns the old "completed_at" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldCompletedAt(ctx context.Context) (v *time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCompletedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCompletedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCompletedAt: %w", err)
	}
	return oldValue.CompletedAt, nil
}

// ClearCompletedAt clears the value of the "completed_at" field.
func (m *OrdersMutation) ClearCompletedAt() {
	m.completed_at = nil
	m.clearedFields[orders.FieldCompletedAt] = struct{}{}
}

// CompletedAtCleared returns if the "completed_at" field was cleared in this mutation.
func (m *OrdersMutation) CompletedAtCleared() bool {
	_, ok := m.clearedFields[orders.FieldCompletedAt]
	return ok
}

// ResetCompletedAt resets all changes to the "completed_at" field.
func (m *OrdersMutation) ResetCompletedAt() {
	m.completed_at = nil
	delete(m.clearedFields, orders.FieldCompletedAt)
}

// SetCancelledAt sets the "cancelled_at" field.
func (m *OrdersMutation) SetCancelledAt(t time.Time) {
	m.cancelled_at = &t
}

// CancelledAt returns the value of the "cancelled_at" field in the mutation.
func (m *OrdersMutation) CancelledAt() (r time.Time, exists bool) {
	v := m.cancelled_at
	if v == nil {
		return
	}
	return *v, true
}

// OldCancelledAt returns the old "cancelled_at" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldCancelledAt(ctx context.Context) (v *time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCancelledAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCancelledAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCancelledAt: %w", err)
	}
	return oldValue.CancelledAt, nil
}

// ClearCancelledAt clears the value of the "cancelled_at" field.
func (m *OrdersMutation) ClearCancelledAt() {
	m.cancelled_at = nil
	m.clearedFields[orders.FieldCancelledAt] = struct{}{}
}

// CancelledAtCleared returns if the "cancelled_at" field was cleared in this mutation.
func (m *OrdersMutation) CancelledAtCleared() bool {
	_, ok := m.clearedFields[orders.FieldCancelledAt]
	return ok
}

// ResetCancelledAt resets all changes to the "cancelled_at" field.
func (m *OrdersMutation) ResetCancelledAt() {
	m.cancelled_at = nil
	delete(m.clearedFields, orders.FieldCancelledAt)
}

// SetUpdatedAt sets the "updated_at" field.
func (m *OrdersMutation) SetUpdatedAt(t time.Time) {
	m.updated_at = &t
}

// UpdatedAt returns the value of the "updated_at" field in the mutation.
func (m *OrdersMutation) UpdatedAt() (r time.Time, exists bool) {
	v := m.updated_at
	if v == nil {
		return
	}
	return *v, true
}

// OldUpdatedAt returns the old "updated_at" field's value of the Orders entity.
// If the Orders object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *OrdersMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
	}
	return oldValue.UpdatedAt, nil
}

// ResetUpdatedAt resets all changes to the "updated_at" field.
func (m *OrdersMutation) ResetUpdatedAt() {
	m.updated_at = nil
}

// Where appends a list predicates to the OrdersMutation builder.
func (m *OrdersMutation) Where(ps ...predicate.Orders) {
	m.predicates = append(m.predicates, ps...)
}

// WhereP appends storage-level predicates to the OrdersMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *OrdersMutation) WhereP(ps ...func(*sql.Selector)) {
	p := make([]predicate.Orders, len(ps))
	for i := range ps {
		p[i] = ps[i]
	}
	m.Where(p...)
}

// Op returns the operation name.
func (m *OrdersMutation) Op() Op {
	return m.op
}

// SetOp allows setting the mutation operation.
func (m *OrdersMutation) SetOp(op Op) {
	m.op = op
}

// Type returns the node type of this mutation (Orders).
func (m *OrdersMutation) Type() string {
	return m.typ
}

// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *OrdersMutation) Fields() []string {
	fields := make([]string, 0, 16)
	if m.consumer_id != nil {
		fields = append(fields, orders.FieldConsumerID)
	}
	if m.player_id != nil {
		fields = append(fields, orders.FieldPlayerID)
	}
	if m.shop_id != nil {
		fields = append(fields, orders.FieldShopID)
	}
	if m.service_snapshot != nil {
		fields = append(fields, orders.FieldServiceSnapshot)
	}
	if m.status != nil {
		fields = append(fields, orders.FieldStatus)
	}
	if m.total_price != nil {
		fields = append(fields, orders.FieldTotalPrice)
	}
	if m.note != nil {
		fields = append(fields, orders.FieldNote)
	}
	if m.version != nil {
		fields = append(fields, orders.FieldVersion)
	}
	if m.timeout_job_id != nil {
		fields = append(fields, orders.FieldTimeoutJobID)
	}
	if m.search_text != nil {
		fields = append(fields, orders.FieldSearchText)
	}
	if m.created_at != nil {
		fields = append(fields, orders.FieldCreatedAt)
	}
	if m.accepted_at != nil {
		fields = append(fields, orders.FieldAcceptedAt)
	}
	if m.closed_at != nil {
		fields = append(fields, orders.FieldClosedAt)
	}
	if m.completed_at != nil {
		fields = append(fields, orders.FieldCompletedAt)
	}
	if m.cancelled_at != nil {
		fields = append(fields, orders.FieldCancelledAt)
	}
	if m.updated_at != nil {
		fields = append(fields, orders.FieldUpdatedAt)
	}
	return fields
}

// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *OrdersMutation) Field(name string) (ent.Value, bool) {
	switch name {
	case orders.FieldConsumerID:
		return m.ConsumerID()
	case orders.FieldPlayerID:
		return m.PlayerID()
	case orders.FieldShopID:
		return m.ShopID()
	case orders.FieldServiceSnapshot:
		return m.ServiceSnapshot()
	case orders.FieldStatus:
		return m.Status()
	case orders.FieldTotalPrice:
		return m.TotalPrice()
	case orders.FieldNote:
		return m.Note()
	case orders.FieldVersion:
		return m.Version()
	case orders.FieldTimeoutJobID:
		return m.TimeoutJobID()
	case orders.FieldSearchText:
		return m.SearchText()
	case orders.FieldCreatedAt:
		return m.CreatedAt()
	case orders.FieldAcceptedAt:
		return m.AcceptedAt()
	case orders.FieldClosedAt:
		return m.ClosedAt()
	case orders.FieldCompletedAt:
		return m.CompletedAt()
	case orders.FieldCancelledAt:
		return m.CancelledAt()
	case orders.FieldUpdatedAt:
		return m.UpdatedAt()
	}
	return nil, false
}

// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *OrdersMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
	switch name {
	case orders.FieldConsumerID:
		return m.OldConsumerID(ctx)
	case orders.FieldPlayerID:
		return m.OldPlayerID(ctx)
	case orders.FieldShopID:
		return m.OldShopID(ctx)
	case orders.FieldServiceSnapshot:
		return m.OldServiceSnapshot(ctx)
	case orders.FieldStatus:
		return m.OldStatus(ctx)
	case orders.FieldTotalPrice:
		return m.OldTotalPrice(ctx)
	case orders.FieldNote:
		return m.OldNote(ctx)
	case orders.FieldVersion:
		return m.OldVersion(ctx)
	case orders.FieldTimeoutJobID:
		return m.OldTimeoutJobID(ctx)
	case orders.FieldSearchText:
		return m.OldSearchText(ctx)
	case orders.FieldCreatedAt:
		return m.OldCreatedAt(ctx)
	case orders.FieldAcceptedAt:
		return m.OldAcceptedAt(ctx)
	case orders.FieldClosedAt:
		return m.OldClosedAt(ctx)
	case orders.FieldCompletedAt:
		return m.OldCompletedAt(ctx)
	case orders.FieldCancelledAt:
		return m.OldCancelledAt(ctx)
	case orders.FieldUpdatedAt:
		return m.OldUpdatedAt(ctx)
	}
	return nil, fmt.Errorf("unknown Orders field %s", name)
}

// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *OrdersMutation) SetField(name string, value ent.Value) error {
	switch name {
	case orders.FieldConsumerID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetConsumerID(v)
		return nil
	case orders.FieldPlayerID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetPlayerID(v)
		return nil
	case orders.FieldShopID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetShopID(v)
		return nil
	case orders.FieldServiceSnapshot:
		v, ok := value.(map[string]interface{})
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetServiceSnapshot(v)
		return nil
	case orders.FieldStatus:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetStatus(v)
		return nil
	case orders.FieldTotalPrice:
		v, ok := value.(decimal.Decimal)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetTotalPrice(v)
		return nil
	case orders.FieldNote:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetNote(v)
		return nil
	case orders.FieldVersion:
		v, ok := value.(int)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetVersion(v)
		return nil
	case orders.FieldTimeoutJobID:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetTimeoutJobID(v)
		return nil
	case orders.FieldSearchText:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetSearchText(v)
		return nil
	case orders.FieldCreatedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCreatedAt(v)
		return nil
	case orders.FieldAcceptedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetAcceptedAt(v)
		return nil
	case orders.FieldClosedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetClosedAt(v)
		return nil
	case orders.FieldCompletedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCompletedAt(v)
		return nil
	case orders.FieldCancelledAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCancelledAt(v)
		return nil
	case orders.FieldUpdatedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetUpdatedAt(v)
		return nil
	}
	return fmt.Errorf("unknown Orders field %s", name)
}

// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *OrdersMutation) AddedFields() []string {
	var fields []string
	if m.addconsumer_id != nil {
		fields = append(fields, orders.FieldConsumerID)
	}
	if m.addplayer_id != nil {
		fields = append(fields, orders.FieldPlayerID)
	}
	if m.addshop_id != nil {
		fields = append(fields, orders.FieldShopID)
	}
	if m.addversion != nil {
		fields = append(fields, orders.FieldVersion)
	}
	return fields
}

// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *OrdersMutation) AddedField(name string) (ent.Value, bool) {
	switch name {
	case orders.FieldConsumerID:
		return m.AddedConsumerID()
	case orders.FieldPlayerID:
		return m.AddedPlayerID()
	case orders.FieldShopID:
		return m.AddedShopID()
	case orders.FieldVersion:
		return m.AddedVersion()
	}
	return nil, false
}

// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *OrdersMutation) AddField(name string, value ent.Value) error {
	switch name {
	case orders.FieldConsumerID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddConsumerID(v)
		return nil
	case orders.FieldPlayerID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddPlayerID(v)
		return nil
	case orders.FieldShopID:
		v, ok := value.(int64)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddShopID(v)
		return nil
	case orders.FieldVersion:
		v, ok := value.(int)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddVersion(v)
		return nil
	}
	return fmt.Errorf("unknown Orders numeric field %s", name)
}

// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *OrdersMutation) ClearedFields() []string {
	var fields []string
	if m.FieldCleared(orders.FieldShopID) {
		fields = append(fields, orders.FieldShopID)
	}
	if m.FieldCleared(orders.FieldNote) {
		fields = append(fields, orders.FieldNote)
	}
	if m.FieldCleared(orders.FieldTimeoutJobID) {
		fields = append(fields, orders.FieldTimeoutJobID)
	}
	if m.FieldCleared(orders.FieldSearchText) {
		fields = append(fields, orders.FieldSearchText)
	}
	if m.FieldCleared(orders.FieldAcceptedAt) {
		fields = append(fields, orders.FieldAcceptedAt)
	}
	if m.FieldCleared(orders.FieldClosedAt) {
		fields = append(fields, orders.FieldClosedAt)
	}
	if m.FieldCleared(orders.FieldCompletedAt) {
		fields = append(fields, orders.FieldCompletedAt)
	}
	if m.FieldCleared(orders.FieldCancelledAt) {
		fields = append(fields, orders.FieldCancelledAt)
	}
	return fields
}

// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *OrdersMutation) FieldCleared(name string) bool {
	_, ok := m.clearedFields[name]
	return ok
}

// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *OrdersMutation) ClearField(name string) error {
	switch name {
	case orders.FieldShopID:
		m.ClearShopID()
		return nil
	case orders.FieldNote:
		m.ClearNote()
		return nil
	case orders.FieldTimeoutJobID:
		m.ClearTimeoutJobID()
		return nil
	case orders.FieldSearchText:
		m.ClearSearchText()
		return nil
	case orders.FieldAcceptedAt:
		m.ClearAcceptedAt()
		return nil
	case orders.FieldClosedAt:
		m.ClearClosedAt()
		return nil
	case orders.FieldCompletedAt:
		m.ClearCompletedAt()
		return nil
	case orders.FieldCancelledAt:
		m.ClearCancelledAt()
		return nil
	}
	return fmt.Errorf("unknown Orders nullable field %s", name)
}

// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *OrdersMutation) ResetField(name string) error {
	switch name {
	case orders.FieldConsumerID:
		m.ResetConsumerID()
		return nil
	case orders.FieldPlayerID:
		m.ResetPlayerID()
		return nil
	case orders.FieldShopID:
		m.ResetShopID()
		return nil
	case orders.FieldServiceSnapshot:
		m.ResetServiceSnapshot()
		return nil
	case orders.FieldStatus:
		m.ResetStatus()
		return nil
	case orders.FieldTotalPrice:
		m.ResetTotalPrice()
		return nil
	case orders.FieldNote:
		m.ResetNote()
		return nil
	case orders.FieldVersion:
		m.ResetVersion()
		return nil
	case orders.FieldTimeoutJobID:
		m.ResetTimeoutJobID()
		return nil
	case orders.FieldSearchText:
		m.ResetSearchText()
		return nil
	case orders.FieldCreatedAt:
		m.ResetCreatedAt()
		return nil
	case orders.FieldAcceptedAt:
		m.ResetAcceptedAt()
		return nil
	case orders.FieldClosedAt:
		m.ResetClosedAt()
		return nil
	case orders.FieldCompletedAt:
		m.ResetCompletedAt()
		return nil
	case orders.FieldCancelledAt:
		m.ResetCancelledAt()
		return nil
	case orders.FieldUpdatedAt:
		m.ResetUpdatedAt()
		return nil
	}
	return fmt.Errorf("unknown Orders field %s", name)
}

// AddedEdges returns all edge names that were set/added in this mutation.
func (m *OrdersMutation) AddedEdges() []string {
	edges := make([]string, 0, 0)
	return edges
}

// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *OrdersMutation) AddedIDs(name string) []ent.Value {
	return nil
}

// RemovedEdges returns all edge names that were removed in this mutation.
func (m *OrdersMutation) RemovedEdges() []string {
	edges := make([]string, 0, 0)
	return edges
}

// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *OrdersMutation) RemovedIDs(name string) []ent.Value {
	return nil
}

// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *OrdersMutation) ClearedEdges() []string {
	edges := make([]string, 0, 0)
	return edges
}

// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *OrdersMutation) EdgeCleared(name string) bool {
	return false
}

// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *OrdersMutation) ClearEdge(name string) error {
	return fmt.Errorf("unknown Orders unique edge %s", name)
}

// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *OrdersMutation) ResetEdge(name string) error {
	return fmt.Errorf("unknown Orders edge %s", name)
}
