// Code generated by ent, DO NOT EDIT.

package serversitemicros

import (
	"context"
	"convert-server/domain/entity/serversitemicros/docserverapp"
	"convert-server/domain/entity/serversitemicros/docservercallback"
	"convert-server/domain/entity/serversitemicros/docservergetproject"
	"convert-server/domain/entity/serversitemicros/docserverproject"
	"convert-server/domain/entity/serversitemicros/predicate"
	"errors"
	"fmt"
	"sync"
	"time"

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

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

	// Node types.
	TypeDocServerApp        = "DocServerApp"
	TypeDocServerCallback   = "DocServerCallback"
	TypeDocServerGetProject = "DocServerGetProject"
	TypeDocServerProject    = "DocServerProject"
)

// DocServerAppMutation represents an operation that mutates the DocServerApp nodes in the graph.
type DocServerAppMutation struct {
	config
	op            Op
	typ           string
	id            *int32
	application   *string
	name          *string
	created_at    *time.Time
	clearedFields map[string]struct{}
	done          bool
	oldValue      func(context.Context) (*DocServerApp, error)
	predicates    []predicate.DocServerApp
}

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

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

// newDocServerAppMutation creates new mutation for the DocServerApp entity.
func newDocServerAppMutation(c config, op Op, opts ...docserverappOption) *DocServerAppMutation {
	m := &DocServerAppMutation{
		config:        c,
		op:            op,
		typ:           TypeDocServerApp,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}

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

// withDocServerApp sets the old DocServerApp of the mutation.
func withDocServerApp(node *DocServerApp) docserverappOption {
	return func(m *DocServerAppMutation) {
		m.oldValue = func(context.Context) (*DocServerApp, 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 DocServerAppMutation) 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 DocServerAppMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, errors.New("serversitemicros: 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 DocServerApp entities.
func (m *DocServerAppMutation) SetID(id int32) {
	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 *DocServerAppMutation) ID() (id int32, 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 *DocServerAppMutation) IDs(ctx context.Context) ([]int32, error) {
	switch {
	case m.op.Is(OpUpdateOne | OpDeleteOne):
		id, exists := m.ID()
		if exists {
			return []int32{id}, nil
		}
		fallthrough
	case m.op.Is(OpUpdate | OpDelete):
		return m.Client().DocServerApp.Query().Where(m.predicates...).IDs(ctx)
	default:
		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
	}
}

// SetApplication sets the "application" field.
func (m *DocServerAppMutation) SetApplication(s string) {
	m.application = &s
}

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

// OldApplication returns the old "application" field's value of the DocServerApp entity.
// If the DocServerApp 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 *DocServerAppMutation) OldApplication(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldApplication is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldApplication requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldApplication: %w", err)
	}
	return oldValue.Application, nil
}

// ResetApplication resets all changes to the "application" field.
func (m *DocServerAppMutation) ResetApplication() {
	m.application = nil
}

// SetName sets the "name" field.
func (m *DocServerAppMutation) SetName(s string) {
	m.name = &s
}

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

// OldName returns the old "name" field's value of the DocServerApp entity.
// If the DocServerApp 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 *DocServerAppMutation) OldName(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldName is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldName requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldName: %w", err)
	}
	return oldValue.Name, nil
}

// ResetName resets all changes to the "name" field.
func (m *DocServerAppMutation) ResetName() {
	m.name = nil
}

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

// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *DocServerAppMutation) 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 DocServerApp entity.
// If the DocServerApp 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 *DocServerAppMutation) 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
}

// ClearCreatedAt clears the value of the "created_at" field.
func (m *DocServerAppMutation) ClearCreatedAt() {
	m.created_at = nil
	m.clearedFields[docserverapp.FieldCreatedAt] = struct{}{}
}

// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
func (m *DocServerAppMutation) CreatedAtCleared() bool {
	_, ok := m.clearedFields[docserverapp.FieldCreatedAt]
	return ok
}

// ResetCreatedAt resets all changes to the "created_at" field.
func (m *DocServerAppMutation) ResetCreatedAt() {
	m.created_at = nil
	delete(m.clearedFields, docserverapp.FieldCreatedAt)
}

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

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

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

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

// Type returns the node type of this mutation (DocServerApp).
func (m *DocServerAppMutation) 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 *DocServerAppMutation) Fields() []string {
	fields := make([]string, 0, 3)
	if m.application != nil {
		fields = append(fields, docserverapp.FieldApplication)
	}
	if m.name != nil {
		fields = append(fields, docserverapp.FieldName)
	}
	if m.created_at != nil {
		fields = append(fields, docserverapp.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 *DocServerAppMutation) Field(name string) (ent.Value, bool) {
	switch name {
	case docserverapp.FieldApplication:
		return m.Application()
	case docserverapp.FieldName:
		return m.Name()
	case docserverapp.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 *DocServerAppMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
	switch name {
	case docserverapp.FieldApplication:
		return m.OldApplication(ctx)
	case docserverapp.FieldName:
		return m.OldName(ctx)
	case docserverapp.FieldCreatedAt:
		return m.OldCreatedAt(ctx)
	}
	return nil, fmt.Errorf("unknown DocServerApp 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 *DocServerAppMutation) SetField(name string, value ent.Value) error {
	switch name {
	case docserverapp.FieldApplication:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetApplication(v)
		return nil
	case docserverapp.FieldName:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetName(v)
		return nil
	case docserverapp.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 DocServerApp field %s", name)
}

// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *DocServerAppMutation) AddedFields() []string {
	return nil
}

// 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 *DocServerAppMutation) AddedField(name string) (ent.Value, bool) {
	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 *DocServerAppMutation) AddField(name string, value ent.Value) error {
	switch name {
	}
	return fmt.Errorf("unknown DocServerApp numeric field %s", name)
}

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

// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *DocServerAppMutation) 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 *DocServerAppMutation) ClearField(name string) error {
	switch name {
	case docserverapp.FieldCreatedAt:
		m.ClearCreatedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerApp 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 *DocServerAppMutation) ResetField(name string) error {
	switch name {
	case docserverapp.FieldApplication:
		m.ResetApplication()
		return nil
	case docserverapp.FieldName:
		m.ResetName()
		return nil
	case docserverapp.FieldCreatedAt:
		m.ResetCreatedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerApp field %s", name)
}

// AddedEdges returns all edge names that were set/added in this mutation.
func (m *DocServerAppMutation) 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 *DocServerAppMutation) AddedIDs(name string) []ent.Value {
	return nil
}

// RemovedEdges returns all edge names that were removed in this mutation.
func (m *DocServerAppMutation) 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 *DocServerAppMutation) RemovedIDs(name string) []ent.Value {
	return nil
}

// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *DocServerAppMutation) 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 *DocServerAppMutation) 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 *DocServerAppMutation) ClearEdge(name string) error {
	return fmt.Errorf("unknown DocServerApp 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 *DocServerAppMutation) ResetEdge(name string) error {
	return fmt.Errorf("unknown DocServerApp edge %s", name)
}

// DocServerCallbackMutation represents an operation that mutates the DocServerCallback nodes in the graph.
type DocServerCallbackMutation struct {
	config
	op                   Op
	typ                  string
	id                   *int32
	server_project_id    *int32
	addserver_project_id *int32
	callback_url         *string
	callback_data        *string
	callback_type        *int8
	addcallback_type     *int8
	status               *int8
	addstatus            *int8
	curr_num             *int32
	addcurr_num          *int32
	created_at           *time.Time
	updated_at           *time.Time
	deleted_at           *time.Time
	clearedFields        map[string]struct{}
	done                 bool
	oldValue             func(context.Context) (*DocServerCallback, error)
	predicates           []predicate.DocServerCallback
}

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

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

// newDocServerCallbackMutation creates new mutation for the DocServerCallback entity.
func newDocServerCallbackMutation(c config, op Op, opts ...docservercallbackOption) *DocServerCallbackMutation {
	m := &DocServerCallbackMutation{
		config:        c,
		op:            op,
		typ:           TypeDocServerCallback,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}

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

// withDocServerCallback sets the old DocServerCallback of the mutation.
func withDocServerCallback(node *DocServerCallback) docservercallbackOption {
	return func(m *DocServerCallbackMutation) {
		m.oldValue = func(context.Context) (*DocServerCallback, 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 DocServerCallbackMutation) 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 DocServerCallbackMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, errors.New("serversitemicros: 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 DocServerCallback entities.
func (m *DocServerCallbackMutation) SetID(id int32) {
	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 *DocServerCallbackMutation) ID() (id int32, 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 *DocServerCallbackMutation) IDs(ctx context.Context) ([]int32, error) {
	switch {
	case m.op.Is(OpUpdateOne | OpDeleteOne):
		id, exists := m.ID()
		if exists {
			return []int32{id}, nil
		}
		fallthrough
	case m.op.Is(OpUpdate | OpDelete):
		return m.Client().DocServerCallback.Query().Where(m.predicates...).IDs(ctx)
	default:
		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
	}
}

// SetServerProjectID sets the "server_project_id" field.
func (m *DocServerCallbackMutation) SetServerProjectID(i int32) {
	m.server_project_id = &i
	m.addserver_project_id = nil
}

// ServerProjectID returns the value of the "server_project_id" field in the mutation.
func (m *DocServerCallbackMutation) ServerProjectID() (r int32, exists bool) {
	v := m.server_project_id
	if v == nil {
		return
	}
	return *v, true
}

// OldServerProjectID returns the old "server_project_id" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldServerProjectID(ctx context.Context) (v int32, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldServerProjectID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldServerProjectID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldServerProjectID: %w", err)
	}
	return oldValue.ServerProjectID, nil
}

// AddServerProjectID adds i to the "server_project_id" field.
func (m *DocServerCallbackMutation) AddServerProjectID(i int32) {
	if m.addserver_project_id != nil {
		*m.addserver_project_id += i
	} else {
		m.addserver_project_id = &i
	}
}

// AddedServerProjectID returns the value that was added to the "server_project_id" field in this mutation.
func (m *DocServerCallbackMutation) AddedServerProjectID() (r int32, exists bool) {
	v := m.addserver_project_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetServerProjectID resets all changes to the "server_project_id" field.
func (m *DocServerCallbackMutation) ResetServerProjectID() {
	m.server_project_id = nil
	m.addserver_project_id = nil
}

// SetCallbackURL sets the "callback_url" field.
func (m *DocServerCallbackMutation) SetCallbackURL(s string) {
	m.callback_url = &s
}

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

// OldCallbackURL returns the old "callback_url" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldCallbackURL(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCallbackURL is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCallbackURL requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCallbackURL: %w", err)
	}
	return oldValue.CallbackURL, nil
}

// ResetCallbackURL resets all changes to the "callback_url" field.
func (m *DocServerCallbackMutation) ResetCallbackURL() {
	m.callback_url = nil
}

// SetCallbackData sets the "callback_data" field.
func (m *DocServerCallbackMutation) SetCallbackData(s string) {
	m.callback_data = &s
}

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

// OldCallbackData returns the old "callback_data" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldCallbackData(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCallbackData is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCallbackData requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCallbackData: %w", err)
	}
	return oldValue.CallbackData, nil
}

// ResetCallbackData resets all changes to the "callback_data" field.
func (m *DocServerCallbackMutation) ResetCallbackData() {
	m.callback_data = nil
}

// SetCallbackType sets the "callback_type" field.
func (m *DocServerCallbackMutation) SetCallbackType(i int8) {
	m.callback_type = &i
	m.addcallback_type = nil
}

// CallbackType returns the value of the "callback_type" field in the mutation.
func (m *DocServerCallbackMutation) CallbackType() (r int8, exists bool) {
	v := m.callback_type
	if v == nil {
		return
	}
	return *v, true
}

// OldCallbackType returns the old "callback_type" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldCallbackType(ctx context.Context) (v int8, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCallbackType is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCallbackType requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCallbackType: %w", err)
	}
	return oldValue.CallbackType, nil
}

// AddCallbackType adds i to the "callback_type" field.
func (m *DocServerCallbackMutation) AddCallbackType(i int8) {
	if m.addcallback_type != nil {
		*m.addcallback_type += i
	} else {
		m.addcallback_type = &i
	}
}

// AddedCallbackType returns the value that was added to the "callback_type" field in this mutation.
func (m *DocServerCallbackMutation) AddedCallbackType() (r int8, exists bool) {
	v := m.addcallback_type
	if v == nil {
		return
	}
	return *v, true
}

// ResetCallbackType resets all changes to the "callback_type" field.
func (m *DocServerCallbackMutation) ResetCallbackType() {
	m.callback_type = nil
	m.addcallback_type = nil
}

// SetStatus sets the "status" field.
func (m *DocServerCallbackMutation) SetStatus(i int8) {
	m.status = &i
	m.addstatus = nil
}

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

// OldStatus returns the old "status" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldStatus(ctx context.Context) (v int8, 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
}

// AddStatus adds i to the "status" field.
func (m *DocServerCallbackMutation) AddStatus(i int8) {
	if m.addstatus != nil {
		*m.addstatus += i
	} else {
		m.addstatus = &i
	}
}

// AddedStatus returns the value that was added to the "status" field in this mutation.
func (m *DocServerCallbackMutation) AddedStatus() (r int8, exists bool) {
	v := m.addstatus
	if v == nil {
		return
	}
	return *v, true
}

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

// SetCurrNum sets the "curr_num" field.
func (m *DocServerCallbackMutation) SetCurrNum(i int32) {
	m.curr_num = &i
	m.addcurr_num = nil
}

// CurrNum returns the value of the "curr_num" field in the mutation.
func (m *DocServerCallbackMutation) CurrNum() (r int32, exists bool) {
	v := m.curr_num
	if v == nil {
		return
	}
	return *v, true
}

// OldCurrNum returns the old "curr_num" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldCurrNum(ctx context.Context) (v int32, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCurrNum is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCurrNum requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCurrNum: %w", err)
	}
	return oldValue.CurrNum, nil
}

// AddCurrNum adds i to the "curr_num" field.
func (m *DocServerCallbackMutation) AddCurrNum(i int32) {
	if m.addcurr_num != nil {
		*m.addcurr_num += i
	} else {
		m.addcurr_num = &i
	}
}

// AddedCurrNum returns the value that was added to the "curr_num" field in this mutation.
func (m *DocServerCallbackMutation) AddedCurrNum() (r int32, exists bool) {
	v := m.addcurr_num
	if v == nil {
		return
	}
	return *v, true
}

// ResetCurrNum resets all changes to the "curr_num" field.
func (m *DocServerCallbackMutation) ResetCurrNum() {
	m.curr_num = nil
	m.addcurr_num = nil
}

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

// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *DocServerCallbackMutation) 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 DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) 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
}

// ClearCreatedAt clears the value of the "created_at" field.
func (m *DocServerCallbackMutation) ClearCreatedAt() {
	m.created_at = nil
	m.clearedFields[docservercallback.FieldCreatedAt] = struct{}{}
}

// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
func (m *DocServerCallbackMutation) CreatedAtCleared() bool {
	_, ok := m.clearedFields[docservercallback.FieldCreatedAt]
	return ok
}

// ResetCreatedAt resets all changes to the "created_at" field.
func (m *DocServerCallbackMutation) ResetCreatedAt() {
	m.created_at = nil
	delete(m.clearedFields, docservercallback.FieldCreatedAt)
}

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

// UpdatedAt returns the value of the "updated_at" field in the mutation.
func (m *DocServerCallbackMutation) 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 DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) 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
}

// ClearUpdatedAt clears the value of the "updated_at" field.
func (m *DocServerCallbackMutation) ClearUpdatedAt() {
	m.updated_at = nil
	m.clearedFields[docservercallback.FieldUpdatedAt] = struct{}{}
}

// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
func (m *DocServerCallbackMutation) UpdatedAtCleared() bool {
	_, ok := m.clearedFields[docservercallback.FieldUpdatedAt]
	return ok
}

// ResetUpdatedAt resets all changes to the "updated_at" field.
func (m *DocServerCallbackMutation) ResetUpdatedAt() {
	m.updated_at = nil
	delete(m.clearedFields, docservercallback.FieldUpdatedAt)
}

// SetDeletedAt sets the "deleted_at" field.
func (m *DocServerCallbackMutation) SetDeletedAt(t time.Time) {
	m.deleted_at = &t
}

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

// OldDeletedAt returns the old "deleted_at" field's value of the DocServerCallback entity.
// If the DocServerCallback 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 *DocServerCallbackMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
	}
	return oldValue.DeletedAt, nil
}

// ClearDeletedAt clears the value of the "deleted_at" field.
func (m *DocServerCallbackMutation) ClearDeletedAt() {
	m.deleted_at = nil
	m.clearedFields[docservercallback.FieldDeletedAt] = struct{}{}
}

// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
func (m *DocServerCallbackMutation) DeletedAtCleared() bool {
	_, ok := m.clearedFields[docservercallback.FieldDeletedAt]
	return ok
}

// ResetDeletedAt resets all changes to the "deleted_at" field.
func (m *DocServerCallbackMutation) ResetDeletedAt() {
	m.deleted_at = nil
	delete(m.clearedFields, docservercallback.FieldDeletedAt)
}

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

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

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

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

// Type returns the node type of this mutation (DocServerCallback).
func (m *DocServerCallbackMutation) 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 *DocServerCallbackMutation) Fields() []string {
	fields := make([]string, 0, 9)
	if m.server_project_id != nil {
		fields = append(fields, docservercallback.FieldServerProjectID)
	}
	if m.callback_url != nil {
		fields = append(fields, docservercallback.FieldCallbackURL)
	}
	if m.callback_data != nil {
		fields = append(fields, docservercallback.FieldCallbackData)
	}
	if m.callback_type != nil {
		fields = append(fields, docservercallback.FieldCallbackType)
	}
	if m.status != nil {
		fields = append(fields, docservercallback.FieldStatus)
	}
	if m.curr_num != nil {
		fields = append(fields, docservercallback.FieldCurrNum)
	}
	if m.created_at != nil {
		fields = append(fields, docservercallback.FieldCreatedAt)
	}
	if m.updated_at != nil {
		fields = append(fields, docservercallback.FieldUpdatedAt)
	}
	if m.deleted_at != nil {
		fields = append(fields, docservercallback.FieldDeletedAt)
	}
	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 *DocServerCallbackMutation) Field(name string) (ent.Value, bool) {
	switch name {
	case docservercallback.FieldServerProjectID:
		return m.ServerProjectID()
	case docservercallback.FieldCallbackURL:
		return m.CallbackURL()
	case docservercallback.FieldCallbackData:
		return m.CallbackData()
	case docservercallback.FieldCallbackType:
		return m.CallbackType()
	case docservercallback.FieldStatus:
		return m.Status()
	case docservercallback.FieldCurrNum:
		return m.CurrNum()
	case docservercallback.FieldCreatedAt:
		return m.CreatedAt()
	case docservercallback.FieldUpdatedAt:
		return m.UpdatedAt()
	case docservercallback.FieldDeletedAt:
		return m.DeletedAt()
	}
	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 *DocServerCallbackMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
	switch name {
	case docservercallback.FieldServerProjectID:
		return m.OldServerProjectID(ctx)
	case docservercallback.FieldCallbackURL:
		return m.OldCallbackURL(ctx)
	case docservercallback.FieldCallbackData:
		return m.OldCallbackData(ctx)
	case docservercallback.FieldCallbackType:
		return m.OldCallbackType(ctx)
	case docservercallback.FieldStatus:
		return m.OldStatus(ctx)
	case docservercallback.FieldCurrNum:
		return m.OldCurrNum(ctx)
	case docservercallback.FieldCreatedAt:
		return m.OldCreatedAt(ctx)
	case docservercallback.FieldUpdatedAt:
		return m.OldUpdatedAt(ctx)
	case docservercallback.FieldDeletedAt:
		return m.OldDeletedAt(ctx)
	}
	return nil, fmt.Errorf("unknown DocServerCallback 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 *DocServerCallbackMutation) SetField(name string, value ent.Value) error {
	switch name {
	case docservercallback.FieldServerProjectID:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetServerProjectID(v)
		return nil
	case docservercallback.FieldCallbackURL:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCallbackURL(v)
		return nil
	case docservercallback.FieldCallbackData:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCallbackData(v)
		return nil
	case docservercallback.FieldCallbackType:
		v, ok := value.(int8)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCallbackType(v)
		return nil
	case docservercallback.FieldStatus:
		v, ok := value.(int8)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetStatus(v)
		return nil
	case docservercallback.FieldCurrNum:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCurrNum(v)
		return nil
	case docservercallback.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 docservercallback.FieldUpdatedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetUpdatedAt(v)
		return nil
	case docservercallback.FieldDeletedAt:
		v, ok := value.(time.Time)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetDeletedAt(v)
		return nil
	}
	return fmt.Errorf("unknown DocServerCallback field %s", name)
}

// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *DocServerCallbackMutation) AddedFields() []string {
	var fields []string
	if m.addserver_project_id != nil {
		fields = append(fields, docservercallback.FieldServerProjectID)
	}
	if m.addcallback_type != nil {
		fields = append(fields, docservercallback.FieldCallbackType)
	}
	if m.addstatus != nil {
		fields = append(fields, docservercallback.FieldStatus)
	}
	if m.addcurr_num != nil {
		fields = append(fields, docservercallback.FieldCurrNum)
	}
	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 *DocServerCallbackMutation) AddedField(name string) (ent.Value, bool) {
	switch name {
	case docservercallback.FieldServerProjectID:
		return m.AddedServerProjectID()
	case docservercallback.FieldCallbackType:
		return m.AddedCallbackType()
	case docservercallback.FieldStatus:
		return m.AddedStatus()
	case docservercallback.FieldCurrNum:
		return m.AddedCurrNum()
	}
	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 *DocServerCallbackMutation) AddField(name string, value ent.Value) error {
	switch name {
	case docservercallback.FieldServerProjectID:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddServerProjectID(v)
		return nil
	case docservercallback.FieldCallbackType:
		v, ok := value.(int8)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddCallbackType(v)
		return nil
	case docservercallback.FieldStatus:
		v, ok := value.(int8)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddStatus(v)
		return nil
	case docservercallback.FieldCurrNum:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddCurrNum(v)
		return nil
	}
	return fmt.Errorf("unknown DocServerCallback numeric field %s", name)
}

// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *DocServerCallbackMutation) ClearedFields() []string {
	var fields []string
	if m.FieldCleared(docservercallback.FieldCreatedAt) {
		fields = append(fields, docservercallback.FieldCreatedAt)
	}
	if m.FieldCleared(docservercallback.FieldUpdatedAt) {
		fields = append(fields, docservercallback.FieldUpdatedAt)
	}
	if m.FieldCleared(docservercallback.FieldDeletedAt) {
		fields = append(fields, docservercallback.FieldDeletedAt)
	}
	return fields
}

// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *DocServerCallbackMutation) 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 *DocServerCallbackMutation) ClearField(name string) error {
	switch name {
	case docservercallback.FieldCreatedAt:
		m.ClearCreatedAt()
		return nil
	case docservercallback.FieldUpdatedAt:
		m.ClearUpdatedAt()
		return nil
	case docservercallback.FieldDeletedAt:
		m.ClearDeletedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerCallback 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 *DocServerCallbackMutation) ResetField(name string) error {
	switch name {
	case docservercallback.FieldServerProjectID:
		m.ResetServerProjectID()
		return nil
	case docservercallback.FieldCallbackURL:
		m.ResetCallbackURL()
		return nil
	case docservercallback.FieldCallbackData:
		m.ResetCallbackData()
		return nil
	case docservercallback.FieldCallbackType:
		m.ResetCallbackType()
		return nil
	case docservercallback.FieldStatus:
		m.ResetStatus()
		return nil
	case docservercallback.FieldCurrNum:
		m.ResetCurrNum()
		return nil
	case docservercallback.FieldCreatedAt:
		m.ResetCreatedAt()
		return nil
	case docservercallback.FieldUpdatedAt:
		m.ResetUpdatedAt()
		return nil
	case docservercallback.FieldDeletedAt:
		m.ResetDeletedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerCallback field %s", name)
}

// AddedEdges returns all edge names that were set/added in this mutation.
func (m *DocServerCallbackMutation) 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 *DocServerCallbackMutation) AddedIDs(name string) []ent.Value {
	return nil
}

// RemovedEdges returns all edge names that were removed in this mutation.
func (m *DocServerCallbackMutation) 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 *DocServerCallbackMutation) RemovedIDs(name string) []ent.Value {
	return nil
}

// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *DocServerCallbackMutation) 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 *DocServerCallbackMutation) 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 *DocServerCallbackMutation) ClearEdge(name string) error {
	return fmt.Errorf("unknown DocServerCallback 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 *DocServerCallbackMutation) ResetEdge(name string) error {
	return fmt.Errorf("unknown DocServerCallback edge %s", name)
}

// DocServerGetProjectMutation represents an operation that mutates the DocServerGetProject nodes in the graph.
type DocServerGetProjectMutation struct {
	config
	op                   Op
	typ                  string
	id                   *int32
	server_project_id    *int32
	addserver_project_id *int32
	curr_num             *int32
	addcurr_num          *int32
	status               *int8
	addstatus            *int8
	ali_result           *string
	created_at           *time.Time
	updated_at           *time.Time
	clearedFields        map[string]struct{}
	done                 bool
	oldValue             func(context.Context) (*DocServerGetProject, error)
	predicates           []predicate.DocServerGetProject
}

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

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

// newDocServerGetProjectMutation creates new mutation for the DocServerGetProject entity.
func newDocServerGetProjectMutation(c config, op Op, opts ...docservergetprojectOption) *DocServerGetProjectMutation {
	m := &DocServerGetProjectMutation{
		config:        c,
		op:            op,
		typ:           TypeDocServerGetProject,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}

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

// withDocServerGetProject sets the old DocServerGetProject of the mutation.
func withDocServerGetProject(node *DocServerGetProject) docservergetprojectOption {
	return func(m *DocServerGetProjectMutation) {
		m.oldValue = func(context.Context) (*DocServerGetProject, 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 DocServerGetProjectMutation) 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 DocServerGetProjectMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, errors.New("serversitemicros: 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 DocServerGetProject entities.
func (m *DocServerGetProjectMutation) SetID(id int32) {
	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 *DocServerGetProjectMutation) ID() (id int32, 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 *DocServerGetProjectMutation) IDs(ctx context.Context) ([]int32, error) {
	switch {
	case m.op.Is(OpUpdateOne | OpDeleteOne):
		id, exists := m.ID()
		if exists {
			return []int32{id}, nil
		}
		fallthrough
	case m.op.Is(OpUpdate | OpDelete):
		return m.Client().DocServerGetProject.Query().Where(m.predicates...).IDs(ctx)
	default:
		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
	}
}

// SetServerProjectID sets the "server_project_id" field.
func (m *DocServerGetProjectMutation) SetServerProjectID(i int32) {
	m.server_project_id = &i
	m.addserver_project_id = nil
}

// ServerProjectID returns the value of the "server_project_id" field in the mutation.
func (m *DocServerGetProjectMutation) ServerProjectID() (r int32, exists bool) {
	v := m.server_project_id
	if v == nil {
		return
	}
	return *v, true
}

// OldServerProjectID returns the old "server_project_id" field's value of the DocServerGetProject entity.
// If the DocServerGetProject 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 *DocServerGetProjectMutation) OldServerProjectID(ctx context.Context) (v int32, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldServerProjectID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldServerProjectID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldServerProjectID: %w", err)
	}
	return oldValue.ServerProjectID, nil
}

// AddServerProjectID adds i to the "server_project_id" field.
func (m *DocServerGetProjectMutation) AddServerProjectID(i int32) {
	if m.addserver_project_id != nil {
		*m.addserver_project_id += i
	} else {
		m.addserver_project_id = &i
	}
}

// AddedServerProjectID returns the value that was added to the "server_project_id" field in this mutation.
func (m *DocServerGetProjectMutation) AddedServerProjectID() (r int32, exists bool) {
	v := m.addserver_project_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetServerProjectID resets all changes to the "server_project_id" field.
func (m *DocServerGetProjectMutation) ResetServerProjectID() {
	m.server_project_id = nil
	m.addserver_project_id = nil
}

// SetCurrNum sets the "curr_num" field.
func (m *DocServerGetProjectMutation) SetCurrNum(i int32) {
	m.curr_num = &i
	m.addcurr_num = nil
}

// CurrNum returns the value of the "curr_num" field in the mutation.
func (m *DocServerGetProjectMutation) CurrNum() (r int32, exists bool) {
	v := m.curr_num
	if v == nil {
		return
	}
	return *v, true
}

// OldCurrNum returns the old "curr_num" field's value of the DocServerGetProject entity.
// If the DocServerGetProject 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 *DocServerGetProjectMutation) OldCurrNum(ctx context.Context) (v int32, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldCurrNum is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldCurrNum requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldCurrNum: %w", err)
	}
	return oldValue.CurrNum, nil
}

// AddCurrNum adds i to the "curr_num" field.
func (m *DocServerGetProjectMutation) AddCurrNum(i int32) {
	if m.addcurr_num != nil {
		*m.addcurr_num += i
	} else {
		m.addcurr_num = &i
	}
}

// AddedCurrNum returns the value that was added to the "curr_num" field in this mutation.
func (m *DocServerGetProjectMutation) AddedCurrNum() (r int32, exists bool) {
	v := m.addcurr_num
	if v == nil {
		return
	}
	return *v, true
}

// ResetCurrNum resets all changes to the "curr_num" field.
func (m *DocServerGetProjectMutation) ResetCurrNum() {
	m.curr_num = nil
	m.addcurr_num = nil
}

// SetStatus sets the "status" field.
func (m *DocServerGetProjectMutation) SetStatus(i int8) {
	m.status = &i
	m.addstatus = nil
}

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

// OldStatus returns the old "status" field's value of the DocServerGetProject entity.
// If the DocServerGetProject 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 *DocServerGetProjectMutation) OldStatus(ctx context.Context) (v int8, 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
}

// AddStatus adds i to the "status" field.
func (m *DocServerGetProjectMutation) AddStatus(i int8) {
	if m.addstatus != nil {
		*m.addstatus += i
	} else {
		m.addstatus = &i
	}
}

// AddedStatus returns the value that was added to the "status" field in this mutation.
func (m *DocServerGetProjectMutation) AddedStatus() (r int8, exists bool) {
	v := m.addstatus
	if v == nil {
		return
	}
	return *v, true
}

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

// SetAliResult sets the "ali_result" field.
func (m *DocServerGetProjectMutation) SetAliResult(s string) {
	m.ali_result = &s
}

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

// OldAliResult returns the old "ali_result" field's value of the DocServerGetProject entity.
// If the DocServerGetProject 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 *DocServerGetProjectMutation) OldAliResult(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldAliResult is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldAliResult requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldAliResult: %w", err)
	}
	return oldValue.AliResult, nil
}

// ClearAliResult clears the value of the "ali_result" field.
func (m *DocServerGetProjectMutation) ClearAliResult() {
	m.ali_result = nil
	m.clearedFields[docservergetproject.FieldAliResult] = struct{}{}
}

// AliResultCleared returns if the "ali_result" field was cleared in this mutation.
func (m *DocServerGetProjectMutation) AliResultCleared() bool {
	_, ok := m.clearedFields[docservergetproject.FieldAliResult]
	return ok
}

// ResetAliResult resets all changes to the "ali_result" field.
func (m *DocServerGetProjectMutation) ResetAliResult() {
	m.ali_result = nil
	delete(m.clearedFields, docservergetproject.FieldAliResult)
}

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

// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *DocServerGetProjectMutation) 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 DocServerGetProject entity.
// If the DocServerGetProject 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 *DocServerGetProjectMutation) 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
}

// ClearCreatedAt clears the value of the "created_at" field.
func (m *DocServerGetProjectMutation) ClearCreatedAt() {
	m.created_at = nil
	m.clearedFields[docservergetproject.FieldCreatedAt] = struct{}{}
}

// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
func (m *DocServerGetProjectMutation) CreatedAtCleared() bool {
	_, ok := m.clearedFields[docservergetproject.FieldCreatedAt]
	return ok
}

// ResetCreatedAt resets all changes to the "created_at" field.
func (m *DocServerGetProjectMutation) ResetCreatedAt() {
	m.created_at = nil
	delete(m.clearedFields, docservergetproject.FieldCreatedAt)
}

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

// UpdatedAt returns the value of the "updated_at" field in the mutation.
func (m *DocServerGetProjectMutation) 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 DocServerGetProject entity.
// If the DocServerGetProject 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 *DocServerGetProjectMutation) 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
}

// ClearUpdatedAt clears the value of the "updated_at" field.
func (m *DocServerGetProjectMutation) ClearUpdatedAt() {
	m.updated_at = nil
	m.clearedFields[docservergetproject.FieldUpdatedAt] = struct{}{}
}

// UpdatedAtCleared returns if the "updated_at" field was cleared in this mutation.
func (m *DocServerGetProjectMutation) UpdatedAtCleared() bool {
	_, ok := m.clearedFields[docservergetproject.FieldUpdatedAt]
	return ok
}

// ResetUpdatedAt resets all changes to the "updated_at" field.
func (m *DocServerGetProjectMutation) ResetUpdatedAt() {
	m.updated_at = nil
	delete(m.clearedFields, docservergetproject.FieldUpdatedAt)
}

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

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

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

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

// Type returns the node type of this mutation (DocServerGetProject).
func (m *DocServerGetProjectMutation) 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 *DocServerGetProjectMutation) Fields() []string {
	fields := make([]string, 0, 6)
	if m.server_project_id != nil {
		fields = append(fields, docservergetproject.FieldServerProjectID)
	}
	if m.curr_num != nil {
		fields = append(fields, docservergetproject.FieldCurrNum)
	}
	if m.status != nil {
		fields = append(fields, docservergetproject.FieldStatus)
	}
	if m.ali_result != nil {
		fields = append(fields, docservergetproject.FieldAliResult)
	}
	if m.created_at != nil {
		fields = append(fields, docservergetproject.FieldCreatedAt)
	}
	if m.updated_at != nil {
		fields = append(fields, docservergetproject.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 *DocServerGetProjectMutation) Field(name string) (ent.Value, bool) {
	switch name {
	case docservergetproject.FieldServerProjectID:
		return m.ServerProjectID()
	case docservergetproject.FieldCurrNum:
		return m.CurrNum()
	case docservergetproject.FieldStatus:
		return m.Status()
	case docservergetproject.FieldAliResult:
		return m.AliResult()
	case docservergetproject.FieldCreatedAt:
		return m.CreatedAt()
	case docservergetproject.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 *DocServerGetProjectMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
	switch name {
	case docservergetproject.FieldServerProjectID:
		return m.OldServerProjectID(ctx)
	case docservergetproject.FieldCurrNum:
		return m.OldCurrNum(ctx)
	case docservergetproject.FieldStatus:
		return m.OldStatus(ctx)
	case docservergetproject.FieldAliResult:
		return m.OldAliResult(ctx)
	case docservergetproject.FieldCreatedAt:
		return m.OldCreatedAt(ctx)
	case docservergetproject.FieldUpdatedAt:
		return m.OldUpdatedAt(ctx)
	}
	return nil, fmt.Errorf("unknown DocServerGetProject 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 *DocServerGetProjectMutation) SetField(name string, value ent.Value) error {
	switch name {
	case docservergetproject.FieldServerProjectID:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetServerProjectID(v)
		return nil
	case docservergetproject.FieldCurrNum:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetCurrNum(v)
		return nil
	case docservergetproject.FieldStatus:
		v, ok := value.(int8)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetStatus(v)
		return nil
	case docservergetproject.FieldAliResult:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetAliResult(v)
		return nil
	case docservergetproject.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 docservergetproject.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 DocServerGetProject field %s", name)
}

// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *DocServerGetProjectMutation) AddedFields() []string {
	var fields []string
	if m.addserver_project_id != nil {
		fields = append(fields, docservergetproject.FieldServerProjectID)
	}
	if m.addcurr_num != nil {
		fields = append(fields, docservergetproject.FieldCurrNum)
	}
	if m.addstatus != nil {
		fields = append(fields, docservergetproject.FieldStatus)
	}
	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 *DocServerGetProjectMutation) AddedField(name string) (ent.Value, bool) {
	switch name {
	case docservergetproject.FieldServerProjectID:
		return m.AddedServerProjectID()
	case docservergetproject.FieldCurrNum:
		return m.AddedCurrNum()
	case docservergetproject.FieldStatus:
		return m.AddedStatus()
	}
	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 *DocServerGetProjectMutation) AddField(name string, value ent.Value) error {
	switch name {
	case docservergetproject.FieldServerProjectID:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddServerProjectID(v)
		return nil
	case docservergetproject.FieldCurrNum:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddCurrNum(v)
		return nil
	case docservergetproject.FieldStatus:
		v, ok := value.(int8)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddStatus(v)
		return nil
	}
	return fmt.Errorf("unknown DocServerGetProject numeric field %s", name)
}

// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *DocServerGetProjectMutation) ClearedFields() []string {
	var fields []string
	if m.FieldCleared(docservergetproject.FieldAliResult) {
		fields = append(fields, docservergetproject.FieldAliResult)
	}
	if m.FieldCleared(docservergetproject.FieldCreatedAt) {
		fields = append(fields, docservergetproject.FieldCreatedAt)
	}
	if m.FieldCleared(docservergetproject.FieldUpdatedAt) {
		fields = append(fields, docservergetproject.FieldUpdatedAt)
	}
	return fields
}

// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *DocServerGetProjectMutation) 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 *DocServerGetProjectMutation) ClearField(name string) error {
	switch name {
	case docservergetproject.FieldAliResult:
		m.ClearAliResult()
		return nil
	case docservergetproject.FieldCreatedAt:
		m.ClearCreatedAt()
		return nil
	case docservergetproject.FieldUpdatedAt:
		m.ClearUpdatedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerGetProject 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 *DocServerGetProjectMutation) ResetField(name string) error {
	switch name {
	case docservergetproject.FieldServerProjectID:
		m.ResetServerProjectID()
		return nil
	case docservergetproject.FieldCurrNum:
		m.ResetCurrNum()
		return nil
	case docservergetproject.FieldStatus:
		m.ResetStatus()
		return nil
	case docservergetproject.FieldAliResult:
		m.ResetAliResult()
		return nil
	case docservergetproject.FieldCreatedAt:
		m.ResetCreatedAt()
		return nil
	case docservergetproject.FieldUpdatedAt:
		m.ResetUpdatedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerGetProject field %s", name)
}

// AddedEdges returns all edge names that were set/added in this mutation.
func (m *DocServerGetProjectMutation) 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 *DocServerGetProjectMutation) AddedIDs(name string) []ent.Value {
	return nil
}

// RemovedEdges returns all edge names that were removed in this mutation.
func (m *DocServerGetProjectMutation) 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 *DocServerGetProjectMutation) RemovedIDs(name string) []ent.Value {
	return nil
}

// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *DocServerGetProjectMutation) 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 *DocServerGetProjectMutation) 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 *DocServerGetProjectMutation) ClearEdge(name string) error {
	return fmt.Errorf("unknown DocServerGetProject 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 *DocServerGetProjectMutation) ResetEdge(name string) error {
	return fmt.Errorf("unknown DocServerGetProject edge %s", name)
}

// DocServerProjectMutation represents an operation that mutates the DocServerProject nodes in the graph.
type DocServerProjectMutation struct {
	config
	op            Op
	typ           string
	id            *int32
	project_name  *string
	source_type   *string
	target_type   *string
	source_url    *string
	target_url    *string
	task_id       *string
	app_id        *int32
	addapp_id     *int32
	status        *int32
	addstatus     *int32
	created_at    *time.Time
	clearedFields map[string]struct{}
	done          bool
	oldValue      func(context.Context) (*DocServerProject, error)
	predicates    []predicate.DocServerProject
}

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

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

// newDocServerProjectMutation creates new mutation for the DocServerProject entity.
func newDocServerProjectMutation(c config, op Op, opts ...docserverprojectOption) *DocServerProjectMutation {
	m := &DocServerProjectMutation{
		config:        c,
		op:            op,
		typ:           TypeDocServerProject,
		clearedFields: make(map[string]struct{}),
	}
	for _, opt := range opts {
		opt(m)
	}
	return m
}

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

// withDocServerProject sets the old DocServerProject of the mutation.
func withDocServerProject(node *DocServerProject) docserverprojectOption {
	return func(m *DocServerProjectMutation) {
		m.oldValue = func(context.Context) (*DocServerProject, 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 DocServerProjectMutation) 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 DocServerProjectMutation) Tx() (*Tx, error) {
	if _, ok := m.driver.(*txDriver); !ok {
		return nil, errors.New("serversitemicros: 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 DocServerProject entities.
func (m *DocServerProjectMutation) SetID(id int32) {
	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 *DocServerProjectMutation) ID() (id int32, 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 *DocServerProjectMutation) IDs(ctx context.Context) ([]int32, error) {
	switch {
	case m.op.Is(OpUpdateOne | OpDeleteOne):
		id, exists := m.ID()
		if exists {
			return []int32{id}, nil
		}
		fallthrough
	case m.op.Is(OpUpdate | OpDelete):
		return m.Client().DocServerProject.Query().Where(m.predicates...).IDs(ctx)
	default:
		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
	}
}

// SetProjectName sets the "project_name" field.
func (m *DocServerProjectMutation) SetProjectName(s string) {
	m.project_name = &s
}

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

// OldProjectName returns the old "project_name" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldProjectName(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldProjectName is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldProjectName requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldProjectName: %w", err)
	}
	return oldValue.ProjectName, nil
}

// ResetProjectName resets all changes to the "project_name" field.
func (m *DocServerProjectMutation) ResetProjectName() {
	m.project_name = nil
}

// SetSourceType sets the "source_type" field.
func (m *DocServerProjectMutation) SetSourceType(s string) {
	m.source_type = &s
}

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

// OldSourceType returns the old "source_type" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldSourceType(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldSourceType is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldSourceType requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldSourceType: %w", err)
	}
	return oldValue.SourceType, nil
}

// ResetSourceType resets all changes to the "source_type" field.
func (m *DocServerProjectMutation) ResetSourceType() {
	m.source_type = nil
}

// SetTargetType sets the "target_type" field.
func (m *DocServerProjectMutation) SetTargetType(s string) {
	m.target_type = &s
}

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

// OldTargetType returns the old "target_type" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldTargetType(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldTargetType is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldTargetType requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldTargetType: %w", err)
	}
	return oldValue.TargetType, nil
}

// ResetTargetType resets all changes to the "target_type" field.
func (m *DocServerProjectMutation) ResetTargetType() {
	m.target_type = nil
}

// SetSourceURL sets the "source_url" field.
func (m *DocServerProjectMutation) SetSourceURL(s string) {
	m.source_url = &s
}

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

// OldSourceURL returns the old "source_url" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldSourceURL(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldSourceURL is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldSourceURL requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldSourceURL: %w", err)
	}
	return oldValue.SourceURL, nil
}

// ClearSourceURL clears the value of the "source_url" field.
func (m *DocServerProjectMutation) ClearSourceURL() {
	m.source_url = nil
	m.clearedFields[docserverproject.FieldSourceURL] = struct{}{}
}

// SourceURLCleared returns if the "source_url" field was cleared in this mutation.
func (m *DocServerProjectMutation) SourceURLCleared() bool {
	_, ok := m.clearedFields[docserverproject.FieldSourceURL]
	return ok
}

// ResetSourceURL resets all changes to the "source_url" field.
func (m *DocServerProjectMutation) ResetSourceURL() {
	m.source_url = nil
	delete(m.clearedFields, docserverproject.FieldSourceURL)
}

// SetTargetURL sets the "target_url" field.
func (m *DocServerProjectMutation) SetTargetURL(s string) {
	m.target_url = &s
}

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

// OldTargetURL returns the old "target_url" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldTargetURL(ctx context.Context) (v *string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldTargetURL is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldTargetURL requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldTargetURL: %w", err)
	}
	return oldValue.TargetURL, nil
}

// ClearTargetURL clears the value of the "target_url" field.
func (m *DocServerProjectMutation) ClearTargetURL() {
	m.target_url = nil
	m.clearedFields[docserverproject.FieldTargetURL] = struct{}{}
}

// TargetURLCleared returns if the "target_url" field was cleared in this mutation.
func (m *DocServerProjectMutation) TargetURLCleared() bool {
	_, ok := m.clearedFields[docserverproject.FieldTargetURL]
	return ok
}

// ResetTargetURL resets all changes to the "target_url" field.
func (m *DocServerProjectMutation) ResetTargetURL() {
	m.target_url = nil
	delete(m.clearedFields, docserverproject.FieldTargetURL)
}

// SetTaskID sets the "task_id" field.
func (m *DocServerProjectMutation) SetTaskID(s string) {
	m.task_id = &s
}

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

// OldTaskID returns the old "task_id" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldTaskID(ctx context.Context) (v string, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldTaskID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldTaskID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldTaskID: %w", err)
	}
	return oldValue.TaskID, nil
}

// ResetTaskID resets all changes to the "task_id" field.
func (m *DocServerProjectMutation) ResetTaskID() {
	m.task_id = nil
}

// SetAppID sets the "app_id" field.
func (m *DocServerProjectMutation) SetAppID(i int32) {
	m.app_id = &i
	m.addapp_id = nil
}

// AppID returns the value of the "app_id" field in the mutation.
func (m *DocServerProjectMutation) AppID() (r int32, exists bool) {
	v := m.app_id
	if v == nil {
		return
	}
	return *v, true
}

// OldAppID returns the old "app_id" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldAppID(ctx context.Context) (v int32, err error) {
	if !m.op.Is(OpUpdateOne) {
		return v, errors.New("OldAppID is only allowed on UpdateOne operations")
	}
	if m.id == nil || m.oldValue == nil {
		return v, errors.New("OldAppID requires an ID field in the mutation")
	}
	oldValue, err := m.oldValue(ctx)
	if err != nil {
		return v, fmt.Errorf("querying old value for OldAppID: %w", err)
	}
	return oldValue.AppID, nil
}

// AddAppID adds i to the "app_id" field.
func (m *DocServerProjectMutation) AddAppID(i int32) {
	if m.addapp_id != nil {
		*m.addapp_id += i
	} else {
		m.addapp_id = &i
	}
}

// AddedAppID returns the value that was added to the "app_id" field in this mutation.
func (m *DocServerProjectMutation) AddedAppID() (r int32, exists bool) {
	v := m.addapp_id
	if v == nil {
		return
	}
	return *v, true
}

// ResetAppID resets all changes to the "app_id" field.
func (m *DocServerProjectMutation) ResetAppID() {
	m.app_id = nil
	m.addapp_id = nil
}

// SetStatus sets the "status" field.
func (m *DocServerProjectMutation) SetStatus(i int32) {
	m.status = &i
	m.addstatus = nil
}

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

// OldStatus returns the old "status" field's value of the DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) OldStatus(ctx context.Context) (v int32, 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
}

// AddStatus adds i to the "status" field.
func (m *DocServerProjectMutation) AddStatus(i int32) {
	if m.addstatus != nil {
		*m.addstatus += i
	} else {
		m.addstatus = &i
	}
}

// AddedStatus returns the value that was added to the "status" field in this mutation.
func (m *DocServerProjectMutation) AddedStatus() (r int32, exists bool) {
	v := m.addstatus
	if v == nil {
		return
	}
	return *v, true
}

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

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

// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *DocServerProjectMutation) 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 DocServerProject entity.
// If the DocServerProject 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 *DocServerProjectMutation) 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
}

// ClearCreatedAt clears the value of the "created_at" field.
func (m *DocServerProjectMutation) ClearCreatedAt() {
	m.created_at = nil
	m.clearedFields[docserverproject.FieldCreatedAt] = struct{}{}
}

// CreatedAtCleared returns if the "created_at" field was cleared in this mutation.
func (m *DocServerProjectMutation) CreatedAtCleared() bool {
	_, ok := m.clearedFields[docserverproject.FieldCreatedAt]
	return ok
}

// ResetCreatedAt resets all changes to the "created_at" field.
func (m *DocServerProjectMutation) ResetCreatedAt() {
	m.created_at = nil
	delete(m.clearedFields, docserverproject.FieldCreatedAt)
}

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

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

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

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

// Type returns the node type of this mutation (DocServerProject).
func (m *DocServerProjectMutation) 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 *DocServerProjectMutation) Fields() []string {
	fields := make([]string, 0, 9)
	if m.project_name != nil {
		fields = append(fields, docserverproject.FieldProjectName)
	}
	if m.source_type != nil {
		fields = append(fields, docserverproject.FieldSourceType)
	}
	if m.target_type != nil {
		fields = append(fields, docserverproject.FieldTargetType)
	}
	if m.source_url != nil {
		fields = append(fields, docserverproject.FieldSourceURL)
	}
	if m.target_url != nil {
		fields = append(fields, docserverproject.FieldTargetURL)
	}
	if m.task_id != nil {
		fields = append(fields, docserverproject.FieldTaskID)
	}
	if m.app_id != nil {
		fields = append(fields, docserverproject.FieldAppID)
	}
	if m.status != nil {
		fields = append(fields, docserverproject.FieldStatus)
	}
	if m.created_at != nil {
		fields = append(fields, docserverproject.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 *DocServerProjectMutation) Field(name string) (ent.Value, bool) {
	switch name {
	case docserverproject.FieldProjectName:
		return m.ProjectName()
	case docserverproject.FieldSourceType:
		return m.SourceType()
	case docserverproject.FieldTargetType:
		return m.TargetType()
	case docserverproject.FieldSourceURL:
		return m.SourceURL()
	case docserverproject.FieldTargetURL:
		return m.TargetURL()
	case docserverproject.FieldTaskID:
		return m.TaskID()
	case docserverproject.FieldAppID:
		return m.AppID()
	case docserverproject.FieldStatus:
		return m.Status()
	case docserverproject.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 *DocServerProjectMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
	switch name {
	case docserverproject.FieldProjectName:
		return m.OldProjectName(ctx)
	case docserverproject.FieldSourceType:
		return m.OldSourceType(ctx)
	case docserverproject.FieldTargetType:
		return m.OldTargetType(ctx)
	case docserverproject.FieldSourceURL:
		return m.OldSourceURL(ctx)
	case docserverproject.FieldTargetURL:
		return m.OldTargetURL(ctx)
	case docserverproject.FieldTaskID:
		return m.OldTaskID(ctx)
	case docserverproject.FieldAppID:
		return m.OldAppID(ctx)
	case docserverproject.FieldStatus:
		return m.OldStatus(ctx)
	case docserverproject.FieldCreatedAt:
		return m.OldCreatedAt(ctx)
	}
	return nil, fmt.Errorf("unknown DocServerProject 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 *DocServerProjectMutation) SetField(name string, value ent.Value) error {
	switch name {
	case docserverproject.FieldProjectName:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetProjectName(v)
		return nil
	case docserverproject.FieldSourceType:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetSourceType(v)
		return nil
	case docserverproject.FieldTargetType:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetTargetType(v)
		return nil
	case docserverproject.FieldSourceURL:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetSourceURL(v)
		return nil
	case docserverproject.FieldTargetURL:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetTargetURL(v)
		return nil
	case docserverproject.FieldTaskID:
		v, ok := value.(string)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetTaskID(v)
		return nil
	case docserverproject.FieldAppID:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetAppID(v)
		return nil
	case docserverproject.FieldStatus:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.SetStatus(v)
		return nil
	case docserverproject.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 DocServerProject field %s", name)
}

// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *DocServerProjectMutation) AddedFields() []string {
	var fields []string
	if m.addapp_id != nil {
		fields = append(fields, docserverproject.FieldAppID)
	}
	if m.addstatus != nil {
		fields = append(fields, docserverproject.FieldStatus)
	}
	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 *DocServerProjectMutation) AddedField(name string) (ent.Value, bool) {
	switch name {
	case docserverproject.FieldAppID:
		return m.AddedAppID()
	case docserverproject.FieldStatus:
		return m.AddedStatus()
	}
	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 *DocServerProjectMutation) AddField(name string, value ent.Value) error {
	switch name {
	case docserverproject.FieldAppID:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddAppID(v)
		return nil
	case docserverproject.FieldStatus:
		v, ok := value.(int32)
		if !ok {
			return fmt.Errorf("unexpected type %T for field %s", value, name)
		}
		m.AddStatus(v)
		return nil
	}
	return fmt.Errorf("unknown DocServerProject numeric field %s", name)
}

// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *DocServerProjectMutation) ClearedFields() []string {
	var fields []string
	if m.FieldCleared(docserverproject.FieldSourceURL) {
		fields = append(fields, docserverproject.FieldSourceURL)
	}
	if m.FieldCleared(docserverproject.FieldTargetURL) {
		fields = append(fields, docserverproject.FieldTargetURL)
	}
	if m.FieldCleared(docserverproject.FieldCreatedAt) {
		fields = append(fields, docserverproject.FieldCreatedAt)
	}
	return fields
}

// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *DocServerProjectMutation) 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 *DocServerProjectMutation) ClearField(name string) error {
	switch name {
	case docserverproject.FieldSourceURL:
		m.ClearSourceURL()
		return nil
	case docserverproject.FieldTargetURL:
		m.ClearTargetURL()
		return nil
	case docserverproject.FieldCreatedAt:
		m.ClearCreatedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerProject 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 *DocServerProjectMutation) ResetField(name string) error {
	switch name {
	case docserverproject.FieldProjectName:
		m.ResetProjectName()
		return nil
	case docserverproject.FieldSourceType:
		m.ResetSourceType()
		return nil
	case docserverproject.FieldTargetType:
		m.ResetTargetType()
		return nil
	case docserverproject.FieldSourceURL:
		m.ResetSourceURL()
		return nil
	case docserverproject.FieldTargetURL:
		m.ResetTargetURL()
		return nil
	case docserverproject.FieldTaskID:
		m.ResetTaskID()
		return nil
	case docserverproject.FieldAppID:
		m.ResetAppID()
		return nil
	case docserverproject.FieldStatus:
		m.ResetStatus()
		return nil
	case docserverproject.FieldCreatedAt:
		m.ResetCreatedAt()
		return nil
	}
	return fmt.Errorf("unknown DocServerProject field %s", name)
}

// AddedEdges returns all edge names that were set/added in this mutation.
func (m *DocServerProjectMutation) 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 *DocServerProjectMutation) AddedIDs(name string) []ent.Value {
	return nil
}

// RemovedEdges returns all edge names that were removed in this mutation.
func (m *DocServerProjectMutation) 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 *DocServerProjectMutation) RemovedIDs(name string) []ent.Value {
	return nil
}

// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *DocServerProjectMutation) 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 *DocServerProjectMutation) 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 *DocServerProjectMutation) ClearEdge(name string) error {
	return fmt.Errorf("unknown DocServerProject 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 *DocServerProjectMutation) ResetEdge(name string) error {
	return fmt.Errorf("unknown DocServerProject edge %s", name)
}
