// Code generated by thriftrw v1.29.2. DO NOT EDIT.
// @generated

package history

import (
	bytes "bytes"
	base64 "encoding/base64"
	errors "errors"
	fmt "fmt"
	strings "strings"

	multierr "go.uber.org/multierr"
	stream "go.uber.org/thriftrw/protocol/stream"
	thriftreflect "go.uber.org/thriftrw/thriftreflect"
	wire "go.uber.org/thriftrw/wire"
	zapcore "go.uber.org/zap/zapcore"

	replicator "github.com/uber/cadence/.gen/go/replicator"
	shared "github.com/uber/cadence/.gen/go/shared"
)

// Any{ValueType} identifier for WeightedRatelimitQuotas data
const WeightedRatelimitQuotasAnyType string = "cadence:loadbalanced:update_response"

// Any{ValueType} identifier for WeightedRatelimitUsage data
const WeightedRatelimitUsageAnyType string = "cadence:loadbalanced:update_request"

const WeightedRatelimitUsageQuotasAnyType string = "cadence:loadbalanced:update_response_used"

type DescribeMutableStateRequest struct {
	DomainUUID *string                   `json:"domainUUID,omitempty"`
	Execution  *shared.WorkflowExecution `json:"execution,omitempty"`
}

// ToWire translates a DescribeMutableStateRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *DescribeMutableStateRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _WorkflowExecution_Read(w wire.Value) (*shared.WorkflowExecution, error) {
	var v shared.WorkflowExecution
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a DescribeMutableStateRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a DescribeMutableStateRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v DescribeMutableStateRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *DescribeMutableStateRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a DescribeMutableStateRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a DescribeMutableStateRequest struct could not be encoded.
func (v *DescribeMutableStateRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _WorkflowExecution_Decode(sr stream.Reader) (*shared.WorkflowExecution, error) {
	var v shared.WorkflowExecution
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a DescribeMutableStateRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a DescribeMutableStateRequest struct could not be generated from the wire
// representation.
func (v *DescribeMutableStateRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a DescribeMutableStateRequest
// struct.
func (v *DescribeMutableStateRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}

	return fmt.Sprintf("DescribeMutableStateRequest{%v}", strings.Join(fields[:i], ", "))
}

func _String_EqualsPtr(lhs, rhs *string) bool {
	if lhs != nil && rhs != nil {

		x := *lhs
		y := *rhs
		return (x == y)
	}
	return lhs == nil && rhs == nil
}

// Equals returns true if all the fields of this DescribeMutableStateRequest match the
// provided DescribeMutableStateRequest.
//
// This function performs a deep comparison.
func (v *DescribeMutableStateRequest) Equals(rhs *DescribeMutableStateRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DescribeMutableStateRequest.
func (v *DescribeMutableStateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *DescribeMutableStateRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *DescribeMutableStateRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *DescribeMutableStateRequest) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *DescribeMutableStateRequest) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

type DescribeMutableStateResponse struct {
	MutableStateInCache    *string `json:"mutableStateInCache,omitempty"`
	MutableStateInDatabase *string `json:"mutableStateInDatabase,omitempty"`
}

// ToWire translates a DescribeMutableStateResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *DescribeMutableStateResponse) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.MutableStateInCache != nil {
		w, err = wire.NewValueString(*(v.MutableStateInCache)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.MutableStateInDatabase != nil {
		w, err = wire.NewValueString(*(v.MutableStateInDatabase)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a DescribeMutableStateResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a DescribeMutableStateResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v DescribeMutableStateResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *DescribeMutableStateResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 30:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.MutableStateInCache = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.MutableStateInDatabase = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a DescribeMutableStateResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a DescribeMutableStateResponse struct could not be encoded.
func (v *DescribeMutableStateResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.MutableStateInCache != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.MutableStateInCache)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.MutableStateInDatabase != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.MutableStateInDatabase)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a DescribeMutableStateResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a DescribeMutableStateResponse struct could not be generated from the wire
// representation.
func (v *DescribeMutableStateResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 30 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.MutableStateInCache = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.MutableStateInDatabase = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a DescribeMutableStateResponse
// struct.
func (v *DescribeMutableStateResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.MutableStateInCache != nil {
		fields[i] = fmt.Sprintf("MutableStateInCache: %v", *(v.MutableStateInCache))
		i++
	}
	if v.MutableStateInDatabase != nil {
		fields[i] = fmt.Sprintf("MutableStateInDatabase: %v", *(v.MutableStateInDatabase))
		i++
	}

	return fmt.Sprintf("DescribeMutableStateResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this DescribeMutableStateResponse match the
// provided DescribeMutableStateResponse.
//
// This function performs a deep comparison.
func (v *DescribeMutableStateResponse) Equals(rhs *DescribeMutableStateResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.MutableStateInCache, rhs.MutableStateInCache) {
		return false
	}
	if !_String_EqualsPtr(v.MutableStateInDatabase, rhs.MutableStateInDatabase) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DescribeMutableStateResponse.
func (v *DescribeMutableStateResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.MutableStateInCache != nil {
		enc.AddString("mutableStateInCache", *v.MutableStateInCache)
	}
	if v.MutableStateInDatabase != nil {
		enc.AddString("mutableStateInDatabase", *v.MutableStateInDatabase)
	}
	return err
}

// GetMutableStateInCache returns the value of MutableStateInCache if it is set or its
// zero value if it is unset.
func (v *DescribeMutableStateResponse) GetMutableStateInCache() (o string) {
	if v != nil && v.MutableStateInCache != nil {
		return *v.MutableStateInCache
	}

	return
}

// IsSetMutableStateInCache returns true if MutableStateInCache is not nil.
func (v *DescribeMutableStateResponse) IsSetMutableStateInCache() bool {
	return v != nil && v.MutableStateInCache != nil
}

// GetMutableStateInDatabase returns the value of MutableStateInDatabase if it is set or its
// zero value if it is unset.
func (v *DescribeMutableStateResponse) GetMutableStateInDatabase() (o string) {
	if v != nil && v.MutableStateInDatabase != nil {
		return *v.MutableStateInDatabase
	}

	return
}

// IsSetMutableStateInDatabase returns true if MutableStateInDatabase is not nil.
func (v *DescribeMutableStateResponse) IsSetMutableStateInDatabase() bool {
	return v != nil && v.MutableStateInDatabase != nil
}

type DescribeWorkflowExecutionRequest struct {
	DomainUUID *string                                  `json:"domainUUID,omitempty"`
	Request    *shared.DescribeWorkflowExecutionRequest `json:"request,omitempty"`
}

// ToWire translates a DescribeWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *DescribeWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeWorkflowExecutionRequest_Read(w wire.Value) (*shared.DescribeWorkflowExecutionRequest, error) {
	var v shared.DescribeWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a DescribeWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a DescribeWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v DescribeWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *DescribeWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _DescribeWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a DescribeWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a DescribeWorkflowExecutionRequest struct could not be encoded.
func (v *DescribeWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _DescribeWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.DescribeWorkflowExecutionRequest, error) {
	var v shared.DescribeWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a DescribeWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a DescribeWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *DescribeWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Request, err = _DescribeWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a DescribeWorkflowExecutionRequest
// struct.
func (v *DescribeWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("DescribeWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this DescribeWorkflowExecutionRequest match the
// provided DescribeWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *DescribeWorkflowExecutionRequest) Equals(rhs *DescribeWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DescribeWorkflowExecutionRequest.
func (v *DescribeWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *DescribeWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *DescribeWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *DescribeWorkflowExecutionRequest) GetRequest() (o *shared.DescribeWorkflowExecutionRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *DescribeWorkflowExecutionRequest) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

type DomainFilter struct {
	DomainIDs    []string `json:"domainIDs,omitempty"`
	ReverseMatch *bool    `json:"reverseMatch,omitempty"`
}

type _List_String_ValueList []string

func (v _List_String_ValueList) ForEach(f func(wire.Value) error) error {
	for _, x := range v {
		w, err := wire.NewValueString(x), error(nil)
		if err != nil {
			return err
		}
		err = f(w)
		if err != nil {
			return err
		}
	}
	return nil
}

func (v _List_String_ValueList) Size() int {
	return len(v)
}

func (_List_String_ValueList) ValueType() wire.Type {
	return wire.TBinary
}

func (_List_String_ValueList) Close() {}

// ToWire translates a DomainFilter struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *DomainFilter) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainIDs != nil {
		w, err = wire.NewValueList(_List_String_ValueList(v.DomainIDs)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ReverseMatch != nil {
		w, err = wire.NewValueBool(*(v.ReverseMatch)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _List_String_Read(l wire.ValueList) ([]string, error) {
	if l.ValueType() != wire.TBinary {
		return nil, nil
	}

	o := make([]string, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := x.GetString(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}

// FromWire deserializes a DomainFilter struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a DomainFilter struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v DomainFilter
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *DomainFilter) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TList {
				v.DomainIDs, err = _List_String_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.ReverseMatch = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_String_Encode(val []string, sw stream.Writer) error {

	lh := stream.ListHeader{
		Type:   wire.TBinary,
		Length: len(val),
	}
	if err := sw.WriteListBegin(lh); err != nil {
		return err
	}

	for _, v := range val {
		if err := sw.WriteString(v); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

// Encode serializes a DomainFilter struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a DomainFilter struct could not be encoded.
func (v *DomainFilter) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainIDs != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TList}); err != nil {
			return err
		}
		if err := _List_String_Encode(v.DomainIDs, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ReverseMatch != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.ReverseMatch)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _List_String_Decode(sr stream.Reader) ([]string, error) {
	lh, err := sr.ReadListBegin()
	if err != nil {
		return nil, err
	}

	if lh.Type != wire.TBinary {
		for i := 0; i < lh.Length; i++ {
			if err := sr.Skip(lh.Type); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadListEnd()
	}

	o := make([]string, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := sr.ReadString()
		if err != nil {
			return nil, err
		}
		o = append(o, v)
	}

	if err = sr.ReadListEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a DomainFilter struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a DomainFilter struct could not be generated from the wire
// representation.
func (v *DomainFilter) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TList:
			v.DomainIDs, err = _List_String_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.ReverseMatch = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a DomainFilter
// struct.
func (v *DomainFilter) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainIDs != nil {
		fields[i] = fmt.Sprintf("DomainIDs: %v", v.DomainIDs)
		i++
	}
	if v.ReverseMatch != nil {
		fields[i] = fmt.Sprintf("ReverseMatch: %v", *(v.ReverseMatch))
		i++
	}

	return fmt.Sprintf("DomainFilter{%v}", strings.Join(fields[:i], ", "))
}

func _List_String_Equals(lhs, rhs []string) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for i, lv := range lhs {
		rv := rhs[i]
		if !(lv == rv) {
			return false
		}
	}

	return true
}

func _Bool_EqualsPtr(lhs, rhs *bool) bool {
	if lhs != nil && rhs != nil {

		x := *lhs
		y := *rhs
		return (x == y)
	}
	return lhs == nil && rhs == nil
}

// Equals returns true if all the fields of this DomainFilter match the
// provided DomainFilter.
//
// This function performs a deep comparison.
func (v *DomainFilter) Equals(rhs *DomainFilter) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.DomainIDs == nil && rhs.DomainIDs == nil) || (v.DomainIDs != nil && rhs.DomainIDs != nil && _List_String_Equals(v.DomainIDs, rhs.DomainIDs))) {
		return false
	}
	if !_Bool_EqualsPtr(v.ReverseMatch, rhs.ReverseMatch) {
		return false
	}

	return true
}

type _List_String_Zapper []string

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_String_Zapper.
func (l _List_String_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for _, v := range l {
		enc.AppendString(v)
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DomainFilter.
func (v *DomainFilter) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainIDs != nil {
		err = multierr.Append(err, enc.AddArray("domainIDs", (_List_String_Zapper)(v.DomainIDs)))
	}
	if v.ReverseMatch != nil {
		enc.AddBool("reverseMatch", *v.ReverseMatch)
	}
	return err
}

// GetDomainIDs returns the value of DomainIDs if it is set or its
// zero value if it is unset.
func (v *DomainFilter) GetDomainIDs() (o []string) {
	if v != nil && v.DomainIDs != nil {
		return v.DomainIDs
	}

	return
}

// IsSetDomainIDs returns true if DomainIDs is not nil.
func (v *DomainFilter) IsSetDomainIDs() bool {
	return v != nil && v.DomainIDs != nil
}

// GetReverseMatch returns the value of ReverseMatch if it is set or its
// zero value if it is unset.
func (v *DomainFilter) GetReverseMatch() (o bool) {
	if v != nil && v.ReverseMatch != nil {
		return *v.ReverseMatch
	}

	return
}

// IsSetReverseMatch returns true if ReverseMatch is not nil.
func (v *DomainFilter) IsSetReverseMatch() bool {
	return v != nil && v.ReverseMatch != nil
}

type EventAlreadyStartedError struct {
	Message string `json:"message,required"`
}

// ToWire translates a EventAlreadyStartedError struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *EventAlreadyStartedError) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	w, err = wire.NewValueString(v.Message), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 1, Value: w}
	i++

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a EventAlreadyStartedError struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a EventAlreadyStartedError struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v EventAlreadyStartedError
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *EventAlreadyStartedError) FromWire(w wire.Value) error {
	var err error

	messageIsSet := false

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TBinary {
				v.Message, err = field.Value.GetString(), error(nil)
				if err != nil {
					return err
				}
				messageIsSet = true
			}
		}
	}

	if !messageIsSet {
		return errors.New("field Message of EventAlreadyStartedError is required")
	}

	return nil
}

// Encode serializes a EventAlreadyStartedError struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a EventAlreadyStartedError struct could not be encoded.
func (v *EventAlreadyStartedError) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TBinary}); err != nil {
		return err
	}
	if err := sw.WriteString(v.Message); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a EventAlreadyStartedError struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a EventAlreadyStartedError struct could not be generated from the wire
// representation.
func (v *EventAlreadyStartedError) Decode(sr stream.Reader) error {

	messageIsSet := false

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TBinary:
			v.Message, err = sr.ReadString()
			if err != nil {
				return err
			}
			messageIsSet = true
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	if !messageIsSet {
		return errors.New("field Message of EventAlreadyStartedError is required")
	}

	return nil
}

// String returns a readable string representation of a EventAlreadyStartedError
// struct.
func (v *EventAlreadyStartedError) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	fields[i] = fmt.Sprintf("Message: %v", v.Message)
	i++

	return fmt.Sprintf("EventAlreadyStartedError{%v}", strings.Join(fields[:i], ", "))
}

// ErrorName is the name of this type as defined in the Thrift
// file.
func (*EventAlreadyStartedError) ErrorName() string {
	return "EventAlreadyStartedError"
}

// Equals returns true if all the fields of this EventAlreadyStartedError match the
// provided EventAlreadyStartedError.
//
// This function performs a deep comparison.
func (v *EventAlreadyStartedError) Equals(rhs *EventAlreadyStartedError) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !(v.Message == rhs.Message) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of EventAlreadyStartedError.
func (v *EventAlreadyStartedError) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	enc.AddString("message", v.Message)
	return err
}

// GetMessage returns the value of Message if it is set or its
// zero value if it is unset.
func (v *EventAlreadyStartedError) GetMessage() (o string) {
	if v != nil {
		o = v.Message
	}
	return
}

func (v *EventAlreadyStartedError) Error() string {
	return v.String()
}

type FailoverMarkerToken struct {
	ShardIDs       []int32                              `json:"shardIDs,omitempty"`
	FailoverMarker *replicator.FailoverMarkerAttributes `json:"failoverMarker,omitempty"`
}

type _List_I32_ValueList []int32

func (v _List_I32_ValueList) ForEach(f func(wire.Value) error) error {
	for _, x := range v {
		w, err := wire.NewValueI32(x), error(nil)
		if err != nil {
			return err
		}
		err = f(w)
		if err != nil {
			return err
		}
	}
	return nil
}

func (v _List_I32_ValueList) Size() int {
	return len(v)
}

func (_List_I32_ValueList) ValueType() wire.Type {
	return wire.TI32
}

func (_List_I32_ValueList) Close() {}

// ToWire translates a FailoverMarkerToken struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *FailoverMarkerToken) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ShardIDs != nil {
		w, err = wire.NewValueList(_List_I32_ValueList(v.ShardIDs)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.FailoverMarker != nil {
		w, err = v.FailoverMarker.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _List_I32_Read(l wire.ValueList) ([]int32, error) {
	if l.ValueType() != wire.TI32 {
		return nil, nil
	}

	o := make([]int32, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := x.GetI32(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}

func _FailoverMarkerAttributes_Read(w wire.Value) (*replicator.FailoverMarkerAttributes, error) {
	var v replicator.FailoverMarkerAttributes
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a FailoverMarkerToken struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a FailoverMarkerToken struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v FailoverMarkerToken
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *FailoverMarkerToken) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TList {
				v.ShardIDs, err = _List_I32_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.FailoverMarker, err = _FailoverMarkerAttributes_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_I32_Encode(val []int32, sw stream.Writer) error {

	lh := stream.ListHeader{
		Type:   wire.TI32,
		Length: len(val),
	}
	if err := sw.WriteListBegin(lh); err != nil {
		return err
	}

	for _, v := range val {
		if err := sw.WriteInt32(v); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

// Encode serializes a FailoverMarkerToken struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a FailoverMarkerToken struct could not be encoded.
func (v *FailoverMarkerToken) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ShardIDs != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TList}); err != nil {
			return err
		}
		if err := _List_I32_Encode(v.ShardIDs, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.FailoverMarker != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.FailoverMarker.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _List_I32_Decode(sr stream.Reader) ([]int32, error) {
	lh, err := sr.ReadListBegin()
	if err != nil {
		return nil, err
	}

	if lh.Type != wire.TI32 {
		for i := 0; i < lh.Length; i++ {
			if err := sr.Skip(lh.Type); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadListEnd()
	}

	o := make([]int32, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := sr.ReadInt32()
		if err != nil {
			return nil, err
		}
		o = append(o, v)
	}

	if err = sr.ReadListEnd(); err != nil {
		return nil, err
	}
	return o, err
}

func _FailoverMarkerAttributes_Decode(sr stream.Reader) (*replicator.FailoverMarkerAttributes, error) {
	var v replicator.FailoverMarkerAttributes
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a FailoverMarkerToken struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a FailoverMarkerToken struct could not be generated from the wire
// representation.
func (v *FailoverMarkerToken) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TList:
			v.ShardIDs, err = _List_I32_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.FailoverMarker, err = _FailoverMarkerAttributes_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a FailoverMarkerToken
// struct.
func (v *FailoverMarkerToken) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.ShardIDs != nil {
		fields[i] = fmt.Sprintf("ShardIDs: %v", v.ShardIDs)
		i++
	}
	if v.FailoverMarker != nil {
		fields[i] = fmt.Sprintf("FailoverMarker: %v", v.FailoverMarker)
		i++
	}

	return fmt.Sprintf("FailoverMarkerToken{%v}", strings.Join(fields[:i], ", "))
}

func _List_I32_Equals(lhs, rhs []int32) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for i, lv := range lhs {
		rv := rhs[i]
		if !(lv == rv) {
			return false
		}
	}

	return true
}

// Equals returns true if all the fields of this FailoverMarkerToken match the
// provided FailoverMarkerToken.
//
// This function performs a deep comparison.
func (v *FailoverMarkerToken) Equals(rhs *FailoverMarkerToken) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ShardIDs == nil && rhs.ShardIDs == nil) || (v.ShardIDs != nil && rhs.ShardIDs != nil && _List_I32_Equals(v.ShardIDs, rhs.ShardIDs))) {
		return false
	}
	if !((v.FailoverMarker == nil && rhs.FailoverMarker == nil) || (v.FailoverMarker != nil && rhs.FailoverMarker != nil && v.FailoverMarker.Equals(rhs.FailoverMarker))) {
		return false
	}

	return true
}

type _List_I32_Zapper []int32

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_I32_Zapper.
func (l _List_I32_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for _, v := range l {
		enc.AppendInt32(v)
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of FailoverMarkerToken.
func (v *FailoverMarkerToken) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ShardIDs != nil {
		err = multierr.Append(err, enc.AddArray("shardIDs", (_List_I32_Zapper)(v.ShardIDs)))
	}
	if v.FailoverMarker != nil {
		err = multierr.Append(err, enc.AddObject("failoverMarker", v.FailoverMarker))
	}
	return err
}

// GetShardIDs returns the value of ShardIDs if it is set or its
// zero value if it is unset.
func (v *FailoverMarkerToken) GetShardIDs() (o []int32) {
	if v != nil && v.ShardIDs != nil {
		return v.ShardIDs
	}

	return
}

// IsSetShardIDs returns true if ShardIDs is not nil.
func (v *FailoverMarkerToken) IsSetShardIDs() bool {
	return v != nil && v.ShardIDs != nil
}

// GetFailoverMarker returns the value of FailoverMarker if it is set or its
// zero value if it is unset.
func (v *FailoverMarkerToken) GetFailoverMarker() (o *replicator.FailoverMarkerAttributes) {
	if v != nil && v.FailoverMarker != nil {
		return v.FailoverMarker
	}

	return
}

// IsSetFailoverMarker returns true if FailoverMarker is not nil.
func (v *FailoverMarkerToken) IsSetFailoverMarker() bool {
	return v != nil && v.FailoverMarker != nil
}

type GetFailoverInfoRequest struct {
	DomainID *string `json:"domainID,omitempty"`
}

// ToWire translates a GetFailoverInfoRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *GetFailoverInfoRequest) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainID != nil {
		w, err = wire.NewValueString(*(v.DomainID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a GetFailoverInfoRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a GetFailoverInfoRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetFailoverInfoRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetFailoverInfoRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainID = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a GetFailoverInfoRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a GetFailoverInfoRequest struct could not be encoded.
func (v *GetFailoverInfoRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a GetFailoverInfoRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetFailoverInfoRequest struct could not be generated from the wire
// representation.
func (v *GetFailoverInfoRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainID = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a GetFailoverInfoRequest
// struct.
func (v *GetFailoverInfoRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.DomainID != nil {
		fields[i] = fmt.Sprintf("DomainID: %v", *(v.DomainID))
		i++
	}

	return fmt.Sprintf("GetFailoverInfoRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this GetFailoverInfoRequest match the
// provided GetFailoverInfoRequest.
//
// This function performs a deep comparison.
func (v *GetFailoverInfoRequest) Equals(rhs *GetFailoverInfoRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainID, rhs.DomainID) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of GetFailoverInfoRequest.
func (v *GetFailoverInfoRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainID != nil {
		enc.AddString("domainID", *v.DomainID)
	}
	return err
}

// GetDomainID returns the value of DomainID if it is set or its
// zero value if it is unset.
func (v *GetFailoverInfoRequest) GetDomainID() (o string) {
	if v != nil && v.DomainID != nil {
		return *v.DomainID
	}

	return
}

// IsSetDomainID returns true if DomainID is not nil.
func (v *GetFailoverInfoRequest) IsSetDomainID() bool {
	return v != nil && v.DomainID != nil
}

type GetFailoverInfoResponse struct {
	CompletedShardCount *int32  `json:"completedShardCount,omitempty"`
	PendingShards       []int32 `json:"pendingShards,omitempty"`
}

// ToWire translates a GetFailoverInfoResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *GetFailoverInfoResponse) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.CompletedShardCount != nil {
		w, err = wire.NewValueI32(*(v.CompletedShardCount)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.PendingShards != nil {
		w, err = wire.NewValueList(_List_I32_ValueList(v.PendingShards)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a GetFailoverInfoResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a GetFailoverInfoResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetFailoverInfoResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetFailoverInfoResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.CompletedShardCount = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TList {
				v.PendingShards, err = _List_I32_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a GetFailoverInfoResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a GetFailoverInfoResponse struct could not be encoded.
func (v *GetFailoverInfoResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.CompletedShardCount != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.CompletedShardCount)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PendingShards != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TList}); err != nil {
			return err
		}
		if err := _List_I32_Encode(v.PendingShards, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a GetFailoverInfoResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetFailoverInfoResponse struct could not be generated from the wire
// representation.
func (v *GetFailoverInfoResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.CompletedShardCount = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TList:
			v.PendingShards, err = _List_I32_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a GetFailoverInfoResponse
// struct.
func (v *GetFailoverInfoResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.CompletedShardCount != nil {
		fields[i] = fmt.Sprintf("CompletedShardCount: %v", *(v.CompletedShardCount))
		i++
	}
	if v.PendingShards != nil {
		fields[i] = fmt.Sprintf("PendingShards: %v", v.PendingShards)
		i++
	}

	return fmt.Sprintf("GetFailoverInfoResponse{%v}", strings.Join(fields[:i], ", "))
}

func _I32_EqualsPtr(lhs, rhs *int32) bool {
	if lhs != nil && rhs != nil {

		x := *lhs
		y := *rhs
		return (x == y)
	}
	return lhs == nil && rhs == nil
}

// Equals returns true if all the fields of this GetFailoverInfoResponse match the
// provided GetFailoverInfoResponse.
//
// This function performs a deep comparison.
func (v *GetFailoverInfoResponse) Equals(rhs *GetFailoverInfoResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_I32_EqualsPtr(v.CompletedShardCount, rhs.CompletedShardCount) {
		return false
	}
	if !((v.PendingShards == nil && rhs.PendingShards == nil) || (v.PendingShards != nil && rhs.PendingShards != nil && _List_I32_Equals(v.PendingShards, rhs.PendingShards))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of GetFailoverInfoResponse.
func (v *GetFailoverInfoResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.CompletedShardCount != nil {
		enc.AddInt32("completedShardCount", *v.CompletedShardCount)
	}
	if v.PendingShards != nil {
		err = multierr.Append(err, enc.AddArray("pendingShards", (_List_I32_Zapper)(v.PendingShards)))
	}
	return err
}

// GetCompletedShardCount returns the value of CompletedShardCount if it is set or its
// zero value if it is unset.
func (v *GetFailoverInfoResponse) GetCompletedShardCount() (o int32) {
	if v != nil && v.CompletedShardCount != nil {
		return *v.CompletedShardCount
	}

	return
}

// IsSetCompletedShardCount returns true if CompletedShardCount is not nil.
func (v *GetFailoverInfoResponse) IsSetCompletedShardCount() bool {
	return v != nil && v.CompletedShardCount != nil
}

// GetPendingShards returns the value of PendingShards if it is set or its
// zero value if it is unset.
func (v *GetFailoverInfoResponse) GetPendingShards() (o []int32) {
	if v != nil && v.PendingShards != nil {
		return v.PendingShards
	}

	return
}

// IsSetPendingShards returns true if PendingShards is not nil.
func (v *GetFailoverInfoResponse) IsSetPendingShards() bool {
	return v != nil && v.PendingShards != nil
}

type GetMutableStateRequest struct {
	DomainUUID          *string                    `json:"domainUUID,omitempty"`
	Execution           *shared.WorkflowExecution  `json:"execution,omitempty"`
	ExpectedNextEventId *int64                     `json:"expectedNextEventId,omitempty"`
	CurrentBranchToken  []byte                     `json:"currentBranchToken,omitempty"`
	VersionHistoryItem  *shared.VersionHistoryItem `json:"versionHistoryItem,omitempty"`
}

// ToWire translates a GetMutableStateRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *GetMutableStateRequest) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ExpectedNextEventId != nil {
		w, err = wire.NewValueI64(*(v.ExpectedNextEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.CurrentBranchToken != nil {
		w, err = wire.NewValueBinary(v.CurrentBranchToken), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.VersionHistoryItem != nil {
		w, err = v.VersionHistoryItem.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _VersionHistoryItem_Read(w wire.Value) (*shared.VersionHistoryItem, error) {
	var v shared.VersionHistoryItem
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a GetMutableStateRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a GetMutableStateRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetMutableStateRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetMutableStateRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ExpectedNextEventId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TBinary {
				v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TStruct {
				v.VersionHistoryItem, err = _VersionHistoryItem_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a GetMutableStateRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a GetMutableStateRequest struct could not be encoded.
func (v *GetMutableStateRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExpectedNextEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ExpectedNextEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CurrentBranchToken != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.CurrentBranchToken); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.VersionHistoryItem != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.VersionHistoryItem.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _VersionHistoryItem_Decode(sr stream.Reader) (*shared.VersionHistoryItem, error) {
	var v shared.VersionHistoryItem
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a GetMutableStateRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetMutableStateRequest struct could not be generated from the wire
// representation.
func (v *GetMutableStateRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ExpectedNextEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TBinary:
			v.CurrentBranchToken, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TStruct:
			v.VersionHistoryItem, err = _VersionHistoryItem_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a GetMutableStateRequest
// struct.
func (v *GetMutableStateRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}
	if v.ExpectedNextEventId != nil {
		fields[i] = fmt.Sprintf("ExpectedNextEventId: %v", *(v.ExpectedNextEventId))
		i++
	}
	if v.CurrentBranchToken != nil {
		fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken)
		i++
	}
	if v.VersionHistoryItem != nil {
		fields[i] = fmt.Sprintf("VersionHistoryItem: %v", v.VersionHistoryItem)
		i++
	}

	return fmt.Sprintf("GetMutableStateRequest{%v}", strings.Join(fields[:i], ", "))
}

func _I64_EqualsPtr(lhs, rhs *int64) bool {
	if lhs != nil && rhs != nil {

		x := *lhs
		y := *rhs
		return (x == y)
	}
	return lhs == nil && rhs == nil
}

// Equals returns true if all the fields of this GetMutableStateRequest match the
// provided GetMutableStateRequest.
//
// This function performs a deep comparison.
func (v *GetMutableStateRequest) Equals(rhs *GetMutableStateRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}
	if !_I64_EqualsPtr(v.ExpectedNextEventId, rhs.ExpectedNextEventId) {
		return false
	}
	if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) {
		return false
	}
	if !((v.VersionHistoryItem == nil && rhs.VersionHistoryItem == nil) || (v.VersionHistoryItem != nil && rhs.VersionHistoryItem != nil && v.VersionHistoryItem.Equals(rhs.VersionHistoryItem))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of GetMutableStateRequest.
func (v *GetMutableStateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	if v.ExpectedNextEventId != nil {
		enc.AddInt64("expectedNextEventId", *v.ExpectedNextEventId)
	}
	if v.CurrentBranchToken != nil {
		enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken))
	}
	if v.VersionHistoryItem != nil {
		err = multierr.Append(err, enc.AddObject("versionHistoryItem", v.VersionHistoryItem))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *GetMutableStateRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *GetMutableStateRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *GetMutableStateRequest) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *GetMutableStateRequest) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

// GetExpectedNextEventId returns the value of ExpectedNextEventId if it is set or its
// zero value if it is unset.
func (v *GetMutableStateRequest) GetExpectedNextEventId() (o int64) {
	if v != nil && v.ExpectedNextEventId != nil {
		return *v.ExpectedNextEventId
	}

	return
}

// IsSetExpectedNextEventId returns true if ExpectedNextEventId is not nil.
func (v *GetMutableStateRequest) IsSetExpectedNextEventId() bool {
	return v != nil && v.ExpectedNextEventId != nil
}

// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its
// zero value if it is unset.
func (v *GetMutableStateRequest) GetCurrentBranchToken() (o []byte) {
	if v != nil && v.CurrentBranchToken != nil {
		return v.CurrentBranchToken
	}

	return
}

// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil.
func (v *GetMutableStateRequest) IsSetCurrentBranchToken() bool {
	return v != nil && v.CurrentBranchToken != nil
}

// GetVersionHistoryItem returns the value of VersionHistoryItem if it is set or its
// zero value if it is unset.
func (v *GetMutableStateRequest) GetVersionHistoryItem() (o *shared.VersionHistoryItem) {
	if v != nil && v.VersionHistoryItem != nil {
		return v.VersionHistoryItem
	}

	return
}

// IsSetVersionHistoryItem returns true if VersionHistoryItem is not nil.
func (v *GetMutableStateRequest) IsSetVersionHistoryItem() bool {
	return v != nil && v.VersionHistoryItem != nil
}

type GetMutableStateResponse struct {
	Execution                            *shared.WorkflowExecution `json:"execution,omitempty"`
	WorkflowType                         *shared.WorkflowType      `json:"workflowType,omitempty"`
	NextEventId                          *int64                    `json:"NextEventId,omitempty"`
	PreviousStartedEventId               *int64                    `json:"PreviousStartedEventId,omitempty"`
	LastFirstEventId                     *int64                    `json:"LastFirstEventId,omitempty"`
	TaskList                             *shared.TaskList          `json:"taskList,omitempty"`
	StickyTaskList                       *shared.TaskList          `json:"stickyTaskList,omitempty"`
	ClientLibraryVersion                 *string                   `json:"clientLibraryVersion,omitempty"`
	ClientFeatureVersion                 *string                   `json:"clientFeatureVersion,omitempty"`
	ClientImpl                           *string                   `json:"clientImpl,omitempty"`
	IsWorkflowRunning                    *bool                     `json:"isWorkflowRunning,omitempty"`
	StickyTaskListScheduleToStartTimeout *int32                    `json:"stickyTaskListScheduleToStartTimeout,omitempty"`
	EventStoreVersion                    *int32                    `json:"eventStoreVersion,omitempty"`
	CurrentBranchToken                   []byte                    `json:"currentBranchToken,omitempty"`
	WorkflowState                        *int32                    `json:"workflowState,omitempty"`
	WorkflowCloseState                   *int32                    `json:"workflowCloseState,omitempty"`
	VersionHistories                     *shared.VersionHistories  `json:"versionHistories,omitempty"`
	IsStickyTaskListEnabled              *bool                     `json:"isStickyTaskListEnabled,omitempty"`
	HistorySize                          *int64                    `json:"historySize,omitempty"`
}

// ToWire translates a GetMutableStateResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *GetMutableStateResponse) ToWire() (wire.Value, error) {
	var (
		fields [19]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowType != nil {
		w, err = v.WorkflowType.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.NextEventId != nil {
		w, err = wire.NewValueI64(*(v.NextEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.PreviousStartedEventId != nil {
		w, err = wire.NewValueI64(*(v.PreviousStartedEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 35, Value: w}
		i++
	}
	if v.LastFirstEventId != nil {
		w, err = wire.NewValueI64(*(v.LastFirstEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.TaskList != nil {
		w, err = v.TaskList.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.StickyTaskList != nil {
		w, err = v.StickyTaskList.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.ClientLibraryVersion != nil {
		w, err = wire.NewValueString(*(v.ClientLibraryVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}
	if v.ClientFeatureVersion != nil {
		w, err = wire.NewValueString(*(v.ClientFeatureVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 80, Value: w}
		i++
	}
	if v.ClientImpl != nil {
		w, err = wire.NewValueString(*(v.ClientImpl)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 90, Value: w}
		i++
	}
	if v.IsWorkflowRunning != nil {
		w, err = wire.NewValueBool(*(v.IsWorkflowRunning)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 100, Value: w}
		i++
	}
	if v.StickyTaskListScheduleToStartTimeout != nil {
		w, err = wire.NewValueI32(*(v.StickyTaskListScheduleToStartTimeout)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 110, Value: w}
		i++
	}
	if v.EventStoreVersion != nil {
		w, err = wire.NewValueI32(*(v.EventStoreVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 120, Value: w}
		i++
	}
	if v.CurrentBranchToken != nil {
		w, err = wire.NewValueBinary(v.CurrentBranchToken), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 130, Value: w}
		i++
	}
	if v.WorkflowState != nil {
		w, err = wire.NewValueI32(*(v.WorkflowState)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 150, Value: w}
		i++
	}
	if v.WorkflowCloseState != nil {
		w, err = wire.NewValueI32(*(v.WorkflowCloseState)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 160, Value: w}
		i++
	}
	if v.VersionHistories != nil {
		w, err = v.VersionHistories.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 170, Value: w}
		i++
	}
	if v.IsStickyTaskListEnabled != nil {
		w, err = wire.NewValueBool(*(v.IsStickyTaskListEnabled)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 180, Value: w}
		i++
	}
	if v.HistorySize != nil {
		w, err = wire.NewValueI64(*(v.HistorySize)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 190, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _WorkflowType_Read(w wire.Value) (*shared.WorkflowType, error) {
	var v shared.WorkflowType
	err := v.FromWire(w)
	return &v, err
}

func _TaskList_Read(w wire.Value) (*shared.TaskList, error) {
	var v shared.TaskList
	err := v.FromWire(w)
	return &v, err
}

func _VersionHistories_Read(w wire.Value) (*shared.VersionHistories, error) {
	var v shared.VersionHistories
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a GetMutableStateResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a GetMutableStateResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetMutableStateResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetMutableStateResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowType, err = _WorkflowType_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.NextEventId = &x
				if err != nil {
					return err
				}

			}
		case 35:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.PreviousStartedEventId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.LastFirstEventId = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TStruct {
				v.TaskList, err = _TaskList_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TStruct {
				v.StickyTaskList, err = _TaskList_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 70:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ClientLibraryVersion = &x
				if err != nil {
					return err
				}

			}
		case 80:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ClientFeatureVersion = &x
				if err != nil {
					return err
				}

			}
		case 90:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ClientImpl = &x
				if err != nil {
					return err
				}

			}
		case 100:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.IsWorkflowRunning = &x
				if err != nil {
					return err
				}

			}
		case 110:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.StickyTaskListScheduleToStartTimeout = &x
				if err != nil {
					return err
				}

			}
		case 120:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.EventStoreVersion = &x
				if err != nil {
					return err
				}

			}
		case 130:
			if field.Value.Type() == wire.TBinary {
				v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 150:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.WorkflowState = &x
				if err != nil {
					return err
				}

			}
		case 160:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.WorkflowCloseState = &x
				if err != nil {
					return err
				}

			}
		case 170:
			if field.Value.Type() == wire.TStruct {
				v.VersionHistories, err = _VersionHistories_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 180:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.IsStickyTaskListEnabled = &x
				if err != nil {
					return err
				}

			}
		case 190:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.HistorySize = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a GetMutableStateResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a GetMutableStateResponse struct could not be encoded.
func (v *GetMutableStateResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowType != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowType.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.NextEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.NextEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PreviousStartedEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 35, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.PreviousStartedEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastFirstEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.LastFirstEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.TaskList != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.TaskList.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StickyTaskList != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.StickyTaskList.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientLibraryVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 70, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ClientLibraryVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientFeatureVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 80, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ClientFeatureVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientImpl != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 90, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ClientImpl)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.IsWorkflowRunning != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 100, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.IsWorkflowRunning)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StickyTaskListScheduleToStartTimeout != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 110, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.StickyTaskListScheduleToStartTimeout)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EventStoreVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 120, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.EventStoreVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CurrentBranchToken != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 130, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.CurrentBranchToken); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowState != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 150, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.WorkflowState)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowCloseState != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 160, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.WorkflowCloseState)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.VersionHistories != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 170, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.VersionHistories.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.IsStickyTaskListEnabled != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 180, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.IsStickyTaskListEnabled)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.HistorySize != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 190, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.HistorySize)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _WorkflowType_Decode(sr stream.Reader) (*shared.WorkflowType, error) {
	var v shared.WorkflowType
	err := v.Decode(sr)
	return &v, err
}

func _TaskList_Decode(sr stream.Reader) (*shared.TaskList, error) {
	var v shared.TaskList
	err := v.Decode(sr)
	return &v, err
}

func _VersionHistories_Decode(sr stream.Reader) (*shared.VersionHistories, error) {
	var v shared.VersionHistories
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a GetMutableStateResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetMutableStateResponse struct could not be generated from the wire
// representation.
func (v *GetMutableStateResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowType, err = _WorkflowType_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.NextEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 35 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.PreviousStartedEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.LastFirstEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TStruct:
			v.TaskList, err = _TaskList_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TStruct:
			v.StickyTaskList, err = _TaskList_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 70 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClientLibraryVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 80 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClientFeatureVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 90 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClientImpl = &x
			if err != nil {
				return err
			}

		case fh.ID == 100 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.IsWorkflowRunning = &x
			if err != nil {
				return err
			}

		case fh.ID == 110 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.StickyTaskListScheduleToStartTimeout = &x
			if err != nil {
				return err
			}

		case fh.ID == 120 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.EventStoreVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 130 && fh.Type == wire.TBinary:
			v.CurrentBranchToken, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 150 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.WorkflowState = &x
			if err != nil {
				return err
			}

		case fh.ID == 160 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.WorkflowCloseState = &x
			if err != nil {
				return err
			}

		case fh.ID == 170 && fh.Type == wire.TStruct:
			v.VersionHistories, err = _VersionHistories_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 180 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.IsStickyTaskListEnabled = &x
			if err != nil {
				return err
			}

		case fh.ID == 190 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.HistorySize = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a GetMutableStateResponse
// struct.
func (v *GetMutableStateResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [19]string
	i := 0
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}
	if v.WorkflowType != nil {
		fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType)
		i++
	}
	if v.NextEventId != nil {
		fields[i] = fmt.Sprintf("NextEventId: %v", *(v.NextEventId))
		i++
	}
	if v.PreviousStartedEventId != nil {
		fields[i] = fmt.Sprintf("PreviousStartedEventId: %v", *(v.PreviousStartedEventId))
		i++
	}
	if v.LastFirstEventId != nil {
		fields[i] = fmt.Sprintf("LastFirstEventId: %v", *(v.LastFirstEventId))
		i++
	}
	if v.TaskList != nil {
		fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList)
		i++
	}
	if v.StickyTaskList != nil {
		fields[i] = fmt.Sprintf("StickyTaskList: %v", v.StickyTaskList)
		i++
	}
	if v.ClientLibraryVersion != nil {
		fields[i] = fmt.Sprintf("ClientLibraryVersion: %v", *(v.ClientLibraryVersion))
		i++
	}
	if v.ClientFeatureVersion != nil {
		fields[i] = fmt.Sprintf("ClientFeatureVersion: %v", *(v.ClientFeatureVersion))
		i++
	}
	if v.ClientImpl != nil {
		fields[i] = fmt.Sprintf("ClientImpl: %v", *(v.ClientImpl))
		i++
	}
	if v.IsWorkflowRunning != nil {
		fields[i] = fmt.Sprintf("IsWorkflowRunning: %v", *(v.IsWorkflowRunning))
		i++
	}
	if v.StickyTaskListScheduleToStartTimeout != nil {
		fields[i] = fmt.Sprintf("StickyTaskListScheduleToStartTimeout: %v", *(v.StickyTaskListScheduleToStartTimeout))
		i++
	}
	if v.EventStoreVersion != nil {
		fields[i] = fmt.Sprintf("EventStoreVersion: %v", *(v.EventStoreVersion))
		i++
	}
	if v.CurrentBranchToken != nil {
		fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken)
		i++
	}
	if v.WorkflowState != nil {
		fields[i] = fmt.Sprintf("WorkflowState: %v", *(v.WorkflowState))
		i++
	}
	if v.WorkflowCloseState != nil {
		fields[i] = fmt.Sprintf("WorkflowCloseState: %v", *(v.WorkflowCloseState))
		i++
	}
	if v.VersionHistories != nil {
		fields[i] = fmt.Sprintf("VersionHistories: %v", v.VersionHistories)
		i++
	}
	if v.IsStickyTaskListEnabled != nil {
		fields[i] = fmt.Sprintf("IsStickyTaskListEnabled: %v", *(v.IsStickyTaskListEnabled))
		i++
	}
	if v.HistorySize != nil {
		fields[i] = fmt.Sprintf("HistorySize: %v", *(v.HistorySize))
		i++
	}

	return fmt.Sprintf("GetMutableStateResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this GetMutableStateResponse match the
// provided GetMutableStateResponse.
//
// This function performs a deep comparison.
func (v *GetMutableStateResponse) Equals(rhs *GetMutableStateResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}
	if !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) {
		return false
	}
	if !_I64_EqualsPtr(v.NextEventId, rhs.NextEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.PreviousStartedEventId, rhs.PreviousStartedEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.LastFirstEventId, rhs.LastFirstEventId) {
		return false
	}
	if !((v.TaskList == nil && rhs.TaskList == nil) || (v.TaskList != nil && rhs.TaskList != nil && v.TaskList.Equals(rhs.TaskList))) {
		return false
	}
	if !((v.StickyTaskList == nil && rhs.StickyTaskList == nil) || (v.StickyTaskList != nil && rhs.StickyTaskList != nil && v.StickyTaskList.Equals(rhs.StickyTaskList))) {
		return false
	}
	if !_String_EqualsPtr(v.ClientLibraryVersion, rhs.ClientLibraryVersion) {
		return false
	}
	if !_String_EqualsPtr(v.ClientFeatureVersion, rhs.ClientFeatureVersion) {
		return false
	}
	if !_String_EqualsPtr(v.ClientImpl, rhs.ClientImpl) {
		return false
	}
	if !_Bool_EqualsPtr(v.IsWorkflowRunning, rhs.IsWorkflowRunning) {
		return false
	}
	if !_I32_EqualsPtr(v.StickyTaskListScheduleToStartTimeout, rhs.StickyTaskListScheduleToStartTimeout) {
		return false
	}
	if !_I32_EqualsPtr(v.EventStoreVersion, rhs.EventStoreVersion) {
		return false
	}
	if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) {
		return false
	}
	if !_I32_EqualsPtr(v.WorkflowState, rhs.WorkflowState) {
		return false
	}
	if !_I32_EqualsPtr(v.WorkflowCloseState, rhs.WorkflowCloseState) {
		return false
	}
	if !((v.VersionHistories == nil && rhs.VersionHistories == nil) || (v.VersionHistories != nil && rhs.VersionHistories != nil && v.VersionHistories.Equals(rhs.VersionHistories))) {
		return false
	}
	if !_Bool_EqualsPtr(v.IsStickyTaskListEnabled, rhs.IsStickyTaskListEnabled) {
		return false
	}
	if !_I64_EqualsPtr(v.HistorySize, rhs.HistorySize) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of GetMutableStateResponse.
func (v *GetMutableStateResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	if v.WorkflowType != nil {
		err = multierr.Append(err, enc.AddObject("workflowType", v.WorkflowType))
	}
	if v.NextEventId != nil {
		enc.AddInt64("NextEventId", *v.NextEventId)
	}
	if v.PreviousStartedEventId != nil {
		enc.AddInt64("PreviousStartedEventId", *v.PreviousStartedEventId)
	}
	if v.LastFirstEventId != nil {
		enc.AddInt64("LastFirstEventId", *v.LastFirstEventId)
	}
	if v.TaskList != nil {
		err = multierr.Append(err, enc.AddObject("taskList", v.TaskList))
	}
	if v.StickyTaskList != nil {
		err = multierr.Append(err, enc.AddObject("stickyTaskList", v.StickyTaskList))
	}
	if v.ClientLibraryVersion != nil {
		enc.AddString("clientLibraryVersion", *v.ClientLibraryVersion)
	}
	if v.ClientFeatureVersion != nil {
		enc.AddString("clientFeatureVersion", *v.ClientFeatureVersion)
	}
	if v.ClientImpl != nil {
		enc.AddString("clientImpl", *v.ClientImpl)
	}
	if v.IsWorkflowRunning != nil {
		enc.AddBool("isWorkflowRunning", *v.IsWorkflowRunning)
	}
	if v.StickyTaskListScheduleToStartTimeout != nil {
		enc.AddInt32("stickyTaskListScheduleToStartTimeout", *v.StickyTaskListScheduleToStartTimeout)
	}
	if v.EventStoreVersion != nil {
		enc.AddInt32("eventStoreVersion", *v.EventStoreVersion)
	}
	if v.CurrentBranchToken != nil {
		enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken))
	}
	if v.WorkflowState != nil {
		enc.AddInt32("workflowState", *v.WorkflowState)
	}
	if v.WorkflowCloseState != nil {
		enc.AddInt32("workflowCloseState", *v.WorkflowCloseState)
	}
	if v.VersionHistories != nil {
		err = multierr.Append(err, enc.AddObject("versionHistories", v.VersionHistories))
	}
	if v.IsStickyTaskListEnabled != nil {
		enc.AddBool("isStickyTaskListEnabled", *v.IsStickyTaskListEnabled)
	}
	if v.HistorySize != nil {
		enc.AddInt64("historySize", *v.HistorySize)
	}
	return err
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *GetMutableStateResponse) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

// GetWorkflowType returns the value of WorkflowType if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetWorkflowType() (o *shared.WorkflowType) {
	if v != nil && v.WorkflowType != nil {
		return v.WorkflowType
	}

	return
}

// IsSetWorkflowType returns true if WorkflowType is not nil.
func (v *GetMutableStateResponse) IsSetWorkflowType() bool {
	return v != nil && v.WorkflowType != nil
}

// GetNextEventId returns the value of NextEventId if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetNextEventId() (o int64) {
	if v != nil && v.NextEventId != nil {
		return *v.NextEventId
	}

	return
}

// IsSetNextEventId returns true if NextEventId is not nil.
func (v *GetMutableStateResponse) IsSetNextEventId() bool {
	return v != nil && v.NextEventId != nil
}

// GetPreviousStartedEventId returns the value of PreviousStartedEventId if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetPreviousStartedEventId() (o int64) {
	if v != nil && v.PreviousStartedEventId != nil {
		return *v.PreviousStartedEventId
	}

	return
}

// IsSetPreviousStartedEventId returns true if PreviousStartedEventId is not nil.
func (v *GetMutableStateResponse) IsSetPreviousStartedEventId() bool {
	return v != nil && v.PreviousStartedEventId != nil
}

// GetLastFirstEventId returns the value of LastFirstEventId if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetLastFirstEventId() (o int64) {
	if v != nil && v.LastFirstEventId != nil {
		return *v.LastFirstEventId
	}

	return
}

// IsSetLastFirstEventId returns true if LastFirstEventId is not nil.
func (v *GetMutableStateResponse) IsSetLastFirstEventId() bool {
	return v != nil && v.LastFirstEventId != nil
}

// GetTaskList returns the value of TaskList if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetTaskList() (o *shared.TaskList) {
	if v != nil && v.TaskList != nil {
		return v.TaskList
	}

	return
}

// IsSetTaskList returns true if TaskList is not nil.
func (v *GetMutableStateResponse) IsSetTaskList() bool {
	return v != nil && v.TaskList != nil
}

// GetStickyTaskList returns the value of StickyTaskList if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetStickyTaskList() (o *shared.TaskList) {
	if v != nil && v.StickyTaskList != nil {
		return v.StickyTaskList
	}

	return
}

// IsSetStickyTaskList returns true if StickyTaskList is not nil.
func (v *GetMutableStateResponse) IsSetStickyTaskList() bool {
	return v != nil && v.StickyTaskList != nil
}

// GetClientLibraryVersion returns the value of ClientLibraryVersion if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetClientLibraryVersion() (o string) {
	if v != nil && v.ClientLibraryVersion != nil {
		return *v.ClientLibraryVersion
	}

	return
}

// IsSetClientLibraryVersion returns true if ClientLibraryVersion is not nil.
func (v *GetMutableStateResponse) IsSetClientLibraryVersion() bool {
	return v != nil && v.ClientLibraryVersion != nil
}

// GetClientFeatureVersion returns the value of ClientFeatureVersion if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetClientFeatureVersion() (o string) {
	if v != nil && v.ClientFeatureVersion != nil {
		return *v.ClientFeatureVersion
	}

	return
}

// IsSetClientFeatureVersion returns true if ClientFeatureVersion is not nil.
func (v *GetMutableStateResponse) IsSetClientFeatureVersion() bool {
	return v != nil && v.ClientFeatureVersion != nil
}

// GetClientImpl returns the value of ClientImpl if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetClientImpl() (o string) {
	if v != nil && v.ClientImpl != nil {
		return *v.ClientImpl
	}

	return
}

// IsSetClientImpl returns true if ClientImpl is not nil.
func (v *GetMutableStateResponse) IsSetClientImpl() bool {
	return v != nil && v.ClientImpl != nil
}

// GetIsWorkflowRunning returns the value of IsWorkflowRunning if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetIsWorkflowRunning() (o bool) {
	if v != nil && v.IsWorkflowRunning != nil {
		return *v.IsWorkflowRunning
	}

	return
}

// IsSetIsWorkflowRunning returns true if IsWorkflowRunning is not nil.
func (v *GetMutableStateResponse) IsSetIsWorkflowRunning() bool {
	return v != nil && v.IsWorkflowRunning != nil
}

// GetStickyTaskListScheduleToStartTimeout returns the value of StickyTaskListScheduleToStartTimeout if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetStickyTaskListScheduleToStartTimeout() (o int32) {
	if v != nil && v.StickyTaskListScheduleToStartTimeout != nil {
		return *v.StickyTaskListScheduleToStartTimeout
	}

	return
}

// IsSetStickyTaskListScheduleToStartTimeout returns true if StickyTaskListScheduleToStartTimeout is not nil.
func (v *GetMutableStateResponse) IsSetStickyTaskListScheduleToStartTimeout() bool {
	return v != nil && v.StickyTaskListScheduleToStartTimeout != nil
}

// GetEventStoreVersion returns the value of EventStoreVersion if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetEventStoreVersion() (o int32) {
	if v != nil && v.EventStoreVersion != nil {
		return *v.EventStoreVersion
	}

	return
}

// IsSetEventStoreVersion returns true if EventStoreVersion is not nil.
func (v *GetMutableStateResponse) IsSetEventStoreVersion() bool {
	return v != nil && v.EventStoreVersion != nil
}

// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetCurrentBranchToken() (o []byte) {
	if v != nil && v.CurrentBranchToken != nil {
		return v.CurrentBranchToken
	}

	return
}

// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil.
func (v *GetMutableStateResponse) IsSetCurrentBranchToken() bool {
	return v != nil && v.CurrentBranchToken != nil
}

// GetWorkflowState returns the value of WorkflowState if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetWorkflowState() (o int32) {
	if v != nil && v.WorkflowState != nil {
		return *v.WorkflowState
	}

	return
}

// IsSetWorkflowState returns true if WorkflowState is not nil.
func (v *GetMutableStateResponse) IsSetWorkflowState() bool {
	return v != nil && v.WorkflowState != nil
}

// GetWorkflowCloseState returns the value of WorkflowCloseState if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetWorkflowCloseState() (o int32) {
	if v != nil && v.WorkflowCloseState != nil {
		return *v.WorkflowCloseState
	}

	return
}

// IsSetWorkflowCloseState returns true if WorkflowCloseState is not nil.
func (v *GetMutableStateResponse) IsSetWorkflowCloseState() bool {
	return v != nil && v.WorkflowCloseState != nil
}

// GetVersionHistories returns the value of VersionHistories if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetVersionHistories() (o *shared.VersionHistories) {
	if v != nil && v.VersionHistories != nil {
		return v.VersionHistories
	}

	return
}

// IsSetVersionHistories returns true if VersionHistories is not nil.
func (v *GetMutableStateResponse) IsSetVersionHistories() bool {
	return v != nil && v.VersionHistories != nil
}

// GetIsStickyTaskListEnabled returns the value of IsStickyTaskListEnabled if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetIsStickyTaskListEnabled() (o bool) {
	if v != nil && v.IsStickyTaskListEnabled != nil {
		return *v.IsStickyTaskListEnabled
	}

	return
}

// IsSetIsStickyTaskListEnabled returns true if IsStickyTaskListEnabled is not nil.
func (v *GetMutableStateResponse) IsSetIsStickyTaskListEnabled() bool {
	return v != nil && v.IsStickyTaskListEnabled != nil
}

// GetHistorySize returns the value of HistorySize if it is set or its
// zero value if it is unset.
func (v *GetMutableStateResponse) GetHistorySize() (o int64) {
	if v != nil && v.HistorySize != nil {
		return *v.HistorySize
	}

	return
}

// IsSetHistorySize returns true if HistorySize is not nil.
func (v *GetMutableStateResponse) IsSetHistorySize() bool {
	return v != nil && v.HistorySize != nil
}

type NotifyFailoverMarkersRequest struct {
	FailoverMarkerTokens []*FailoverMarkerToken `json:"failoverMarkerTokens,omitempty"`
}

type _List_FailoverMarkerToken_ValueList []*FailoverMarkerToken

func (v _List_FailoverMarkerToken_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*FailoverMarkerToken', index [%v]: value is nil", i)
		}
		w, err := x.ToWire()
		if err != nil {
			return err
		}
		err = f(w)
		if err != nil {
			return err
		}
	}
	return nil
}

func (v _List_FailoverMarkerToken_ValueList) Size() int {
	return len(v)
}

func (_List_FailoverMarkerToken_ValueList) ValueType() wire.Type {
	return wire.TStruct
}

func (_List_FailoverMarkerToken_ValueList) Close() {}

// ToWire translates a NotifyFailoverMarkersRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *NotifyFailoverMarkersRequest) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.FailoverMarkerTokens != nil {
		w, err = wire.NewValueList(_List_FailoverMarkerToken_ValueList(v.FailoverMarkerTokens)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _FailoverMarkerToken_Read(w wire.Value) (*FailoverMarkerToken, error) {
	var v FailoverMarkerToken
	err := v.FromWire(w)
	return &v, err
}

func _List_FailoverMarkerToken_Read(l wire.ValueList) ([]*FailoverMarkerToken, error) {
	if l.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make([]*FailoverMarkerToken, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _FailoverMarkerToken_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}

// FromWire deserializes a NotifyFailoverMarkersRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a NotifyFailoverMarkersRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v NotifyFailoverMarkersRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *NotifyFailoverMarkersRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TList {
				v.FailoverMarkerTokens, err = _List_FailoverMarkerToken_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_FailoverMarkerToken_Encode(val []*FailoverMarkerToken, sw stream.Writer) error {

	lh := stream.ListHeader{
		Type:   wire.TStruct,
		Length: len(val),
	}
	if err := sw.WriteListBegin(lh); err != nil {
		return err
	}

	for i, v := range val {
		if v == nil {
			return fmt.Errorf("invalid list '[]*FailoverMarkerToken', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

// Encode serializes a NotifyFailoverMarkersRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a NotifyFailoverMarkersRequest struct could not be encoded.
func (v *NotifyFailoverMarkersRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.FailoverMarkerTokens != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TList}); err != nil {
			return err
		}
		if err := _List_FailoverMarkerToken_Encode(v.FailoverMarkerTokens, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _FailoverMarkerToken_Decode(sr stream.Reader) (*FailoverMarkerToken, error) {
	var v FailoverMarkerToken
	err := v.Decode(sr)
	return &v, err
}

func _List_FailoverMarkerToken_Decode(sr stream.Reader) ([]*FailoverMarkerToken, error) {
	lh, err := sr.ReadListBegin()
	if err != nil {
		return nil, err
	}

	if lh.Type != wire.TStruct {
		for i := 0; i < lh.Length; i++ {
			if err := sr.Skip(lh.Type); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadListEnd()
	}

	o := make([]*FailoverMarkerToken, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _FailoverMarkerToken_Decode(sr)
		if err != nil {
			return nil, err
		}
		o = append(o, v)
	}

	if err = sr.ReadListEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a NotifyFailoverMarkersRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a NotifyFailoverMarkersRequest struct could not be generated from the wire
// representation.
func (v *NotifyFailoverMarkersRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TList:
			v.FailoverMarkerTokens, err = _List_FailoverMarkerToken_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a NotifyFailoverMarkersRequest
// struct.
func (v *NotifyFailoverMarkersRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.FailoverMarkerTokens != nil {
		fields[i] = fmt.Sprintf("FailoverMarkerTokens: %v", v.FailoverMarkerTokens)
		i++
	}

	return fmt.Sprintf("NotifyFailoverMarkersRequest{%v}", strings.Join(fields[:i], ", "))
}

func _List_FailoverMarkerToken_Equals(lhs, rhs []*FailoverMarkerToken) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for i, lv := range lhs {
		rv := rhs[i]
		if !lv.Equals(rv) {
			return false
		}
	}

	return true
}

// Equals returns true if all the fields of this NotifyFailoverMarkersRequest match the
// provided NotifyFailoverMarkersRequest.
//
// This function performs a deep comparison.
func (v *NotifyFailoverMarkersRequest) Equals(rhs *NotifyFailoverMarkersRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.FailoverMarkerTokens == nil && rhs.FailoverMarkerTokens == nil) || (v.FailoverMarkerTokens != nil && rhs.FailoverMarkerTokens != nil && _List_FailoverMarkerToken_Equals(v.FailoverMarkerTokens, rhs.FailoverMarkerTokens))) {
		return false
	}

	return true
}

type _List_FailoverMarkerToken_Zapper []*FailoverMarkerToken

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_FailoverMarkerToken_Zapper.
func (l _List_FailoverMarkerToken_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for _, v := range l {
		err = multierr.Append(err, enc.AppendObject(v))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of NotifyFailoverMarkersRequest.
func (v *NotifyFailoverMarkersRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.FailoverMarkerTokens != nil {
		err = multierr.Append(err, enc.AddArray("failoverMarkerTokens", (_List_FailoverMarkerToken_Zapper)(v.FailoverMarkerTokens)))
	}
	return err
}

// GetFailoverMarkerTokens returns the value of FailoverMarkerTokens if it is set or its
// zero value if it is unset.
func (v *NotifyFailoverMarkersRequest) GetFailoverMarkerTokens() (o []*FailoverMarkerToken) {
	if v != nil && v.FailoverMarkerTokens != nil {
		return v.FailoverMarkerTokens
	}

	return
}

// IsSetFailoverMarkerTokens returns true if FailoverMarkerTokens is not nil.
func (v *NotifyFailoverMarkersRequest) IsSetFailoverMarkerTokens() bool {
	return v != nil && v.FailoverMarkerTokens != nil
}

type ParentExecutionInfo struct {
	DomainUUID  *string                   `json:"domainUUID,omitempty"`
	Domain      *string                   `json:"domain,omitempty"`
	Execution   *shared.WorkflowExecution `json:"execution,omitempty"`
	InitiatedId *int64                    `json:"initiatedId,omitempty"`
}

// ToWire translates a ParentExecutionInfo struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ParentExecutionInfo) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Domain != nil {
		w, err = wire.NewValueString(*(v.Domain)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 15, Value: w}
		i++
	}
	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.InitiatedId != nil {
		w, err = wire.NewValueI64(*(v.InitiatedId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a ParentExecutionInfo struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ParentExecutionInfo struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ParentExecutionInfo
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ParentExecutionInfo) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 15:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.Domain = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.InitiatedId = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ParentExecutionInfo struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ParentExecutionInfo struct could not be encoded.
func (v *ParentExecutionInfo) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Domain != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 15, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.Domain)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InitiatedId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.InitiatedId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a ParentExecutionInfo struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ParentExecutionInfo struct could not be generated from the wire
// representation.
func (v *ParentExecutionInfo) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 15 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.Domain = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.InitiatedId = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ParentExecutionInfo
// struct.
func (v *ParentExecutionInfo) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Domain != nil {
		fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain))
		i++
	}
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}
	if v.InitiatedId != nil {
		fields[i] = fmt.Sprintf("InitiatedId: %v", *(v.InitiatedId))
		i++
	}

	return fmt.Sprintf("ParentExecutionInfo{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ParentExecutionInfo match the
// provided ParentExecutionInfo.
//
// This function performs a deep comparison.
func (v *ParentExecutionInfo) Equals(rhs *ParentExecutionInfo) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !_String_EqualsPtr(v.Domain, rhs.Domain) {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}
	if !_I64_EqualsPtr(v.InitiatedId, rhs.InitiatedId) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ParentExecutionInfo.
func (v *ParentExecutionInfo) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Domain != nil {
		enc.AddString("domain", *v.Domain)
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	if v.InitiatedId != nil {
		enc.AddInt64("initiatedId", *v.InitiatedId)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *ParentExecutionInfo) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *ParentExecutionInfo) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetDomain returns the value of Domain if it is set or its
// zero value if it is unset.
func (v *ParentExecutionInfo) GetDomain() (o string) {
	if v != nil && v.Domain != nil {
		return *v.Domain
	}

	return
}

// IsSetDomain returns true if Domain is not nil.
func (v *ParentExecutionInfo) IsSetDomain() bool {
	return v != nil && v.Domain != nil
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *ParentExecutionInfo) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *ParentExecutionInfo) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

// GetInitiatedId returns the value of InitiatedId if it is set or its
// zero value if it is unset.
func (v *ParentExecutionInfo) GetInitiatedId() (o int64) {
	if v != nil && v.InitiatedId != nil {
		return *v.InitiatedId
	}

	return
}

// IsSetInitiatedId returns true if InitiatedId is not nil.
func (v *ParentExecutionInfo) IsSetInitiatedId() bool {
	return v != nil && v.InitiatedId != nil
}

type PollMutableStateRequest struct {
	DomainUUID          *string                   `json:"domainUUID,omitempty"`
	Execution           *shared.WorkflowExecution `json:"execution,omitempty"`
	ExpectedNextEventId *int64                    `json:"expectedNextEventId,omitempty"`
	CurrentBranchToken  []byte                    `json:"currentBranchToken,omitempty"`
}

// ToWire translates a PollMutableStateRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *PollMutableStateRequest) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ExpectedNextEventId != nil {
		w, err = wire.NewValueI64(*(v.ExpectedNextEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.CurrentBranchToken != nil {
		w, err = wire.NewValueBinary(v.CurrentBranchToken), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a PollMutableStateRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a PollMutableStateRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v PollMutableStateRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *PollMutableStateRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ExpectedNextEventId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TBinary {
				v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a PollMutableStateRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a PollMutableStateRequest struct could not be encoded.
func (v *PollMutableStateRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExpectedNextEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ExpectedNextEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CurrentBranchToken != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.CurrentBranchToken); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a PollMutableStateRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a PollMutableStateRequest struct could not be generated from the wire
// representation.
func (v *PollMutableStateRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ExpectedNextEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TBinary:
			v.CurrentBranchToken, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a PollMutableStateRequest
// struct.
func (v *PollMutableStateRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}
	if v.ExpectedNextEventId != nil {
		fields[i] = fmt.Sprintf("ExpectedNextEventId: %v", *(v.ExpectedNextEventId))
		i++
	}
	if v.CurrentBranchToken != nil {
		fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken)
		i++
	}

	return fmt.Sprintf("PollMutableStateRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this PollMutableStateRequest match the
// provided PollMutableStateRequest.
//
// This function performs a deep comparison.
func (v *PollMutableStateRequest) Equals(rhs *PollMutableStateRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}
	if !_I64_EqualsPtr(v.ExpectedNextEventId, rhs.ExpectedNextEventId) {
		return false
	}
	if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of PollMutableStateRequest.
func (v *PollMutableStateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	if v.ExpectedNextEventId != nil {
		enc.AddInt64("expectedNextEventId", *v.ExpectedNextEventId)
	}
	if v.CurrentBranchToken != nil {
		enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *PollMutableStateRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *PollMutableStateRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *PollMutableStateRequest) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *PollMutableStateRequest) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

// GetExpectedNextEventId returns the value of ExpectedNextEventId if it is set or its
// zero value if it is unset.
func (v *PollMutableStateRequest) GetExpectedNextEventId() (o int64) {
	if v != nil && v.ExpectedNextEventId != nil {
		return *v.ExpectedNextEventId
	}

	return
}

// IsSetExpectedNextEventId returns true if ExpectedNextEventId is not nil.
func (v *PollMutableStateRequest) IsSetExpectedNextEventId() bool {
	return v != nil && v.ExpectedNextEventId != nil
}

// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its
// zero value if it is unset.
func (v *PollMutableStateRequest) GetCurrentBranchToken() (o []byte) {
	if v != nil && v.CurrentBranchToken != nil {
		return v.CurrentBranchToken
	}

	return
}

// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil.
func (v *PollMutableStateRequest) IsSetCurrentBranchToken() bool {
	return v != nil && v.CurrentBranchToken != nil
}

type PollMutableStateResponse struct {
	Execution                            *shared.WorkflowExecution `json:"execution,omitempty"`
	WorkflowType                         *shared.WorkflowType      `json:"workflowType,omitempty"`
	NextEventId                          *int64                    `json:"NextEventId,omitempty"`
	PreviousStartedEventId               *int64                    `json:"PreviousStartedEventId,omitempty"`
	LastFirstEventId                     *int64                    `json:"LastFirstEventId,omitempty"`
	TaskList                             *shared.TaskList          `json:"taskList,omitempty"`
	StickyTaskList                       *shared.TaskList          `json:"stickyTaskList,omitempty"`
	ClientLibraryVersion                 *string                   `json:"clientLibraryVersion,omitempty"`
	ClientFeatureVersion                 *string                   `json:"clientFeatureVersion,omitempty"`
	ClientImpl                           *string                   `json:"clientImpl,omitempty"`
	StickyTaskListScheduleToStartTimeout *int32                    `json:"stickyTaskListScheduleToStartTimeout,omitempty"`
	CurrentBranchToken                   []byte                    `json:"currentBranchToken,omitempty"`
	VersionHistories                     *shared.VersionHistories  `json:"versionHistories,omitempty"`
	WorkflowState                        *int32                    `json:"workflowState,omitempty"`
	WorkflowCloseState                   *int32                    `json:"workflowCloseState,omitempty"`
}

// ToWire translates a PollMutableStateResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *PollMutableStateResponse) ToWire() (wire.Value, error) {
	var (
		fields [15]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowType != nil {
		w, err = v.WorkflowType.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.NextEventId != nil {
		w, err = wire.NewValueI64(*(v.NextEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.PreviousStartedEventId != nil {
		w, err = wire.NewValueI64(*(v.PreviousStartedEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 35, Value: w}
		i++
	}
	if v.LastFirstEventId != nil {
		w, err = wire.NewValueI64(*(v.LastFirstEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.TaskList != nil {
		w, err = v.TaskList.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.StickyTaskList != nil {
		w, err = v.StickyTaskList.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.ClientLibraryVersion != nil {
		w, err = wire.NewValueString(*(v.ClientLibraryVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}
	if v.ClientFeatureVersion != nil {
		w, err = wire.NewValueString(*(v.ClientFeatureVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 80, Value: w}
		i++
	}
	if v.ClientImpl != nil {
		w, err = wire.NewValueString(*(v.ClientImpl)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 90, Value: w}
		i++
	}
	if v.StickyTaskListScheduleToStartTimeout != nil {
		w, err = wire.NewValueI32(*(v.StickyTaskListScheduleToStartTimeout)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 100, Value: w}
		i++
	}
	if v.CurrentBranchToken != nil {
		w, err = wire.NewValueBinary(v.CurrentBranchToken), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 110, Value: w}
		i++
	}
	if v.VersionHistories != nil {
		w, err = v.VersionHistories.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 130, Value: w}
		i++
	}
	if v.WorkflowState != nil {
		w, err = wire.NewValueI32(*(v.WorkflowState)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 140, Value: w}
		i++
	}
	if v.WorkflowCloseState != nil {
		w, err = wire.NewValueI32(*(v.WorkflowCloseState)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 150, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a PollMutableStateResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a PollMutableStateResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v PollMutableStateResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *PollMutableStateResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowType, err = _WorkflowType_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.NextEventId = &x
				if err != nil {
					return err
				}

			}
		case 35:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.PreviousStartedEventId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.LastFirstEventId = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TStruct {
				v.TaskList, err = _TaskList_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TStruct {
				v.StickyTaskList, err = _TaskList_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 70:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ClientLibraryVersion = &x
				if err != nil {
					return err
				}

			}
		case 80:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ClientFeatureVersion = &x
				if err != nil {
					return err
				}

			}
		case 90:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ClientImpl = &x
				if err != nil {
					return err
				}

			}
		case 100:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.StickyTaskListScheduleToStartTimeout = &x
				if err != nil {
					return err
				}

			}
		case 110:
			if field.Value.Type() == wire.TBinary {
				v.CurrentBranchToken, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 130:
			if field.Value.Type() == wire.TStruct {
				v.VersionHistories, err = _VersionHistories_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 140:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.WorkflowState = &x
				if err != nil {
					return err
				}

			}
		case 150:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.WorkflowCloseState = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a PollMutableStateResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a PollMutableStateResponse struct could not be encoded.
func (v *PollMutableStateResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowType != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowType.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.NextEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.NextEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PreviousStartedEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 35, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.PreviousStartedEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastFirstEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.LastFirstEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.TaskList != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.TaskList.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StickyTaskList != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.StickyTaskList.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientLibraryVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 70, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ClientLibraryVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientFeatureVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 80, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ClientFeatureVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientImpl != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 90, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ClientImpl)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StickyTaskListScheduleToStartTimeout != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 100, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.StickyTaskListScheduleToStartTimeout)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CurrentBranchToken != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 110, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.CurrentBranchToken); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.VersionHistories != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 130, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.VersionHistories.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowState != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 140, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.WorkflowState)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowCloseState != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 150, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.WorkflowCloseState)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a PollMutableStateResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a PollMutableStateResponse struct could not be generated from the wire
// representation.
func (v *PollMutableStateResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowType, err = _WorkflowType_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.NextEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 35 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.PreviousStartedEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.LastFirstEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TStruct:
			v.TaskList, err = _TaskList_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TStruct:
			v.StickyTaskList, err = _TaskList_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 70 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClientLibraryVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 80 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClientFeatureVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 90 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClientImpl = &x
			if err != nil {
				return err
			}

		case fh.ID == 100 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.StickyTaskListScheduleToStartTimeout = &x
			if err != nil {
				return err
			}

		case fh.ID == 110 && fh.Type == wire.TBinary:
			v.CurrentBranchToken, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 130 && fh.Type == wire.TStruct:
			v.VersionHistories, err = _VersionHistories_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 140 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.WorkflowState = &x
			if err != nil {
				return err
			}

		case fh.ID == 150 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.WorkflowCloseState = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a PollMutableStateResponse
// struct.
func (v *PollMutableStateResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [15]string
	i := 0
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}
	if v.WorkflowType != nil {
		fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType)
		i++
	}
	if v.NextEventId != nil {
		fields[i] = fmt.Sprintf("NextEventId: %v", *(v.NextEventId))
		i++
	}
	if v.PreviousStartedEventId != nil {
		fields[i] = fmt.Sprintf("PreviousStartedEventId: %v", *(v.PreviousStartedEventId))
		i++
	}
	if v.LastFirstEventId != nil {
		fields[i] = fmt.Sprintf("LastFirstEventId: %v", *(v.LastFirstEventId))
		i++
	}
	if v.TaskList != nil {
		fields[i] = fmt.Sprintf("TaskList: %v", v.TaskList)
		i++
	}
	if v.StickyTaskList != nil {
		fields[i] = fmt.Sprintf("StickyTaskList: %v", v.StickyTaskList)
		i++
	}
	if v.ClientLibraryVersion != nil {
		fields[i] = fmt.Sprintf("ClientLibraryVersion: %v", *(v.ClientLibraryVersion))
		i++
	}
	if v.ClientFeatureVersion != nil {
		fields[i] = fmt.Sprintf("ClientFeatureVersion: %v", *(v.ClientFeatureVersion))
		i++
	}
	if v.ClientImpl != nil {
		fields[i] = fmt.Sprintf("ClientImpl: %v", *(v.ClientImpl))
		i++
	}
	if v.StickyTaskListScheduleToStartTimeout != nil {
		fields[i] = fmt.Sprintf("StickyTaskListScheduleToStartTimeout: %v", *(v.StickyTaskListScheduleToStartTimeout))
		i++
	}
	if v.CurrentBranchToken != nil {
		fields[i] = fmt.Sprintf("CurrentBranchToken: %v", v.CurrentBranchToken)
		i++
	}
	if v.VersionHistories != nil {
		fields[i] = fmt.Sprintf("VersionHistories: %v", v.VersionHistories)
		i++
	}
	if v.WorkflowState != nil {
		fields[i] = fmt.Sprintf("WorkflowState: %v", *(v.WorkflowState))
		i++
	}
	if v.WorkflowCloseState != nil {
		fields[i] = fmt.Sprintf("WorkflowCloseState: %v", *(v.WorkflowCloseState))
		i++
	}

	return fmt.Sprintf("PollMutableStateResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this PollMutableStateResponse match the
// provided PollMutableStateResponse.
//
// This function performs a deep comparison.
func (v *PollMutableStateResponse) Equals(rhs *PollMutableStateResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}
	if !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) {
		return false
	}
	if !_I64_EqualsPtr(v.NextEventId, rhs.NextEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.PreviousStartedEventId, rhs.PreviousStartedEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.LastFirstEventId, rhs.LastFirstEventId) {
		return false
	}
	if !((v.TaskList == nil && rhs.TaskList == nil) || (v.TaskList != nil && rhs.TaskList != nil && v.TaskList.Equals(rhs.TaskList))) {
		return false
	}
	if !((v.StickyTaskList == nil && rhs.StickyTaskList == nil) || (v.StickyTaskList != nil && rhs.StickyTaskList != nil && v.StickyTaskList.Equals(rhs.StickyTaskList))) {
		return false
	}
	if !_String_EqualsPtr(v.ClientLibraryVersion, rhs.ClientLibraryVersion) {
		return false
	}
	if !_String_EqualsPtr(v.ClientFeatureVersion, rhs.ClientFeatureVersion) {
		return false
	}
	if !_String_EqualsPtr(v.ClientImpl, rhs.ClientImpl) {
		return false
	}
	if !_I32_EqualsPtr(v.StickyTaskListScheduleToStartTimeout, rhs.StickyTaskListScheduleToStartTimeout) {
		return false
	}
	if !((v.CurrentBranchToken == nil && rhs.CurrentBranchToken == nil) || (v.CurrentBranchToken != nil && rhs.CurrentBranchToken != nil && bytes.Equal(v.CurrentBranchToken, rhs.CurrentBranchToken))) {
		return false
	}
	if !((v.VersionHistories == nil && rhs.VersionHistories == nil) || (v.VersionHistories != nil && rhs.VersionHistories != nil && v.VersionHistories.Equals(rhs.VersionHistories))) {
		return false
	}
	if !_I32_EqualsPtr(v.WorkflowState, rhs.WorkflowState) {
		return false
	}
	if !_I32_EqualsPtr(v.WorkflowCloseState, rhs.WorkflowCloseState) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of PollMutableStateResponse.
func (v *PollMutableStateResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	if v.WorkflowType != nil {
		err = multierr.Append(err, enc.AddObject("workflowType", v.WorkflowType))
	}
	if v.NextEventId != nil {
		enc.AddInt64("NextEventId", *v.NextEventId)
	}
	if v.PreviousStartedEventId != nil {
		enc.AddInt64("PreviousStartedEventId", *v.PreviousStartedEventId)
	}
	if v.LastFirstEventId != nil {
		enc.AddInt64("LastFirstEventId", *v.LastFirstEventId)
	}
	if v.TaskList != nil {
		err = multierr.Append(err, enc.AddObject("taskList", v.TaskList))
	}
	if v.StickyTaskList != nil {
		err = multierr.Append(err, enc.AddObject("stickyTaskList", v.StickyTaskList))
	}
	if v.ClientLibraryVersion != nil {
		enc.AddString("clientLibraryVersion", *v.ClientLibraryVersion)
	}
	if v.ClientFeatureVersion != nil {
		enc.AddString("clientFeatureVersion", *v.ClientFeatureVersion)
	}
	if v.ClientImpl != nil {
		enc.AddString("clientImpl", *v.ClientImpl)
	}
	if v.StickyTaskListScheduleToStartTimeout != nil {
		enc.AddInt32("stickyTaskListScheduleToStartTimeout", *v.StickyTaskListScheduleToStartTimeout)
	}
	if v.CurrentBranchToken != nil {
		enc.AddString("currentBranchToken", base64.StdEncoding.EncodeToString(v.CurrentBranchToken))
	}
	if v.VersionHistories != nil {
		err = multierr.Append(err, enc.AddObject("versionHistories", v.VersionHistories))
	}
	if v.WorkflowState != nil {
		enc.AddInt32("workflowState", *v.WorkflowState)
	}
	if v.WorkflowCloseState != nil {
		enc.AddInt32("workflowCloseState", *v.WorkflowCloseState)
	}
	return err
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *PollMutableStateResponse) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

// GetWorkflowType returns the value of WorkflowType if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetWorkflowType() (o *shared.WorkflowType) {
	if v != nil && v.WorkflowType != nil {
		return v.WorkflowType
	}

	return
}

// IsSetWorkflowType returns true if WorkflowType is not nil.
func (v *PollMutableStateResponse) IsSetWorkflowType() bool {
	return v != nil && v.WorkflowType != nil
}

// GetNextEventId returns the value of NextEventId if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetNextEventId() (o int64) {
	if v != nil && v.NextEventId != nil {
		return *v.NextEventId
	}

	return
}

// IsSetNextEventId returns true if NextEventId is not nil.
func (v *PollMutableStateResponse) IsSetNextEventId() bool {
	return v != nil && v.NextEventId != nil
}

// GetPreviousStartedEventId returns the value of PreviousStartedEventId if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetPreviousStartedEventId() (o int64) {
	if v != nil && v.PreviousStartedEventId != nil {
		return *v.PreviousStartedEventId
	}

	return
}

// IsSetPreviousStartedEventId returns true if PreviousStartedEventId is not nil.
func (v *PollMutableStateResponse) IsSetPreviousStartedEventId() bool {
	return v != nil && v.PreviousStartedEventId != nil
}

// GetLastFirstEventId returns the value of LastFirstEventId if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetLastFirstEventId() (o int64) {
	if v != nil && v.LastFirstEventId != nil {
		return *v.LastFirstEventId
	}

	return
}

// IsSetLastFirstEventId returns true if LastFirstEventId is not nil.
func (v *PollMutableStateResponse) IsSetLastFirstEventId() bool {
	return v != nil && v.LastFirstEventId != nil
}

// GetTaskList returns the value of TaskList if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetTaskList() (o *shared.TaskList) {
	if v != nil && v.TaskList != nil {
		return v.TaskList
	}

	return
}

// IsSetTaskList returns true if TaskList is not nil.
func (v *PollMutableStateResponse) IsSetTaskList() bool {
	return v != nil && v.TaskList != nil
}

// GetStickyTaskList returns the value of StickyTaskList if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetStickyTaskList() (o *shared.TaskList) {
	if v != nil && v.StickyTaskList != nil {
		return v.StickyTaskList
	}

	return
}

// IsSetStickyTaskList returns true if StickyTaskList is not nil.
func (v *PollMutableStateResponse) IsSetStickyTaskList() bool {
	return v != nil && v.StickyTaskList != nil
}

// GetClientLibraryVersion returns the value of ClientLibraryVersion if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetClientLibraryVersion() (o string) {
	if v != nil && v.ClientLibraryVersion != nil {
		return *v.ClientLibraryVersion
	}

	return
}

// IsSetClientLibraryVersion returns true if ClientLibraryVersion is not nil.
func (v *PollMutableStateResponse) IsSetClientLibraryVersion() bool {
	return v != nil && v.ClientLibraryVersion != nil
}

// GetClientFeatureVersion returns the value of ClientFeatureVersion if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetClientFeatureVersion() (o string) {
	if v != nil && v.ClientFeatureVersion != nil {
		return *v.ClientFeatureVersion
	}

	return
}

// IsSetClientFeatureVersion returns true if ClientFeatureVersion is not nil.
func (v *PollMutableStateResponse) IsSetClientFeatureVersion() bool {
	return v != nil && v.ClientFeatureVersion != nil
}

// GetClientImpl returns the value of ClientImpl if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetClientImpl() (o string) {
	if v != nil && v.ClientImpl != nil {
		return *v.ClientImpl
	}

	return
}

// IsSetClientImpl returns true if ClientImpl is not nil.
func (v *PollMutableStateResponse) IsSetClientImpl() bool {
	return v != nil && v.ClientImpl != nil
}

// GetStickyTaskListScheduleToStartTimeout returns the value of StickyTaskListScheduleToStartTimeout if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetStickyTaskListScheduleToStartTimeout() (o int32) {
	if v != nil && v.StickyTaskListScheduleToStartTimeout != nil {
		return *v.StickyTaskListScheduleToStartTimeout
	}

	return
}

// IsSetStickyTaskListScheduleToStartTimeout returns true if StickyTaskListScheduleToStartTimeout is not nil.
func (v *PollMutableStateResponse) IsSetStickyTaskListScheduleToStartTimeout() bool {
	return v != nil && v.StickyTaskListScheduleToStartTimeout != nil
}

// GetCurrentBranchToken returns the value of CurrentBranchToken if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetCurrentBranchToken() (o []byte) {
	if v != nil && v.CurrentBranchToken != nil {
		return v.CurrentBranchToken
	}

	return
}

// IsSetCurrentBranchToken returns true if CurrentBranchToken is not nil.
func (v *PollMutableStateResponse) IsSetCurrentBranchToken() bool {
	return v != nil && v.CurrentBranchToken != nil
}

// GetVersionHistories returns the value of VersionHistories if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetVersionHistories() (o *shared.VersionHistories) {
	if v != nil && v.VersionHistories != nil {
		return v.VersionHistories
	}

	return
}

// IsSetVersionHistories returns true if VersionHistories is not nil.
func (v *PollMutableStateResponse) IsSetVersionHistories() bool {
	return v != nil && v.VersionHistories != nil
}

// GetWorkflowState returns the value of WorkflowState if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetWorkflowState() (o int32) {
	if v != nil && v.WorkflowState != nil {
		return *v.WorkflowState
	}

	return
}

// IsSetWorkflowState returns true if WorkflowState is not nil.
func (v *PollMutableStateResponse) IsSetWorkflowState() bool {
	return v != nil && v.WorkflowState != nil
}

// GetWorkflowCloseState returns the value of WorkflowCloseState if it is set or its
// zero value if it is unset.
func (v *PollMutableStateResponse) GetWorkflowCloseState() (o int32) {
	if v != nil && v.WorkflowCloseState != nil {
		return *v.WorkflowCloseState
	}

	return
}

// IsSetWorkflowCloseState returns true if WorkflowCloseState is not nil.
func (v *PollMutableStateResponse) IsSetWorkflowCloseState() bool {
	return v != nil && v.WorkflowCloseState != nil
}

type ProcessingQueueState struct {
	Level        *int32        `json:"level,omitempty"`
	AckLevel     *int64        `json:"ackLevel,omitempty"`
	MaxLevel     *int64        `json:"maxLevel,omitempty"`
	DomainFilter *DomainFilter `json:"domainFilter,omitempty"`
}

// ToWire translates a ProcessingQueueState struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ProcessingQueueState) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Level != nil {
		w, err = wire.NewValueI32(*(v.Level)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.AckLevel != nil {
		w, err = wire.NewValueI64(*(v.AckLevel)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.MaxLevel != nil {
		w, err = wire.NewValueI64(*(v.MaxLevel)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.DomainFilter != nil {
		w, err = v.DomainFilter.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DomainFilter_Read(w wire.Value) (*DomainFilter, error) {
	var v DomainFilter
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a ProcessingQueueState struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ProcessingQueueState struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ProcessingQueueState
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ProcessingQueueState) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.Level = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.AckLevel = &x
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.MaxLevel = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TStruct {
				v.DomainFilter, err = _DomainFilter_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ProcessingQueueState struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ProcessingQueueState struct could not be encoded.
func (v *ProcessingQueueState) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Level != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.Level)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AckLevel != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.AckLevel)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.MaxLevel != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.MaxLevel)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainFilter != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainFilter.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _DomainFilter_Decode(sr stream.Reader) (*DomainFilter, error) {
	var v DomainFilter
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a ProcessingQueueState struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ProcessingQueueState struct could not be generated from the wire
// representation.
func (v *ProcessingQueueState) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.Level = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.AckLevel = &x
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.MaxLevel = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TStruct:
			v.DomainFilter, err = _DomainFilter_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ProcessingQueueState
// struct.
func (v *ProcessingQueueState) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.Level != nil {
		fields[i] = fmt.Sprintf("Level: %v", *(v.Level))
		i++
	}
	if v.AckLevel != nil {
		fields[i] = fmt.Sprintf("AckLevel: %v", *(v.AckLevel))
		i++
	}
	if v.MaxLevel != nil {
		fields[i] = fmt.Sprintf("MaxLevel: %v", *(v.MaxLevel))
		i++
	}
	if v.DomainFilter != nil {
		fields[i] = fmt.Sprintf("DomainFilter: %v", v.DomainFilter)
		i++
	}

	return fmt.Sprintf("ProcessingQueueState{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ProcessingQueueState match the
// provided ProcessingQueueState.
//
// This function performs a deep comparison.
func (v *ProcessingQueueState) Equals(rhs *ProcessingQueueState) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_I32_EqualsPtr(v.Level, rhs.Level) {
		return false
	}
	if !_I64_EqualsPtr(v.AckLevel, rhs.AckLevel) {
		return false
	}
	if !_I64_EqualsPtr(v.MaxLevel, rhs.MaxLevel) {
		return false
	}
	if !((v.DomainFilter == nil && rhs.DomainFilter == nil) || (v.DomainFilter != nil && rhs.DomainFilter != nil && v.DomainFilter.Equals(rhs.DomainFilter))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ProcessingQueueState.
func (v *ProcessingQueueState) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Level != nil {
		enc.AddInt32("level", *v.Level)
	}
	if v.AckLevel != nil {
		enc.AddInt64("ackLevel", *v.AckLevel)
	}
	if v.MaxLevel != nil {
		enc.AddInt64("maxLevel", *v.MaxLevel)
	}
	if v.DomainFilter != nil {
		err = multierr.Append(err, enc.AddObject("domainFilter", v.DomainFilter))
	}
	return err
}

// GetLevel returns the value of Level if it is set or its
// zero value if it is unset.
func (v *ProcessingQueueState) GetLevel() (o int32) {
	if v != nil && v.Level != nil {
		return *v.Level
	}

	return
}

// IsSetLevel returns true if Level is not nil.
func (v *ProcessingQueueState) IsSetLevel() bool {
	return v != nil && v.Level != nil
}

// GetAckLevel returns the value of AckLevel if it is set or its
// zero value if it is unset.
func (v *ProcessingQueueState) GetAckLevel() (o int64) {
	if v != nil && v.AckLevel != nil {
		return *v.AckLevel
	}

	return
}

// IsSetAckLevel returns true if AckLevel is not nil.
func (v *ProcessingQueueState) IsSetAckLevel() bool {
	return v != nil && v.AckLevel != nil
}

// GetMaxLevel returns the value of MaxLevel if it is set or its
// zero value if it is unset.
func (v *ProcessingQueueState) GetMaxLevel() (o int64) {
	if v != nil && v.MaxLevel != nil {
		return *v.MaxLevel
	}

	return
}

// IsSetMaxLevel returns true if MaxLevel is not nil.
func (v *ProcessingQueueState) IsSetMaxLevel() bool {
	return v != nil && v.MaxLevel != nil
}

// GetDomainFilter returns the value of DomainFilter if it is set or its
// zero value if it is unset.
func (v *ProcessingQueueState) GetDomainFilter() (o *DomainFilter) {
	if v != nil && v.DomainFilter != nil {
		return v.DomainFilter
	}

	return
}

// IsSetDomainFilter returns true if DomainFilter is not nil.
func (v *ProcessingQueueState) IsSetDomainFilter() bool {
	return v != nil && v.DomainFilter != nil
}

type ProcessingQueueStates struct {
	StatesByCluster map[string][]*ProcessingQueueState `json:"statesByCluster,omitempty"`
}

type _List_ProcessingQueueState_ValueList []*ProcessingQueueState

func (v _List_ProcessingQueueState_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*ProcessingQueueState', index [%v]: value is nil", i)
		}
		w, err := x.ToWire()
		if err != nil {
			return err
		}
		err = f(w)
		if err != nil {
			return err
		}
	}
	return nil
}

func (v _List_ProcessingQueueState_ValueList) Size() int {
	return len(v)
}

func (_List_ProcessingQueueState_ValueList) ValueType() wire.Type {
	return wire.TStruct
}

func (_List_ProcessingQueueState_ValueList) Close() {}

type _Map_String_List_ProcessingQueueState_MapItemList map[string][]*ProcessingQueueState

func (m _Map_String_List_ProcessingQueueState_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string][]*ProcessingQueueState', key [%v]: value is nil", k)
		}
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := wire.NewValueList(_List_ProcessingQueueState_ValueList(v)), error(nil)
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_List_ProcessingQueueState_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_List_ProcessingQueueState_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_List_ProcessingQueueState_MapItemList) ValueType() wire.Type {
	return wire.TList
}

func (_Map_String_List_ProcessingQueueState_MapItemList) Close() {}

// ToWire translates a ProcessingQueueStates struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ProcessingQueueStates) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.StatesByCluster != nil {
		w, err = wire.NewValueMap(_Map_String_List_ProcessingQueueState_MapItemList(v.StatesByCluster)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ProcessingQueueState_Read(w wire.Value) (*ProcessingQueueState, error) {
	var v ProcessingQueueState
	err := v.FromWire(w)
	return &v, err
}

func _List_ProcessingQueueState_Read(l wire.ValueList) ([]*ProcessingQueueState, error) {
	if l.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make([]*ProcessingQueueState, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _ProcessingQueueState_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}

func _Map_String_List_ProcessingQueueState_Read(m wire.MapItemList) (map[string][]*ProcessingQueueState, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TList {
		return nil, nil
	}

	o := make(map[string][]*ProcessingQueueState, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := _List_ProcessingQueueState_Read(x.Value.GetList())
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a ProcessingQueueStates struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ProcessingQueueStates struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ProcessingQueueStates
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ProcessingQueueStates) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TMap {
				v.StatesByCluster, err = _Map_String_List_ProcessingQueueState_Read(field.Value.GetMap())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_ProcessingQueueState_Encode(val []*ProcessingQueueState, sw stream.Writer) error {

	lh := stream.ListHeader{
		Type:   wire.TStruct,
		Length: len(val),
	}
	if err := sw.WriteListBegin(lh); err != nil {
		return err
	}

	for i, v := range val {
		if v == nil {
			return fmt.Errorf("invalid list '[]*ProcessingQueueState', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

func _Map_String_List_ProcessingQueueState_Encode(val map[string][]*ProcessingQueueState, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TList,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string][]*ProcessingQueueState', key [%v]: value is nil", k)
		}
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := _List_ProcessingQueueState_Encode(v, sw); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a ProcessingQueueStates struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ProcessingQueueStates struct could not be encoded.
func (v *ProcessingQueueStates) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.StatesByCluster != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TMap}); err != nil {
			return err
		}
		if err := _Map_String_List_ProcessingQueueState_Encode(v.StatesByCluster, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ProcessingQueueState_Decode(sr stream.Reader) (*ProcessingQueueState, error) {
	var v ProcessingQueueState
	err := v.Decode(sr)
	return &v, err
}

func _List_ProcessingQueueState_Decode(sr stream.Reader) ([]*ProcessingQueueState, error) {
	lh, err := sr.ReadListBegin()
	if err != nil {
		return nil, err
	}

	if lh.Type != wire.TStruct {
		for i := 0; i < lh.Length; i++ {
			if err := sr.Skip(lh.Type); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadListEnd()
	}

	o := make([]*ProcessingQueueState, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _ProcessingQueueState_Decode(sr)
		if err != nil {
			return nil, err
		}
		o = append(o, v)
	}

	if err = sr.ReadListEnd(); err != nil {
		return nil, err
	}
	return o, err
}

func _Map_String_List_ProcessingQueueState_Decode(sr stream.Reader) (map[string][]*ProcessingQueueState, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TList {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string][]*ProcessingQueueState, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := _List_ProcessingQueueState_Decode(sr)
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a ProcessingQueueStates struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ProcessingQueueStates struct could not be generated from the wire
// representation.
func (v *ProcessingQueueStates) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TMap:
			v.StatesByCluster, err = _Map_String_List_ProcessingQueueState_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ProcessingQueueStates
// struct.
func (v *ProcessingQueueStates) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.StatesByCluster != nil {
		fields[i] = fmt.Sprintf("StatesByCluster: %v", v.StatesByCluster)
		i++
	}

	return fmt.Sprintf("ProcessingQueueStates{%v}", strings.Join(fields[:i], ", "))
}

func _List_ProcessingQueueState_Equals(lhs, rhs []*ProcessingQueueState) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for i, lv := range lhs {
		rv := rhs[i]
		if !lv.Equals(rv) {
			return false
		}
	}

	return true
}

func _Map_String_List_ProcessingQueueState_Equals(lhs, rhs map[string][]*ProcessingQueueState) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !_List_ProcessingQueueState_Equals(lv, rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this ProcessingQueueStates match the
// provided ProcessingQueueStates.
//
// This function performs a deep comparison.
func (v *ProcessingQueueStates) Equals(rhs *ProcessingQueueStates) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.StatesByCluster == nil && rhs.StatesByCluster == nil) || (v.StatesByCluster != nil && rhs.StatesByCluster != nil && _Map_String_List_ProcessingQueueState_Equals(v.StatesByCluster, rhs.StatesByCluster))) {
		return false
	}

	return true
}

type _List_ProcessingQueueState_Zapper []*ProcessingQueueState

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_ProcessingQueueState_Zapper.
func (l _List_ProcessingQueueState_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for _, v := range l {
		err = multierr.Append(err, enc.AppendObject(v))
	}
	return err
}

type _Map_String_List_ProcessingQueueState_Zapper map[string][]*ProcessingQueueState

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_List_ProcessingQueueState_Zapper.
func (m _Map_String_List_ProcessingQueueState_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		err = multierr.Append(err, enc.AddArray((string)(k), (_List_ProcessingQueueState_Zapper)(v)))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ProcessingQueueStates.
func (v *ProcessingQueueStates) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.StatesByCluster != nil {
		err = multierr.Append(err, enc.AddObject("statesByCluster", (_Map_String_List_ProcessingQueueState_Zapper)(v.StatesByCluster)))
	}
	return err
}

// GetStatesByCluster returns the value of StatesByCluster if it is set or its
// zero value if it is unset.
func (v *ProcessingQueueStates) GetStatesByCluster() (o map[string][]*ProcessingQueueState) {
	if v != nil && v.StatesByCluster != nil {
		return v.StatesByCluster
	}

	return
}

// IsSetStatesByCluster returns true if StatesByCluster is not nil.
func (v *ProcessingQueueStates) IsSetStatesByCluster() bool {
	return v != nil && v.StatesByCluster != nil
}

type QueryWorkflowRequest struct {
	DomainUUID *string                      `json:"domainUUID,omitempty"`
	Request    *shared.QueryWorkflowRequest `json:"request,omitempty"`
}

// ToWire translates a QueryWorkflowRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *QueryWorkflowRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _QueryWorkflowRequest_Read(w wire.Value) (*shared.QueryWorkflowRequest, error) {
	var v shared.QueryWorkflowRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a QueryWorkflowRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a QueryWorkflowRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v QueryWorkflowRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *QueryWorkflowRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _QueryWorkflowRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a QueryWorkflowRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a QueryWorkflowRequest struct could not be encoded.
func (v *QueryWorkflowRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _QueryWorkflowRequest_Decode(sr stream.Reader) (*shared.QueryWorkflowRequest, error) {
	var v shared.QueryWorkflowRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a QueryWorkflowRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a QueryWorkflowRequest struct could not be generated from the wire
// representation.
func (v *QueryWorkflowRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Request, err = _QueryWorkflowRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a QueryWorkflowRequest
// struct.
func (v *QueryWorkflowRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("QueryWorkflowRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this QueryWorkflowRequest match the
// provided QueryWorkflowRequest.
//
// This function performs a deep comparison.
func (v *QueryWorkflowRequest) Equals(rhs *QueryWorkflowRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of QueryWorkflowRequest.
func (v *QueryWorkflowRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *QueryWorkflowRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *QueryWorkflowRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *QueryWorkflowRequest) GetRequest() (o *shared.QueryWorkflowRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *QueryWorkflowRequest) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

type QueryWorkflowResponse struct {
	Response *shared.QueryWorkflowResponse `json:"response,omitempty"`
}

// ToWire translates a QueryWorkflowResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *QueryWorkflowResponse) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Response != nil {
		w, err = v.Response.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _QueryWorkflowResponse_Read(w wire.Value) (*shared.QueryWorkflowResponse, error) {
	var v shared.QueryWorkflowResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a QueryWorkflowResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a QueryWorkflowResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v QueryWorkflowResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *QueryWorkflowResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.Response, err = _QueryWorkflowResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a QueryWorkflowResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a QueryWorkflowResponse struct could not be encoded.
func (v *QueryWorkflowResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Response != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Response.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _QueryWorkflowResponse_Decode(sr stream.Reader) (*shared.QueryWorkflowResponse, error) {
	var v shared.QueryWorkflowResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a QueryWorkflowResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a QueryWorkflowResponse struct could not be generated from the wire
// representation.
func (v *QueryWorkflowResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.Response, err = _QueryWorkflowResponse_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a QueryWorkflowResponse
// struct.
func (v *QueryWorkflowResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Response != nil {
		fields[i] = fmt.Sprintf("Response: %v", v.Response)
		i++
	}

	return fmt.Sprintf("QueryWorkflowResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this QueryWorkflowResponse match the
// provided QueryWorkflowResponse.
//
// This function performs a deep comparison.
func (v *QueryWorkflowResponse) Equals(rhs *QueryWorkflowResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Response == nil && rhs.Response == nil) || (v.Response != nil && rhs.Response != nil && v.Response.Equals(rhs.Response))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of QueryWorkflowResponse.
func (v *QueryWorkflowResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Response != nil {
		err = multierr.Append(err, enc.AddObject("response", v.Response))
	}
	return err
}

// GetResponse returns the value of Response if it is set or its
// zero value if it is unset.
func (v *QueryWorkflowResponse) GetResponse() (o *shared.QueryWorkflowResponse) {
	if v != nil && v.Response != nil {
		return v.Response
	}

	return
}

// IsSetResponse returns true if Response is not nil.
func (v *QueryWorkflowResponse) IsSetResponse() bool {
	return v != nil && v.Response != nil
}

type RatelimitUpdateRequest struct {
	// impl-specific data.
	//
	// likely some simple top-level keys and then either:
	//   - map<ratelimit-key-string, something>
	//   - list<something>
	//
	// this is a single blob rather than a collection to save on
	// repeated serialization of the type name, and to allow impls
	// to choose whatever structures are most-convenient for them.
	Data *shared.Any `json:"data,omitempty"`
}

// ToWire translates a RatelimitUpdateRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RatelimitUpdateRequest) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Data != nil {
		w, err = v.Data.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _Any_Read(w wire.Value) (*shared.Any, error) {
	var v shared.Any
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RatelimitUpdateRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RatelimitUpdateRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RatelimitUpdateRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RatelimitUpdateRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.Data, err = _Any_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RatelimitUpdateRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RatelimitUpdateRequest struct could not be encoded.
func (v *RatelimitUpdateRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Data != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Data.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _Any_Decode(sr stream.Reader) (*shared.Any, error) {
	var v shared.Any
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RatelimitUpdateRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RatelimitUpdateRequest struct could not be generated from the wire
// representation.
func (v *RatelimitUpdateRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.Data, err = _Any_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RatelimitUpdateRequest
// struct.
func (v *RatelimitUpdateRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Data != nil {
		fields[i] = fmt.Sprintf("Data: %v", v.Data)
		i++
	}

	return fmt.Sprintf("RatelimitUpdateRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RatelimitUpdateRequest match the
// provided RatelimitUpdateRequest.
//
// This function performs a deep comparison.
func (v *RatelimitUpdateRequest) Equals(rhs *RatelimitUpdateRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Data == nil && rhs.Data == nil) || (v.Data != nil && rhs.Data != nil && v.Data.Equals(rhs.Data))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RatelimitUpdateRequest.
func (v *RatelimitUpdateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Data != nil {
		err = multierr.Append(err, enc.AddObject("data", v.Data))
	}
	return err
}

// GetData returns the value of Data if it is set or its
// zero value if it is unset.
func (v *RatelimitUpdateRequest) GetData() (o *shared.Any) {
	if v != nil && v.Data != nil {
		return v.Data
	}

	return
}

// IsSetData returns true if Data is not nil.
func (v *RatelimitUpdateRequest) IsSetData() bool {
	return v != nil && v.Data != nil
}

type RatelimitUpdateResponse struct {
	// impl-specific data.
	//
	// likely some simple top-level keys and then either:
	//   - map<ratelimit-key-string, something>
	//   - list<something>
	//
	// this is a single blob rather than a collection to save on
	// repeated serialization of the type name, and to allow impls
	// to choose whatever structures are most-convenient for them.
	Data *shared.Any `json:"data,omitempty"`
}

// ToWire translates a RatelimitUpdateResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RatelimitUpdateResponse) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Data != nil {
		w, err = v.Data.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a RatelimitUpdateResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RatelimitUpdateResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RatelimitUpdateResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RatelimitUpdateResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.Data, err = _Any_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RatelimitUpdateResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RatelimitUpdateResponse struct could not be encoded.
func (v *RatelimitUpdateResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Data != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Data.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a RatelimitUpdateResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RatelimitUpdateResponse struct could not be generated from the wire
// representation.
func (v *RatelimitUpdateResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.Data, err = _Any_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RatelimitUpdateResponse
// struct.
func (v *RatelimitUpdateResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Data != nil {
		fields[i] = fmt.Sprintf("Data: %v", v.Data)
		i++
	}

	return fmt.Sprintf("RatelimitUpdateResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RatelimitUpdateResponse match the
// provided RatelimitUpdateResponse.
//
// This function performs a deep comparison.
func (v *RatelimitUpdateResponse) Equals(rhs *RatelimitUpdateResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Data == nil && rhs.Data == nil) || (v.Data != nil && rhs.Data != nil && v.Data.Equals(rhs.Data))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RatelimitUpdateResponse.
func (v *RatelimitUpdateResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Data != nil {
		err = multierr.Append(err, enc.AddObject("data", v.Data))
	}
	return err
}

// GetData returns the value of Data if it is set or its
// zero value if it is unset.
func (v *RatelimitUpdateResponse) GetData() (o *shared.Any) {
	if v != nil && v.Data != nil {
		return v.Data
	}

	return
}

// IsSetData returns true if Data is not nil.
func (v *RatelimitUpdateResponse) IsSetData() bool {
	return v != nil && v.Data != nil
}

type ReapplyEventsRequest struct {
	DomainUUID *string                      `json:"domainUUID,omitempty"`
	Request    *shared.ReapplyEventsRequest `json:"request,omitempty"`
}

// ToWire translates a ReapplyEventsRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ReapplyEventsRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ReapplyEventsRequest_Read(w wire.Value) (*shared.ReapplyEventsRequest, error) {
	var v shared.ReapplyEventsRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a ReapplyEventsRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ReapplyEventsRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReapplyEventsRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReapplyEventsRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _ReapplyEventsRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ReapplyEventsRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ReapplyEventsRequest struct could not be encoded.
func (v *ReapplyEventsRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ReapplyEventsRequest_Decode(sr stream.Reader) (*shared.ReapplyEventsRequest, error) {
	var v shared.ReapplyEventsRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a ReapplyEventsRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReapplyEventsRequest struct could not be generated from the wire
// representation.
func (v *ReapplyEventsRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Request, err = _ReapplyEventsRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ReapplyEventsRequest
// struct.
func (v *ReapplyEventsRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("ReapplyEventsRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ReapplyEventsRequest match the
// provided ReapplyEventsRequest.
//
// This function performs a deep comparison.
func (v *ReapplyEventsRequest) Equals(rhs *ReapplyEventsRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReapplyEventsRequest.
func (v *ReapplyEventsRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *ReapplyEventsRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *ReapplyEventsRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *ReapplyEventsRequest) GetRequest() (o *shared.ReapplyEventsRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *ReapplyEventsRequest) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

type RecordActivityTaskHeartbeatRequest struct {
	DomainUUID       *string                                    `json:"domainUUID,omitempty"`
	HeartbeatRequest *shared.RecordActivityTaskHeartbeatRequest `json:"heartbeatRequest,omitempty"`
}

// ToWire translates a RecordActivityTaskHeartbeatRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RecordActivityTaskHeartbeatRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.HeartbeatRequest != nil {
		w, err = v.HeartbeatRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordActivityTaskHeartbeatRequest_Read(w wire.Value) (*shared.RecordActivityTaskHeartbeatRequest, error) {
	var v shared.RecordActivityTaskHeartbeatRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RecordActivityTaskHeartbeatRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RecordActivityTaskHeartbeatRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RecordActivityTaskHeartbeatRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RecordActivityTaskHeartbeatRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.HeartbeatRequest, err = _RecordActivityTaskHeartbeatRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RecordActivityTaskHeartbeatRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RecordActivityTaskHeartbeatRequest struct could not be encoded.
func (v *RecordActivityTaskHeartbeatRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.HeartbeatRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.HeartbeatRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RecordActivityTaskHeartbeatRequest_Decode(sr stream.Reader) (*shared.RecordActivityTaskHeartbeatRequest, error) {
	var v shared.RecordActivityTaskHeartbeatRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RecordActivityTaskHeartbeatRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RecordActivityTaskHeartbeatRequest struct could not be generated from the wire
// representation.
func (v *RecordActivityTaskHeartbeatRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.HeartbeatRequest, err = _RecordActivityTaskHeartbeatRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RecordActivityTaskHeartbeatRequest
// struct.
func (v *RecordActivityTaskHeartbeatRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.HeartbeatRequest != nil {
		fields[i] = fmt.Sprintf("HeartbeatRequest: %v", v.HeartbeatRequest)
		i++
	}

	return fmt.Sprintf("RecordActivityTaskHeartbeatRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RecordActivityTaskHeartbeatRequest match the
// provided RecordActivityTaskHeartbeatRequest.
//
// This function performs a deep comparison.
func (v *RecordActivityTaskHeartbeatRequest) Equals(rhs *RecordActivityTaskHeartbeatRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.HeartbeatRequest == nil && rhs.HeartbeatRequest == nil) || (v.HeartbeatRequest != nil && rhs.HeartbeatRequest != nil && v.HeartbeatRequest.Equals(rhs.HeartbeatRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RecordActivityTaskHeartbeatRequest.
func (v *RecordActivityTaskHeartbeatRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.HeartbeatRequest != nil {
		err = multierr.Append(err, enc.AddObject("heartbeatRequest", v.HeartbeatRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskHeartbeatRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RecordActivityTaskHeartbeatRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetHeartbeatRequest returns the value of HeartbeatRequest if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskHeartbeatRequest) GetHeartbeatRequest() (o *shared.RecordActivityTaskHeartbeatRequest) {
	if v != nil && v.HeartbeatRequest != nil {
		return v.HeartbeatRequest
	}

	return
}

// IsSetHeartbeatRequest returns true if HeartbeatRequest is not nil.
func (v *RecordActivityTaskHeartbeatRequest) IsSetHeartbeatRequest() bool {
	return v != nil && v.HeartbeatRequest != nil
}

type RecordActivityTaskStartedRequest struct {
	DomainUUID        *string                            `json:"domainUUID,omitempty"`
	WorkflowExecution *shared.WorkflowExecution          `json:"workflowExecution,omitempty"`
	ScheduleId        *int64                             `json:"scheduleId,omitempty"`
	TaskId            *int64                             `json:"taskId,omitempty"`
	RequestId         *string                            `json:"requestId,omitempty"`
	PollRequest       *shared.PollForActivityTaskRequest `json:"pollRequest,omitempty"`
}

// ToWire translates a RecordActivityTaskStartedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RecordActivityTaskStartedRequest) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowExecution != nil {
		w, err = v.WorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ScheduleId != nil {
		w, err = wire.NewValueI64(*(v.ScheduleId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.TaskId != nil {
		w, err = wire.NewValueI64(*(v.TaskId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.RequestId != nil {
		w, err = wire.NewValueString(*(v.RequestId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 45, Value: w}
		i++
	}
	if v.PollRequest != nil {
		w, err = v.PollRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _PollForActivityTaskRequest_Read(w wire.Value) (*shared.PollForActivityTaskRequest, error) {
	var v shared.PollForActivityTaskRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RecordActivityTaskStartedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RecordActivityTaskStartedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RecordActivityTaskStartedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RecordActivityTaskStartedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduleId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.TaskId = &x
				if err != nil {
					return err
				}

			}
		case 45:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.RequestId = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TStruct {
				v.PollRequest, err = _PollForActivityTaskRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RecordActivityTaskStartedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RecordActivityTaskStartedRequest struct could not be encoded.
func (v *RecordActivityTaskStartedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduleId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduleId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.TaskId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.TaskId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.RequestId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 45, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.RequestId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PollRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.PollRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _PollForActivityTaskRequest_Decode(sr stream.Reader) (*shared.PollForActivityTaskRequest, error) {
	var v shared.PollForActivityTaskRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RecordActivityTaskStartedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RecordActivityTaskStartedRequest struct could not be generated from the wire
// representation.
func (v *RecordActivityTaskStartedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduleId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.TaskId = &x
			if err != nil {
				return err
			}

		case fh.ID == 45 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.RequestId = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TStruct:
			v.PollRequest, err = _PollForActivityTaskRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RecordActivityTaskStartedRequest
// struct.
func (v *RecordActivityTaskStartedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.WorkflowExecution != nil {
		fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution)
		i++
	}
	if v.ScheduleId != nil {
		fields[i] = fmt.Sprintf("ScheduleId: %v", *(v.ScheduleId))
		i++
	}
	if v.TaskId != nil {
		fields[i] = fmt.Sprintf("TaskId: %v", *(v.TaskId))
		i++
	}
	if v.RequestId != nil {
		fields[i] = fmt.Sprintf("RequestId: %v", *(v.RequestId))
		i++
	}
	if v.PollRequest != nil {
		fields[i] = fmt.Sprintf("PollRequest: %v", v.PollRequest)
		i++
	}

	return fmt.Sprintf("RecordActivityTaskStartedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RecordActivityTaskStartedRequest match the
// provided RecordActivityTaskStartedRequest.
//
// This function performs a deep comparison.
func (v *RecordActivityTaskStartedRequest) Equals(rhs *RecordActivityTaskStartedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduleId, rhs.ScheduleId) {
		return false
	}
	if !_I64_EqualsPtr(v.TaskId, rhs.TaskId) {
		return false
	}
	if !_String_EqualsPtr(v.RequestId, rhs.RequestId) {
		return false
	}
	if !((v.PollRequest == nil && rhs.PollRequest == nil) || (v.PollRequest != nil && rhs.PollRequest != nil && v.PollRequest.Equals(rhs.PollRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RecordActivityTaskStartedRequest.
func (v *RecordActivityTaskStartedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.WorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecution", v.WorkflowExecution))
	}
	if v.ScheduleId != nil {
		enc.AddInt64("scheduleId", *v.ScheduleId)
	}
	if v.TaskId != nil {
		enc.AddInt64("taskId", *v.TaskId)
	}
	if v.RequestId != nil {
		enc.AddString("requestId", *v.RequestId)
	}
	if v.PollRequest != nil {
		err = multierr.Append(err, enc.AddObject("pollRequest", v.PollRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RecordActivityTaskStartedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetWorkflowExecution returns the value of WorkflowExecution if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedRequest) GetWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.WorkflowExecution != nil {
		return v.WorkflowExecution
	}

	return
}

// IsSetWorkflowExecution returns true if WorkflowExecution is not nil.
func (v *RecordActivityTaskStartedRequest) IsSetWorkflowExecution() bool {
	return v != nil && v.WorkflowExecution != nil
}

// GetScheduleId returns the value of ScheduleId if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedRequest) GetScheduleId() (o int64) {
	if v != nil && v.ScheduleId != nil {
		return *v.ScheduleId
	}

	return
}

// IsSetScheduleId returns true if ScheduleId is not nil.
func (v *RecordActivityTaskStartedRequest) IsSetScheduleId() bool {
	return v != nil && v.ScheduleId != nil
}

// GetTaskId returns the value of TaskId if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedRequest) GetTaskId() (o int64) {
	if v != nil && v.TaskId != nil {
		return *v.TaskId
	}

	return
}

// IsSetTaskId returns true if TaskId is not nil.
func (v *RecordActivityTaskStartedRequest) IsSetTaskId() bool {
	return v != nil && v.TaskId != nil
}

// GetRequestId returns the value of RequestId if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedRequest) GetRequestId() (o string) {
	if v != nil && v.RequestId != nil {
		return *v.RequestId
	}

	return
}

// IsSetRequestId returns true if RequestId is not nil.
func (v *RecordActivityTaskStartedRequest) IsSetRequestId() bool {
	return v != nil && v.RequestId != nil
}

// GetPollRequest returns the value of PollRequest if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedRequest) GetPollRequest() (o *shared.PollForActivityTaskRequest) {
	if v != nil && v.PollRequest != nil {
		return v.PollRequest
	}

	return
}

// IsSetPollRequest returns true if PollRequest is not nil.
func (v *RecordActivityTaskStartedRequest) IsSetPollRequest() bool {
	return v != nil && v.PollRequest != nil
}

type RecordActivityTaskStartedResponse struct {
	ScheduledEvent                  *shared.HistoryEvent `json:"scheduledEvent,omitempty"`
	StartedTimestamp                *int64               `json:"startedTimestamp,omitempty"`
	Attempt                         *int64               `json:"attempt,omitempty"`
	ScheduledTimestampOfThisAttempt *int64               `json:"scheduledTimestampOfThisAttempt,omitempty"`
	HeartbeatDetails                []byte               `json:"heartbeatDetails,omitempty"`
	WorkflowType                    *shared.WorkflowType `json:"workflowType,omitempty"`
	WorkflowDomain                  *string              `json:"workflowDomain,omitempty"`
}

// ToWire translates a RecordActivityTaskStartedResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RecordActivityTaskStartedResponse) ToWire() (wire.Value, error) {
	var (
		fields [7]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ScheduledEvent != nil {
		w, err = v.ScheduledEvent.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.StartedTimestamp != nil {
		w, err = wire.NewValueI64(*(v.StartedTimestamp)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.Attempt != nil {
		w, err = wire.NewValueI64(*(v.Attempt)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.ScheduledTimestampOfThisAttempt != nil {
		w, err = wire.NewValueI64(*(v.ScheduledTimestampOfThisAttempt)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.HeartbeatDetails != nil {
		w, err = wire.NewValueBinary(v.HeartbeatDetails), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.WorkflowType != nil {
		w, err = v.WorkflowType.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}
	if v.WorkflowDomain != nil {
		w, err = wire.NewValueString(*(v.WorkflowDomain)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 80, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _HistoryEvent_Read(w wire.Value) (*shared.HistoryEvent, error) {
	var v shared.HistoryEvent
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RecordActivityTaskStartedResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RecordActivityTaskStartedResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RecordActivityTaskStartedResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RecordActivityTaskStartedResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.ScheduledEvent, err = _HistoryEvent_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.StartedTimestamp = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.Attempt = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduledTimestampOfThisAttempt = &x
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TBinary {
				v.HeartbeatDetails, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 70:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowType, err = _WorkflowType_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 80:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.WorkflowDomain = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RecordActivityTaskStartedResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RecordActivityTaskStartedResponse struct could not be encoded.
func (v *RecordActivityTaskStartedResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ScheduledEvent != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ScheduledEvent.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartedTimestamp != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.StartedTimestamp)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Attempt != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.Attempt)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduledTimestampOfThisAttempt != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduledTimestampOfThisAttempt)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.HeartbeatDetails != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.HeartbeatDetails); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowType != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 70, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowType.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowDomain != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 80, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.WorkflowDomain)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _HistoryEvent_Decode(sr stream.Reader) (*shared.HistoryEvent, error) {
	var v shared.HistoryEvent
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RecordActivityTaskStartedResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RecordActivityTaskStartedResponse struct could not be generated from the wire
// representation.
func (v *RecordActivityTaskStartedResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.ScheduledEvent, err = _HistoryEvent_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.StartedTimestamp = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.Attempt = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduledTimestampOfThisAttempt = &x
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TBinary:
			v.HeartbeatDetails, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 70 && fh.Type == wire.TStruct:
			v.WorkflowType, err = _WorkflowType_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 80 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.WorkflowDomain = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RecordActivityTaskStartedResponse
// struct.
func (v *RecordActivityTaskStartedResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [7]string
	i := 0
	if v.ScheduledEvent != nil {
		fields[i] = fmt.Sprintf("ScheduledEvent: %v", v.ScheduledEvent)
		i++
	}
	if v.StartedTimestamp != nil {
		fields[i] = fmt.Sprintf("StartedTimestamp: %v", *(v.StartedTimestamp))
		i++
	}
	if v.Attempt != nil {
		fields[i] = fmt.Sprintf("Attempt: %v", *(v.Attempt))
		i++
	}
	if v.ScheduledTimestampOfThisAttempt != nil {
		fields[i] = fmt.Sprintf("ScheduledTimestampOfThisAttempt: %v", *(v.ScheduledTimestampOfThisAttempt))
		i++
	}
	if v.HeartbeatDetails != nil {
		fields[i] = fmt.Sprintf("HeartbeatDetails: %v", v.HeartbeatDetails)
		i++
	}
	if v.WorkflowType != nil {
		fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType)
		i++
	}
	if v.WorkflowDomain != nil {
		fields[i] = fmt.Sprintf("WorkflowDomain: %v", *(v.WorkflowDomain))
		i++
	}

	return fmt.Sprintf("RecordActivityTaskStartedResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RecordActivityTaskStartedResponse match the
// provided RecordActivityTaskStartedResponse.
//
// This function performs a deep comparison.
func (v *RecordActivityTaskStartedResponse) Equals(rhs *RecordActivityTaskStartedResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ScheduledEvent == nil && rhs.ScheduledEvent == nil) || (v.ScheduledEvent != nil && rhs.ScheduledEvent != nil && v.ScheduledEvent.Equals(rhs.ScheduledEvent))) {
		return false
	}
	if !_I64_EqualsPtr(v.StartedTimestamp, rhs.StartedTimestamp) {
		return false
	}
	if !_I64_EqualsPtr(v.Attempt, rhs.Attempt) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduledTimestampOfThisAttempt, rhs.ScheduledTimestampOfThisAttempt) {
		return false
	}
	if !((v.HeartbeatDetails == nil && rhs.HeartbeatDetails == nil) || (v.HeartbeatDetails != nil && rhs.HeartbeatDetails != nil && bytes.Equal(v.HeartbeatDetails, rhs.HeartbeatDetails))) {
		return false
	}
	if !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) {
		return false
	}
	if !_String_EqualsPtr(v.WorkflowDomain, rhs.WorkflowDomain) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RecordActivityTaskStartedResponse.
func (v *RecordActivityTaskStartedResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ScheduledEvent != nil {
		err = multierr.Append(err, enc.AddObject("scheduledEvent", v.ScheduledEvent))
	}
	if v.StartedTimestamp != nil {
		enc.AddInt64("startedTimestamp", *v.StartedTimestamp)
	}
	if v.Attempt != nil {
		enc.AddInt64("attempt", *v.Attempt)
	}
	if v.ScheduledTimestampOfThisAttempt != nil {
		enc.AddInt64("scheduledTimestampOfThisAttempt", *v.ScheduledTimestampOfThisAttempt)
	}
	if v.HeartbeatDetails != nil {
		enc.AddString("heartbeatDetails", base64.StdEncoding.EncodeToString(v.HeartbeatDetails))
	}
	if v.WorkflowType != nil {
		err = multierr.Append(err, enc.AddObject("workflowType", v.WorkflowType))
	}
	if v.WorkflowDomain != nil {
		enc.AddString("workflowDomain", *v.WorkflowDomain)
	}
	return err
}

// GetScheduledEvent returns the value of ScheduledEvent if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetScheduledEvent() (o *shared.HistoryEvent) {
	if v != nil && v.ScheduledEvent != nil {
		return v.ScheduledEvent
	}

	return
}

// IsSetScheduledEvent returns true if ScheduledEvent is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetScheduledEvent() bool {
	return v != nil && v.ScheduledEvent != nil
}

// GetStartedTimestamp returns the value of StartedTimestamp if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetStartedTimestamp() (o int64) {
	if v != nil && v.StartedTimestamp != nil {
		return *v.StartedTimestamp
	}

	return
}

// IsSetStartedTimestamp returns true if StartedTimestamp is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetStartedTimestamp() bool {
	return v != nil && v.StartedTimestamp != nil
}

// GetAttempt returns the value of Attempt if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetAttempt() (o int64) {
	if v != nil && v.Attempt != nil {
		return *v.Attempt
	}

	return
}

// IsSetAttempt returns true if Attempt is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetAttempt() bool {
	return v != nil && v.Attempt != nil
}

// GetScheduledTimestampOfThisAttempt returns the value of ScheduledTimestampOfThisAttempt if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetScheduledTimestampOfThisAttempt() (o int64) {
	if v != nil && v.ScheduledTimestampOfThisAttempt != nil {
		return *v.ScheduledTimestampOfThisAttempt
	}

	return
}

// IsSetScheduledTimestampOfThisAttempt returns true if ScheduledTimestampOfThisAttempt is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetScheduledTimestampOfThisAttempt() bool {
	return v != nil && v.ScheduledTimestampOfThisAttempt != nil
}

// GetHeartbeatDetails returns the value of HeartbeatDetails if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetHeartbeatDetails() (o []byte) {
	if v != nil && v.HeartbeatDetails != nil {
		return v.HeartbeatDetails
	}

	return
}

// IsSetHeartbeatDetails returns true if HeartbeatDetails is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetHeartbeatDetails() bool {
	return v != nil && v.HeartbeatDetails != nil
}

// GetWorkflowType returns the value of WorkflowType if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetWorkflowType() (o *shared.WorkflowType) {
	if v != nil && v.WorkflowType != nil {
		return v.WorkflowType
	}

	return
}

// IsSetWorkflowType returns true if WorkflowType is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetWorkflowType() bool {
	return v != nil && v.WorkflowType != nil
}

// GetWorkflowDomain returns the value of WorkflowDomain if it is set or its
// zero value if it is unset.
func (v *RecordActivityTaskStartedResponse) GetWorkflowDomain() (o string) {
	if v != nil && v.WorkflowDomain != nil {
		return *v.WorkflowDomain
	}

	return
}

// IsSetWorkflowDomain returns true if WorkflowDomain is not nil.
func (v *RecordActivityTaskStartedResponse) IsSetWorkflowDomain() bool {
	return v != nil && v.WorkflowDomain != nil
}

// RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow
// execution which started it.  When a child execution is completed it creates this request and calls the
// RecordChildExecutionCompleted API with the workflowExecution of parent.  It also sets the completedExecution of the
// child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when
// child creates multiple runs through ContinueAsNew before finally completing.
type RecordChildExecutionCompletedRequest struct {
	DomainUUID         *string                   `json:"domainUUID,omitempty"`
	WorkflowExecution  *shared.WorkflowExecution `json:"workflowExecution,omitempty"`
	InitiatedId        *int64                    `json:"initiatedId,omitempty"`
	CompletedExecution *shared.WorkflowExecution `json:"completedExecution,omitempty"`
	CompletionEvent    *shared.HistoryEvent      `json:"completionEvent,omitempty"`
	StartedId          *int64                    `json:"startedId,omitempty"`
}

// ToWire translates a RecordChildExecutionCompletedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RecordChildExecutionCompletedRequest) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowExecution != nil {
		w, err = v.WorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.InitiatedId != nil {
		w, err = wire.NewValueI64(*(v.InitiatedId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.CompletedExecution != nil {
		w, err = v.CompletedExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.CompletionEvent != nil {
		w, err = v.CompletionEvent.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.StartedId != nil {
		w, err = wire.NewValueI64(*(v.StartedId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a RecordChildExecutionCompletedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RecordChildExecutionCompletedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RecordChildExecutionCompletedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RecordChildExecutionCompletedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.InitiatedId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TStruct {
				v.CompletedExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TStruct {
				v.CompletionEvent, err = _HistoryEvent_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.StartedId = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RecordChildExecutionCompletedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RecordChildExecutionCompletedRequest struct could not be encoded.
func (v *RecordChildExecutionCompletedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InitiatedId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.InitiatedId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CompletedExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompletedExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CompletionEvent != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompletionEvent.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartedId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.StartedId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a RecordChildExecutionCompletedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RecordChildExecutionCompletedRequest struct could not be generated from the wire
// representation.
func (v *RecordChildExecutionCompletedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.InitiatedId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TStruct:
			v.CompletedExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TStruct:
			v.CompletionEvent, err = _HistoryEvent_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.StartedId = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RecordChildExecutionCompletedRequest
// struct.
func (v *RecordChildExecutionCompletedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.WorkflowExecution != nil {
		fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution)
		i++
	}
	if v.InitiatedId != nil {
		fields[i] = fmt.Sprintf("InitiatedId: %v", *(v.InitiatedId))
		i++
	}
	if v.CompletedExecution != nil {
		fields[i] = fmt.Sprintf("CompletedExecution: %v", v.CompletedExecution)
		i++
	}
	if v.CompletionEvent != nil {
		fields[i] = fmt.Sprintf("CompletionEvent: %v", v.CompletionEvent)
		i++
	}
	if v.StartedId != nil {
		fields[i] = fmt.Sprintf("StartedId: %v", *(v.StartedId))
		i++
	}

	return fmt.Sprintf("RecordChildExecutionCompletedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RecordChildExecutionCompletedRequest match the
// provided RecordChildExecutionCompletedRequest.
//
// This function performs a deep comparison.
func (v *RecordChildExecutionCompletedRequest) Equals(rhs *RecordChildExecutionCompletedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {
		return false
	}
	if !_I64_EqualsPtr(v.InitiatedId, rhs.InitiatedId) {
		return false
	}
	if !((v.CompletedExecution == nil && rhs.CompletedExecution == nil) || (v.CompletedExecution != nil && rhs.CompletedExecution != nil && v.CompletedExecution.Equals(rhs.CompletedExecution))) {
		return false
	}
	if !((v.CompletionEvent == nil && rhs.CompletionEvent == nil) || (v.CompletionEvent != nil && rhs.CompletionEvent != nil && v.CompletionEvent.Equals(rhs.CompletionEvent))) {
		return false
	}
	if !_I64_EqualsPtr(v.StartedId, rhs.StartedId) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RecordChildExecutionCompletedRequest.
func (v *RecordChildExecutionCompletedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.WorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecution", v.WorkflowExecution))
	}
	if v.InitiatedId != nil {
		enc.AddInt64("initiatedId", *v.InitiatedId)
	}
	if v.CompletedExecution != nil {
		err = multierr.Append(err, enc.AddObject("completedExecution", v.CompletedExecution))
	}
	if v.CompletionEvent != nil {
		err = multierr.Append(err, enc.AddObject("completionEvent", v.CompletionEvent))
	}
	if v.StartedId != nil {
		enc.AddInt64("startedId", *v.StartedId)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RecordChildExecutionCompletedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RecordChildExecutionCompletedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetWorkflowExecution returns the value of WorkflowExecution if it is set or its
// zero value if it is unset.
func (v *RecordChildExecutionCompletedRequest) GetWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.WorkflowExecution != nil {
		return v.WorkflowExecution
	}

	return
}

// IsSetWorkflowExecution returns true if WorkflowExecution is not nil.
func (v *RecordChildExecutionCompletedRequest) IsSetWorkflowExecution() bool {
	return v != nil && v.WorkflowExecution != nil
}

// GetInitiatedId returns the value of InitiatedId if it is set or its
// zero value if it is unset.
func (v *RecordChildExecutionCompletedRequest) GetInitiatedId() (o int64) {
	if v != nil && v.InitiatedId != nil {
		return *v.InitiatedId
	}

	return
}

// IsSetInitiatedId returns true if InitiatedId is not nil.
func (v *RecordChildExecutionCompletedRequest) IsSetInitiatedId() bool {
	return v != nil && v.InitiatedId != nil
}

// GetCompletedExecution returns the value of CompletedExecution if it is set or its
// zero value if it is unset.
func (v *RecordChildExecutionCompletedRequest) GetCompletedExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.CompletedExecution != nil {
		return v.CompletedExecution
	}

	return
}

// IsSetCompletedExecution returns true if CompletedExecution is not nil.
func (v *RecordChildExecutionCompletedRequest) IsSetCompletedExecution() bool {
	return v != nil && v.CompletedExecution != nil
}

// GetCompletionEvent returns the value of CompletionEvent if it is set or its
// zero value if it is unset.
func (v *RecordChildExecutionCompletedRequest) GetCompletionEvent() (o *shared.HistoryEvent) {
	if v != nil && v.CompletionEvent != nil {
		return v.CompletionEvent
	}

	return
}

// IsSetCompletionEvent returns true if CompletionEvent is not nil.
func (v *RecordChildExecutionCompletedRequest) IsSetCompletionEvent() bool {
	return v != nil && v.CompletionEvent != nil
}

// GetStartedId returns the value of StartedId if it is set or its
// zero value if it is unset.
func (v *RecordChildExecutionCompletedRequest) GetStartedId() (o int64) {
	if v != nil && v.StartedId != nil {
		return *v.StartedId
	}

	return
}

// IsSetStartedId returns true if StartedId is not nil.
func (v *RecordChildExecutionCompletedRequest) IsSetStartedId() bool {
	return v != nil && v.StartedId != nil
}

type RecordDecisionTaskStartedRequest struct {
	DomainUUID        *string                            `json:"domainUUID,omitempty"`
	WorkflowExecution *shared.WorkflowExecution          `json:"workflowExecution,omitempty"`
	ScheduleId        *int64                             `json:"scheduleId,omitempty"`
	TaskId            *int64                             `json:"taskId,omitempty"`
	RequestId         *string                            `json:"requestId,omitempty"`
	PollRequest       *shared.PollForDecisionTaskRequest `json:"pollRequest,omitempty"`
}

// ToWire translates a RecordDecisionTaskStartedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RecordDecisionTaskStartedRequest) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowExecution != nil {
		w, err = v.WorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ScheduleId != nil {
		w, err = wire.NewValueI64(*(v.ScheduleId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.TaskId != nil {
		w, err = wire.NewValueI64(*(v.TaskId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.RequestId != nil {
		w, err = wire.NewValueString(*(v.RequestId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 45, Value: w}
		i++
	}
	if v.PollRequest != nil {
		w, err = v.PollRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _PollForDecisionTaskRequest_Read(w wire.Value) (*shared.PollForDecisionTaskRequest, error) {
	var v shared.PollForDecisionTaskRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RecordDecisionTaskStartedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RecordDecisionTaskStartedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RecordDecisionTaskStartedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RecordDecisionTaskStartedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduleId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.TaskId = &x
				if err != nil {
					return err
				}

			}
		case 45:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.RequestId = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TStruct {
				v.PollRequest, err = _PollForDecisionTaskRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RecordDecisionTaskStartedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RecordDecisionTaskStartedRequest struct could not be encoded.
func (v *RecordDecisionTaskStartedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduleId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduleId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.TaskId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.TaskId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.RequestId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 45, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.RequestId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PollRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.PollRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _PollForDecisionTaskRequest_Decode(sr stream.Reader) (*shared.PollForDecisionTaskRequest, error) {
	var v shared.PollForDecisionTaskRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RecordDecisionTaskStartedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RecordDecisionTaskStartedRequest struct could not be generated from the wire
// representation.
func (v *RecordDecisionTaskStartedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduleId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.TaskId = &x
			if err != nil {
				return err
			}

		case fh.ID == 45 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.RequestId = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TStruct:
			v.PollRequest, err = _PollForDecisionTaskRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RecordDecisionTaskStartedRequest
// struct.
func (v *RecordDecisionTaskStartedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.WorkflowExecution != nil {
		fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution)
		i++
	}
	if v.ScheduleId != nil {
		fields[i] = fmt.Sprintf("ScheduleId: %v", *(v.ScheduleId))
		i++
	}
	if v.TaskId != nil {
		fields[i] = fmt.Sprintf("TaskId: %v", *(v.TaskId))
		i++
	}
	if v.RequestId != nil {
		fields[i] = fmt.Sprintf("RequestId: %v", *(v.RequestId))
		i++
	}
	if v.PollRequest != nil {
		fields[i] = fmt.Sprintf("PollRequest: %v", v.PollRequest)
		i++
	}

	return fmt.Sprintf("RecordDecisionTaskStartedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RecordDecisionTaskStartedRequest match the
// provided RecordDecisionTaskStartedRequest.
//
// This function performs a deep comparison.
func (v *RecordDecisionTaskStartedRequest) Equals(rhs *RecordDecisionTaskStartedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduleId, rhs.ScheduleId) {
		return false
	}
	if !_I64_EqualsPtr(v.TaskId, rhs.TaskId) {
		return false
	}
	if !_String_EqualsPtr(v.RequestId, rhs.RequestId) {
		return false
	}
	if !((v.PollRequest == nil && rhs.PollRequest == nil) || (v.PollRequest != nil && rhs.PollRequest != nil && v.PollRequest.Equals(rhs.PollRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RecordDecisionTaskStartedRequest.
func (v *RecordDecisionTaskStartedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.WorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecution", v.WorkflowExecution))
	}
	if v.ScheduleId != nil {
		enc.AddInt64("scheduleId", *v.ScheduleId)
	}
	if v.TaskId != nil {
		enc.AddInt64("taskId", *v.TaskId)
	}
	if v.RequestId != nil {
		enc.AddString("requestId", *v.RequestId)
	}
	if v.PollRequest != nil {
		err = multierr.Append(err, enc.AddObject("pollRequest", v.PollRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RecordDecisionTaskStartedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetWorkflowExecution returns the value of WorkflowExecution if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedRequest) GetWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.WorkflowExecution != nil {
		return v.WorkflowExecution
	}

	return
}

// IsSetWorkflowExecution returns true if WorkflowExecution is not nil.
func (v *RecordDecisionTaskStartedRequest) IsSetWorkflowExecution() bool {
	return v != nil && v.WorkflowExecution != nil
}

// GetScheduleId returns the value of ScheduleId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedRequest) GetScheduleId() (o int64) {
	if v != nil && v.ScheduleId != nil {
		return *v.ScheduleId
	}

	return
}

// IsSetScheduleId returns true if ScheduleId is not nil.
func (v *RecordDecisionTaskStartedRequest) IsSetScheduleId() bool {
	return v != nil && v.ScheduleId != nil
}

// GetTaskId returns the value of TaskId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedRequest) GetTaskId() (o int64) {
	if v != nil && v.TaskId != nil {
		return *v.TaskId
	}

	return
}

// IsSetTaskId returns true if TaskId is not nil.
func (v *RecordDecisionTaskStartedRequest) IsSetTaskId() bool {
	return v != nil && v.TaskId != nil
}

// GetRequestId returns the value of RequestId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedRequest) GetRequestId() (o string) {
	if v != nil && v.RequestId != nil {
		return *v.RequestId
	}

	return
}

// IsSetRequestId returns true if RequestId is not nil.
func (v *RecordDecisionTaskStartedRequest) IsSetRequestId() bool {
	return v != nil && v.RequestId != nil
}

// GetPollRequest returns the value of PollRequest if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedRequest) GetPollRequest() (o *shared.PollForDecisionTaskRequest) {
	if v != nil && v.PollRequest != nil {
		return v.PollRequest
	}

	return
}

// IsSetPollRequest returns true if PollRequest is not nil.
func (v *RecordDecisionTaskStartedRequest) IsSetPollRequest() bool {
	return v != nil && v.PollRequest != nil
}

type RecordDecisionTaskStartedResponse struct {
	WorkflowType              *shared.WorkflowType             `json:"workflowType,omitempty"`
	PreviousStartedEventId    *int64                           `json:"previousStartedEventId,omitempty"`
	ScheduledEventId          *int64                           `json:"scheduledEventId,omitempty"`
	StartedEventId            *int64                           `json:"startedEventId,omitempty"`
	NextEventId               *int64                           `json:"nextEventId,omitempty"`
	Attempt                   *int64                           `json:"attempt,omitempty"`
	StickyExecutionEnabled    *bool                            `json:"stickyExecutionEnabled,omitempty"`
	DecisionInfo              *shared.TransientDecisionInfo    `json:"decisionInfo,omitempty"`
	WorkflowExecutionTaskList *shared.TaskList                 `json:"WorkflowExecutionTaskList,omitempty"`
	EventStoreVersion         *int32                           `json:"eventStoreVersion,omitempty"`
	BranchToken               []byte                           `json:"branchToken,omitempty"`
	ScheduledTimestamp        *int64                           `json:"scheduledTimestamp,omitempty"`
	StartedTimestamp          *int64                           `json:"startedTimestamp,omitempty"`
	Queries                   map[string]*shared.WorkflowQuery `json:"queries,omitempty"`
	HistorySize               *int64                           `json:"historySize,omitempty"`
}

type _Map_String_WorkflowQuery_MapItemList map[string]*shared.WorkflowQuery

func (m _Map_String_WorkflowQuery_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*shared.WorkflowQuery', key [%v]: value is nil", k)
		}
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := v.ToWire()
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_WorkflowQuery_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_WorkflowQuery_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_WorkflowQuery_MapItemList) ValueType() wire.Type {
	return wire.TStruct
}

func (_Map_String_WorkflowQuery_MapItemList) Close() {}

// ToWire translates a RecordDecisionTaskStartedResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RecordDecisionTaskStartedResponse) ToWire() (wire.Value, error) {
	var (
		fields [15]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.WorkflowType != nil {
		w, err = v.WorkflowType.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.PreviousStartedEventId != nil {
		w, err = wire.NewValueI64(*(v.PreviousStartedEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ScheduledEventId != nil {
		w, err = wire.NewValueI64(*(v.ScheduledEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.StartedEventId != nil {
		w, err = wire.NewValueI64(*(v.StartedEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.NextEventId != nil {
		w, err = wire.NewValueI64(*(v.NextEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.Attempt != nil {
		w, err = wire.NewValueI64(*(v.Attempt)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.StickyExecutionEnabled != nil {
		w, err = wire.NewValueBool(*(v.StickyExecutionEnabled)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}
	if v.DecisionInfo != nil {
		w, err = v.DecisionInfo.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 80, Value: w}
		i++
	}
	if v.WorkflowExecutionTaskList != nil {
		w, err = v.WorkflowExecutionTaskList.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 90, Value: w}
		i++
	}
	if v.EventStoreVersion != nil {
		w, err = wire.NewValueI32(*(v.EventStoreVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 100, Value: w}
		i++
	}
	if v.BranchToken != nil {
		w, err = wire.NewValueBinary(v.BranchToken), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 110, Value: w}
		i++
	}
	if v.ScheduledTimestamp != nil {
		w, err = wire.NewValueI64(*(v.ScheduledTimestamp)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 120, Value: w}
		i++
	}
	if v.StartedTimestamp != nil {
		w, err = wire.NewValueI64(*(v.StartedTimestamp)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 130, Value: w}
		i++
	}
	if v.Queries != nil {
		w, err = wire.NewValueMap(_Map_String_WorkflowQuery_MapItemList(v.Queries)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 140, Value: w}
		i++
	}
	if v.HistorySize != nil {
		w, err = wire.NewValueI64(*(v.HistorySize)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 150, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _TransientDecisionInfo_Read(w wire.Value) (*shared.TransientDecisionInfo, error) {
	var v shared.TransientDecisionInfo
	err := v.FromWire(w)
	return &v, err
}

func _WorkflowQuery_Read(w wire.Value) (*shared.WorkflowQuery, error) {
	var v shared.WorkflowQuery
	err := v.FromWire(w)
	return &v, err
}

func _Map_String_WorkflowQuery_Read(m wire.MapItemList) (map[string]*shared.WorkflowQuery, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make(map[string]*shared.WorkflowQuery, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := _WorkflowQuery_Read(x.Value)
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a RecordDecisionTaskStartedResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RecordDecisionTaskStartedResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RecordDecisionTaskStartedResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RecordDecisionTaskStartedResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowType, err = _WorkflowType_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.PreviousStartedEventId = &x
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduledEventId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.StartedEventId = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.NextEventId = &x
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.Attempt = &x
				if err != nil {
					return err
				}

			}
		case 70:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.StickyExecutionEnabled = &x
				if err != nil {
					return err
				}

			}
		case 80:
			if field.Value.Type() == wire.TStruct {
				v.DecisionInfo, err = _TransientDecisionInfo_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 90:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionTaskList, err = _TaskList_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 100:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.EventStoreVersion = &x
				if err != nil {
					return err
				}

			}
		case 110:
			if field.Value.Type() == wire.TBinary {
				v.BranchToken, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 120:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduledTimestamp = &x
				if err != nil {
					return err
				}

			}
		case 130:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.StartedTimestamp = &x
				if err != nil {
					return err
				}

			}
		case 140:
			if field.Value.Type() == wire.TMap {
				v.Queries, err = _Map_String_WorkflowQuery_Read(field.Value.GetMap())
				if err != nil {
					return err
				}

			}
		case 150:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.HistorySize = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _Map_String_WorkflowQuery_Encode(val map[string]*shared.WorkflowQuery, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TStruct,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*shared.WorkflowQuery', key [%v]: value is nil", k)
		}
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a RecordDecisionTaskStartedResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RecordDecisionTaskStartedResponse struct could not be encoded.
func (v *RecordDecisionTaskStartedResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.WorkflowType != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowType.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PreviousStartedEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.PreviousStartedEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduledEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduledEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartedEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.StartedEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.NextEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.NextEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Attempt != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.Attempt)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StickyExecutionEnabled != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 70, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.StickyExecutionEnabled)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DecisionInfo != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 80, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DecisionInfo.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionTaskList != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 90, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionTaskList.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EventStoreVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 100, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.EventStoreVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BranchToken != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 110, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.BranchToken); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduledTimestamp != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 120, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduledTimestamp)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartedTimestamp != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 130, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.StartedTimestamp)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Queries != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 140, Type: wire.TMap}); err != nil {
			return err
		}
		if err := _Map_String_WorkflowQuery_Encode(v.Queries, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.HistorySize != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 150, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.HistorySize)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _TransientDecisionInfo_Decode(sr stream.Reader) (*shared.TransientDecisionInfo, error) {
	var v shared.TransientDecisionInfo
	err := v.Decode(sr)
	return &v, err
}

func _WorkflowQuery_Decode(sr stream.Reader) (*shared.WorkflowQuery, error) {
	var v shared.WorkflowQuery
	err := v.Decode(sr)
	return &v, err
}

func _Map_String_WorkflowQuery_Decode(sr stream.Reader) (map[string]*shared.WorkflowQuery, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TStruct {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string]*shared.WorkflowQuery, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := _WorkflowQuery_Decode(sr)
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a RecordDecisionTaskStartedResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RecordDecisionTaskStartedResponse struct could not be generated from the wire
// representation.
func (v *RecordDecisionTaskStartedResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.WorkflowType, err = _WorkflowType_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.PreviousStartedEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduledEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.StartedEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.NextEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.Attempt = &x
			if err != nil {
				return err
			}

		case fh.ID == 70 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.StickyExecutionEnabled = &x
			if err != nil {
				return err
			}

		case fh.ID == 80 && fh.Type == wire.TStruct:
			v.DecisionInfo, err = _TransientDecisionInfo_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 90 && fh.Type == wire.TStruct:
			v.WorkflowExecutionTaskList, err = _TaskList_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 100 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.EventStoreVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 110 && fh.Type == wire.TBinary:
			v.BranchToken, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 120 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduledTimestamp = &x
			if err != nil {
				return err
			}

		case fh.ID == 130 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.StartedTimestamp = &x
			if err != nil {
				return err
			}

		case fh.ID == 140 && fh.Type == wire.TMap:
			v.Queries, err = _Map_String_WorkflowQuery_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 150 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.HistorySize = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RecordDecisionTaskStartedResponse
// struct.
func (v *RecordDecisionTaskStartedResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [15]string
	i := 0
	if v.WorkflowType != nil {
		fields[i] = fmt.Sprintf("WorkflowType: %v", v.WorkflowType)
		i++
	}
	if v.PreviousStartedEventId != nil {
		fields[i] = fmt.Sprintf("PreviousStartedEventId: %v", *(v.PreviousStartedEventId))
		i++
	}
	if v.ScheduledEventId != nil {
		fields[i] = fmt.Sprintf("ScheduledEventId: %v", *(v.ScheduledEventId))
		i++
	}
	if v.StartedEventId != nil {
		fields[i] = fmt.Sprintf("StartedEventId: %v", *(v.StartedEventId))
		i++
	}
	if v.NextEventId != nil {
		fields[i] = fmt.Sprintf("NextEventId: %v", *(v.NextEventId))
		i++
	}
	if v.Attempt != nil {
		fields[i] = fmt.Sprintf("Attempt: %v", *(v.Attempt))
		i++
	}
	if v.StickyExecutionEnabled != nil {
		fields[i] = fmt.Sprintf("StickyExecutionEnabled: %v", *(v.StickyExecutionEnabled))
		i++
	}
	if v.DecisionInfo != nil {
		fields[i] = fmt.Sprintf("DecisionInfo: %v", v.DecisionInfo)
		i++
	}
	if v.WorkflowExecutionTaskList != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionTaskList: %v", v.WorkflowExecutionTaskList)
		i++
	}
	if v.EventStoreVersion != nil {
		fields[i] = fmt.Sprintf("EventStoreVersion: %v", *(v.EventStoreVersion))
		i++
	}
	if v.BranchToken != nil {
		fields[i] = fmt.Sprintf("BranchToken: %v", v.BranchToken)
		i++
	}
	if v.ScheduledTimestamp != nil {
		fields[i] = fmt.Sprintf("ScheduledTimestamp: %v", *(v.ScheduledTimestamp))
		i++
	}
	if v.StartedTimestamp != nil {
		fields[i] = fmt.Sprintf("StartedTimestamp: %v", *(v.StartedTimestamp))
		i++
	}
	if v.Queries != nil {
		fields[i] = fmt.Sprintf("Queries: %v", v.Queries)
		i++
	}
	if v.HistorySize != nil {
		fields[i] = fmt.Sprintf("HistorySize: %v", *(v.HistorySize))
		i++
	}

	return fmt.Sprintf("RecordDecisionTaskStartedResponse{%v}", strings.Join(fields[:i], ", "))
}

func _Map_String_WorkflowQuery_Equals(lhs, rhs map[string]*shared.WorkflowQuery) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !lv.Equals(rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this RecordDecisionTaskStartedResponse match the
// provided RecordDecisionTaskStartedResponse.
//
// This function performs a deep comparison.
func (v *RecordDecisionTaskStartedResponse) Equals(rhs *RecordDecisionTaskStartedResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.WorkflowType == nil && rhs.WorkflowType == nil) || (v.WorkflowType != nil && rhs.WorkflowType != nil && v.WorkflowType.Equals(rhs.WorkflowType))) {
		return false
	}
	if !_I64_EqualsPtr(v.PreviousStartedEventId, rhs.PreviousStartedEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduledEventId, rhs.ScheduledEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.StartedEventId, rhs.StartedEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.NextEventId, rhs.NextEventId) {
		return false
	}
	if !_I64_EqualsPtr(v.Attempt, rhs.Attempt) {
		return false
	}
	if !_Bool_EqualsPtr(v.StickyExecutionEnabled, rhs.StickyExecutionEnabled) {
		return false
	}
	if !((v.DecisionInfo == nil && rhs.DecisionInfo == nil) || (v.DecisionInfo != nil && rhs.DecisionInfo != nil && v.DecisionInfo.Equals(rhs.DecisionInfo))) {
		return false
	}
	if !((v.WorkflowExecutionTaskList == nil && rhs.WorkflowExecutionTaskList == nil) || (v.WorkflowExecutionTaskList != nil && rhs.WorkflowExecutionTaskList != nil && v.WorkflowExecutionTaskList.Equals(rhs.WorkflowExecutionTaskList))) {
		return false
	}
	if !_I32_EqualsPtr(v.EventStoreVersion, rhs.EventStoreVersion) {
		return false
	}
	if !((v.BranchToken == nil && rhs.BranchToken == nil) || (v.BranchToken != nil && rhs.BranchToken != nil && bytes.Equal(v.BranchToken, rhs.BranchToken))) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduledTimestamp, rhs.ScheduledTimestamp) {
		return false
	}
	if !_I64_EqualsPtr(v.StartedTimestamp, rhs.StartedTimestamp) {
		return false
	}
	if !((v.Queries == nil && rhs.Queries == nil) || (v.Queries != nil && rhs.Queries != nil && _Map_String_WorkflowQuery_Equals(v.Queries, rhs.Queries))) {
		return false
	}
	if !_I64_EqualsPtr(v.HistorySize, rhs.HistorySize) {
		return false
	}

	return true
}

type _Map_String_WorkflowQuery_Zapper map[string]*shared.WorkflowQuery

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_WorkflowQuery_Zapper.
func (m _Map_String_WorkflowQuery_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		err = multierr.Append(err, enc.AddObject((string)(k), v))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RecordDecisionTaskStartedResponse.
func (v *RecordDecisionTaskStartedResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.WorkflowType != nil {
		err = multierr.Append(err, enc.AddObject("workflowType", v.WorkflowType))
	}
	if v.PreviousStartedEventId != nil {
		enc.AddInt64("previousStartedEventId", *v.PreviousStartedEventId)
	}
	if v.ScheduledEventId != nil {
		enc.AddInt64("scheduledEventId", *v.ScheduledEventId)
	}
	if v.StartedEventId != nil {
		enc.AddInt64("startedEventId", *v.StartedEventId)
	}
	if v.NextEventId != nil {
		enc.AddInt64("nextEventId", *v.NextEventId)
	}
	if v.Attempt != nil {
		enc.AddInt64("attempt", *v.Attempt)
	}
	if v.StickyExecutionEnabled != nil {
		enc.AddBool("stickyExecutionEnabled", *v.StickyExecutionEnabled)
	}
	if v.DecisionInfo != nil {
		err = multierr.Append(err, enc.AddObject("decisionInfo", v.DecisionInfo))
	}
	if v.WorkflowExecutionTaskList != nil {
		err = multierr.Append(err, enc.AddObject("WorkflowExecutionTaskList", v.WorkflowExecutionTaskList))
	}
	if v.EventStoreVersion != nil {
		enc.AddInt32("eventStoreVersion", *v.EventStoreVersion)
	}
	if v.BranchToken != nil {
		enc.AddString("branchToken", base64.StdEncoding.EncodeToString(v.BranchToken))
	}
	if v.ScheduledTimestamp != nil {
		enc.AddInt64("scheduledTimestamp", *v.ScheduledTimestamp)
	}
	if v.StartedTimestamp != nil {
		enc.AddInt64("startedTimestamp", *v.StartedTimestamp)
	}
	if v.Queries != nil {
		err = multierr.Append(err, enc.AddObject("queries", (_Map_String_WorkflowQuery_Zapper)(v.Queries)))
	}
	if v.HistorySize != nil {
		enc.AddInt64("historySize", *v.HistorySize)
	}
	return err
}

// GetWorkflowType returns the value of WorkflowType if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetWorkflowType() (o *shared.WorkflowType) {
	if v != nil && v.WorkflowType != nil {
		return v.WorkflowType
	}

	return
}

// IsSetWorkflowType returns true if WorkflowType is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetWorkflowType() bool {
	return v != nil && v.WorkflowType != nil
}

// GetPreviousStartedEventId returns the value of PreviousStartedEventId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetPreviousStartedEventId() (o int64) {
	if v != nil && v.PreviousStartedEventId != nil {
		return *v.PreviousStartedEventId
	}

	return
}

// IsSetPreviousStartedEventId returns true if PreviousStartedEventId is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetPreviousStartedEventId() bool {
	return v != nil && v.PreviousStartedEventId != nil
}

// GetScheduledEventId returns the value of ScheduledEventId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetScheduledEventId() (o int64) {
	if v != nil && v.ScheduledEventId != nil {
		return *v.ScheduledEventId
	}

	return
}

// IsSetScheduledEventId returns true if ScheduledEventId is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetScheduledEventId() bool {
	return v != nil && v.ScheduledEventId != nil
}

// GetStartedEventId returns the value of StartedEventId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetStartedEventId() (o int64) {
	if v != nil && v.StartedEventId != nil {
		return *v.StartedEventId
	}

	return
}

// IsSetStartedEventId returns true if StartedEventId is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetStartedEventId() bool {
	return v != nil && v.StartedEventId != nil
}

// GetNextEventId returns the value of NextEventId if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetNextEventId() (o int64) {
	if v != nil && v.NextEventId != nil {
		return *v.NextEventId
	}

	return
}

// IsSetNextEventId returns true if NextEventId is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetNextEventId() bool {
	return v != nil && v.NextEventId != nil
}

// GetAttempt returns the value of Attempt if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetAttempt() (o int64) {
	if v != nil && v.Attempt != nil {
		return *v.Attempt
	}

	return
}

// IsSetAttempt returns true if Attempt is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetAttempt() bool {
	return v != nil && v.Attempt != nil
}

// GetStickyExecutionEnabled returns the value of StickyExecutionEnabled if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetStickyExecutionEnabled() (o bool) {
	if v != nil && v.StickyExecutionEnabled != nil {
		return *v.StickyExecutionEnabled
	}

	return
}

// IsSetStickyExecutionEnabled returns true if StickyExecutionEnabled is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetStickyExecutionEnabled() bool {
	return v != nil && v.StickyExecutionEnabled != nil
}

// GetDecisionInfo returns the value of DecisionInfo if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetDecisionInfo() (o *shared.TransientDecisionInfo) {
	if v != nil && v.DecisionInfo != nil {
		return v.DecisionInfo
	}

	return
}

// IsSetDecisionInfo returns true if DecisionInfo is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetDecisionInfo() bool {
	return v != nil && v.DecisionInfo != nil
}

// GetWorkflowExecutionTaskList returns the value of WorkflowExecutionTaskList if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetWorkflowExecutionTaskList() (o *shared.TaskList) {
	if v != nil && v.WorkflowExecutionTaskList != nil {
		return v.WorkflowExecutionTaskList
	}

	return
}

// IsSetWorkflowExecutionTaskList returns true if WorkflowExecutionTaskList is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetWorkflowExecutionTaskList() bool {
	return v != nil && v.WorkflowExecutionTaskList != nil
}

// GetEventStoreVersion returns the value of EventStoreVersion if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetEventStoreVersion() (o int32) {
	if v != nil && v.EventStoreVersion != nil {
		return *v.EventStoreVersion
	}

	return
}

// IsSetEventStoreVersion returns true if EventStoreVersion is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetEventStoreVersion() bool {
	return v != nil && v.EventStoreVersion != nil
}

// GetBranchToken returns the value of BranchToken if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetBranchToken() (o []byte) {
	if v != nil && v.BranchToken != nil {
		return v.BranchToken
	}

	return
}

// IsSetBranchToken returns true if BranchToken is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetBranchToken() bool {
	return v != nil && v.BranchToken != nil
}

// GetScheduledTimestamp returns the value of ScheduledTimestamp if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetScheduledTimestamp() (o int64) {
	if v != nil && v.ScheduledTimestamp != nil {
		return *v.ScheduledTimestamp
	}

	return
}

// IsSetScheduledTimestamp returns true if ScheduledTimestamp is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetScheduledTimestamp() bool {
	return v != nil && v.ScheduledTimestamp != nil
}

// GetStartedTimestamp returns the value of StartedTimestamp if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetStartedTimestamp() (o int64) {
	if v != nil && v.StartedTimestamp != nil {
		return *v.StartedTimestamp
	}

	return
}

// IsSetStartedTimestamp returns true if StartedTimestamp is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetStartedTimestamp() bool {
	return v != nil && v.StartedTimestamp != nil
}

// GetQueries returns the value of Queries if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetQueries() (o map[string]*shared.WorkflowQuery) {
	if v != nil && v.Queries != nil {
		return v.Queries
	}

	return
}

// IsSetQueries returns true if Queries is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetQueries() bool {
	return v != nil && v.Queries != nil
}

// GetHistorySize returns the value of HistorySize if it is set or its
// zero value if it is unset.
func (v *RecordDecisionTaskStartedResponse) GetHistorySize() (o int64) {
	if v != nil && v.HistorySize != nil {
		return *v.HistorySize
	}

	return
}

// IsSetHistorySize returns true if HistorySize is not nil.
func (v *RecordDecisionTaskStartedResponse) IsSetHistorySize() bool {
	return v != nil && v.HistorySize != nil
}

type RefreshWorkflowTasksRequest struct {
	DomainUIID *string                             `json:"domainUIID,omitempty"`
	Request    *shared.RefreshWorkflowTasksRequest `json:"request,omitempty"`
}

// ToWire translates a RefreshWorkflowTasksRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RefreshWorkflowTasksRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUIID != nil {
		w, err = wire.NewValueString(*(v.DomainUIID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RefreshWorkflowTasksRequest_Read(w wire.Value) (*shared.RefreshWorkflowTasksRequest, error) {
	var v shared.RefreshWorkflowTasksRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RefreshWorkflowTasksRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RefreshWorkflowTasksRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RefreshWorkflowTasksRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RefreshWorkflowTasksRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUIID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _RefreshWorkflowTasksRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RefreshWorkflowTasksRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RefreshWorkflowTasksRequest struct could not be encoded.
func (v *RefreshWorkflowTasksRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUIID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUIID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RefreshWorkflowTasksRequest_Decode(sr stream.Reader) (*shared.RefreshWorkflowTasksRequest, error) {
	var v shared.RefreshWorkflowTasksRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RefreshWorkflowTasksRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RefreshWorkflowTasksRequest struct could not be generated from the wire
// representation.
func (v *RefreshWorkflowTasksRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUIID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Request, err = _RefreshWorkflowTasksRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RefreshWorkflowTasksRequest
// struct.
func (v *RefreshWorkflowTasksRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUIID != nil {
		fields[i] = fmt.Sprintf("DomainUIID: %v", *(v.DomainUIID))
		i++
	}
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("RefreshWorkflowTasksRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RefreshWorkflowTasksRequest match the
// provided RefreshWorkflowTasksRequest.
//
// This function performs a deep comparison.
func (v *RefreshWorkflowTasksRequest) Equals(rhs *RefreshWorkflowTasksRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUIID, rhs.DomainUIID) {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RefreshWorkflowTasksRequest.
func (v *RefreshWorkflowTasksRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUIID != nil {
		enc.AddString("domainUIID", *v.DomainUIID)
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetDomainUIID returns the value of DomainUIID if it is set or its
// zero value if it is unset.
func (v *RefreshWorkflowTasksRequest) GetDomainUIID() (o string) {
	if v != nil && v.DomainUIID != nil {
		return *v.DomainUIID
	}

	return
}

// IsSetDomainUIID returns true if DomainUIID is not nil.
func (v *RefreshWorkflowTasksRequest) IsSetDomainUIID() bool {
	return v != nil && v.DomainUIID != nil
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *RefreshWorkflowTasksRequest) GetRequest() (o *shared.RefreshWorkflowTasksRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *RefreshWorkflowTasksRequest) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

type RemoveSignalMutableStateRequest struct {
	DomainUUID        *string                   `json:"domainUUID,omitempty"`
	WorkflowExecution *shared.WorkflowExecution `json:"workflowExecution,omitempty"`
	RequestId         *string                   `json:"requestId,omitempty"`
}

// ToWire translates a RemoveSignalMutableStateRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RemoveSignalMutableStateRequest) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowExecution != nil {
		w, err = v.WorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.RequestId != nil {
		w, err = wire.NewValueString(*(v.RequestId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a RemoveSignalMutableStateRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RemoveSignalMutableStateRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RemoveSignalMutableStateRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RemoveSignalMutableStateRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.RequestId = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RemoveSignalMutableStateRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RemoveSignalMutableStateRequest struct could not be encoded.
func (v *RemoveSignalMutableStateRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.RequestId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.RequestId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a RemoveSignalMutableStateRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RemoveSignalMutableStateRequest struct could not be generated from the wire
// representation.
func (v *RemoveSignalMutableStateRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.RequestId = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RemoveSignalMutableStateRequest
// struct.
func (v *RemoveSignalMutableStateRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.WorkflowExecution != nil {
		fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution)
		i++
	}
	if v.RequestId != nil {
		fields[i] = fmt.Sprintf("RequestId: %v", *(v.RequestId))
		i++
	}

	return fmt.Sprintf("RemoveSignalMutableStateRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RemoveSignalMutableStateRequest match the
// provided RemoveSignalMutableStateRequest.
//
// This function performs a deep comparison.
func (v *RemoveSignalMutableStateRequest) Equals(rhs *RemoveSignalMutableStateRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {
		return false
	}
	if !_String_EqualsPtr(v.RequestId, rhs.RequestId) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RemoveSignalMutableStateRequest.
func (v *RemoveSignalMutableStateRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.WorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecution", v.WorkflowExecution))
	}
	if v.RequestId != nil {
		enc.AddString("requestId", *v.RequestId)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RemoveSignalMutableStateRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RemoveSignalMutableStateRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetWorkflowExecution returns the value of WorkflowExecution if it is set or its
// zero value if it is unset.
func (v *RemoveSignalMutableStateRequest) GetWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.WorkflowExecution != nil {
		return v.WorkflowExecution
	}

	return
}

// IsSetWorkflowExecution returns true if WorkflowExecution is not nil.
func (v *RemoveSignalMutableStateRequest) IsSetWorkflowExecution() bool {
	return v != nil && v.WorkflowExecution != nil
}

// GetRequestId returns the value of RequestId if it is set or its
// zero value if it is unset.
func (v *RemoveSignalMutableStateRequest) GetRequestId() (o string) {
	if v != nil && v.RequestId != nil {
		return *v.RequestId
	}

	return
}

// IsSetRequestId returns true if RequestId is not nil.
func (v *RemoveSignalMutableStateRequest) IsSetRequestId() bool {
	return v != nil && v.RequestId != nil
}

type ReplicateEventsV2Request struct {
	DomainUUID          *string                      `json:"domainUUID,omitempty"`
	WorkflowExecution   *shared.WorkflowExecution    `json:"workflowExecution,omitempty"`
	VersionHistoryItems []*shared.VersionHistoryItem `json:"versionHistoryItems,omitempty"`
	Events              *shared.DataBlob             `json:"events,omitempty"`
	NewRunEvents        *shared.DataBlob             `json:"newRunEvents,omitempty"`
}

type _List_VersionHistoryItem_ValueList []*shared.VersionHistoryItem

func (v _List_VersionHistoryItem_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*shared.VersionHistoryItem', index [%v]: value is nil", i)
		}
		w, err := x.ToWire()
		if err != nil {
			return err
		}
		err = f(w)
		if err != nil {
			return err
		}
	}
	return nil
}

func (v _List_VersionHistoryItem_ValueList) Size() int {
	return len(v)
}

func (_List_VersionHistoryItem_ValueList) ValueType() wire.Type {
	return wire.TStruct
}

func (_List_VersionHistoryItem_ValueList) Close() {}

// ToWire translates a ReplicateEventsV2Request struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ReplicateEventsV2Request) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowExecution != nil {
		w, err = v.WorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.VersionHistoryItems != nil {
		w, err = wire.NewValueList(_List_VersionHistoryItem_ValueList(v.VersionHistoryItems)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.Events != nil {
		w, err = v.Events.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.NewRunEvents != nil {
		w, err = v.NewRunEvents.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _List_VersionHistoryItem_Read(l wire.ValueList) ([]*shared.VersionHistoryItem, error) {
	if l.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make([]*shared.VersionHistoryItem, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _VersionHistoryItem_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}

func _DataBlob_Read(w wire.Value) (*shared.DataBlob, error) {
	var v shared.DataBlob
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a ReplicateEventsV2Request struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ReplicateEventsV2Request struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReplicateEventsV2Request
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReplicateEventsV2Request) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TList {
				v.VersionHistoryItems, err = _List_VersionHistoryItem_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TStruct {
				v.Events, err = _DataBlob_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TStruct {
				v.NewRunEvents, err = _DataBlob_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_VersionHistoryItem_Encode(val []*shared.VersionHistoryItem, sw stream.Writer) error {

	lh := stream.ListHeader{
		Type:   wire.TStruct,
		Length: len(val),
	}
	if err := sw.WriteListBegin(lh); err != nil {
		return err
	}

	for i, v := range val {
		if v == nil {
			return fmt.Errorf("invalid list '[]*shared.VersionHistoryItem', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

// Encode serializes a ReplicateEventsV2Request struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ReplicateEventsV2Request struct could not be encoded.
func (v *ReplicateEventsV2Request) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.VersionHistoryItems != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TList}); err != nil {
			return err
		}
		if err := _List_VersionHistoryItem_Encode(v.VersionHistoryItems, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Events != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Events.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.NewRunEvents != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.NewRunEvents.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _List_VersionHistoryItem_Decode(sr stream.Reader) ([]*shared.VersionHistoryItem, error) {
	lh, err := sr.ReadListBegin()
	if err != nil {
		return nil, err
	}

	if lh.Type != wire.TStruct {
		for i := 0; i < lh.Length; i++ {
			if err := sr.Skip(lh.Type); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadListEnd()
	}

	o := make([]*shared.VersionHistoryItem, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _VersionHistoryItem_Decode(sr)
		if err != nil {
			return nil, err
		}
		o = append(o, v)
	}

	if err = sr.ReadListEnd(); err != nil {
		return nil, err
	}
	return o, err
}

func _DataBlob_Decode(sr stream.Reader) (*shared.DataBlob, error) {
	var v shared.DataBlob
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a ReplicateEventsV2Request struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReplicateEventsV2Request struct could not be generated from the wire
// representation.
func (v *ReplicateEventsV2Request) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TList:
			v.VersionHistoryItems, err = _List_VersionHistoryItem_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TStruct:
			v.Events, err = _DataBlob_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TStruct:
			v.NewRunEvents, err = _DataBlob_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ReplicateEventsV2Request
// struct.
func (v *ReplicateEventsV2Request) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.WorkflowExecution != nil {
		fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution)
		i++
	}
	if v.VersionHistoryItems != nil {
		fields[i] = fmt.Sprintf("VersionHistoryItems: %v", v.VersionHistoryItems)
		i++
	}
	if v.Events != nil {
		fields[i] = fmt.Sprintf("Events: %v", v.Events)
		i++
	}
	if v.NewRunEvents != nil {
		fields[i] = fmt.Sprintf("NewRunEvents: %v", v.NewRunEvents)
		i++
	}

	return fmt.Sprintf("ReplicateEventsV2Request{%v}", strings.Join(fields[:i], ", "))
}

func _List_VersionHistoryItem_Equals(lhs, rhs []*shared.VersionHistoryItem) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for i, lv := range lhs {
		rv := rhs[i]
		if !lv.Equals(rv) {
			return false
		}
	}

	return true
}

// Equals returns true if all the fields of this ReplicateEventsV2Request match the
// provided ReplicateEventsV2Request.
//
// This function performs a deep comparison.
func (v *ReplicateEventsV2Request) Equals(rhs *ReplicateEventsV2Request) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {
		return false
	}
	if !((v.VersionHistoryItems == nil && rhs.VersionHistoryItems == nil) || (v.VersionHistoryItems != nil && rhs.VersionHistoryItems != nil && _List_VersionHistoryItem_Equals(v.VersionHistoryItems, rhs.VersionHistoryItems))) {
		return false
	}
	if !((v.Events == nil && rhs.Events == nil) || (v.Events != nil && rhs.Events != nil && v.Events.Equals(rhs.Events))) {
		return false
	}
	if !((v.NewRunEvents == nil && rhs.NewRunEvents == nil) || (v.NewRunEvents != nil && rhs.NewRunEvents != nil && v.NewRunEvents.Equals(rhs.NewRunEvents))) {
		return false
	}

	return true
}

type _List_VersionHistoryItem_Zapper []*shared.VersionHistoryItem

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_VersionHistoryItem_Zapper.
func (l _List_VersionHistoryItem_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for _, v := range l {
		err = multierr.Append(err, enc.AppendObject(v))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReplicateEventsV2Request.
func (v *ReplicateEventsV2Request) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.WorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecution", v.WorkflowExecution))
	}
	if v.VersionHistoryItems != nil {
		err = multierr.Append(err, enc.AddArray("versionHistoryItems", (_List_VersionHistoryItem_Zapper)(v.VersionHistoryItems)))
	}
	if v.Events != nil {
		err = multierr.Append(err, enc.AddObject("events", v.Events))
	}
	if v.NewRunEvents != nil {
		err = multierr.Append(err, enc.AddObject("newRunEvents", v.NewRunEvents))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *ReplicateEventsV2Request) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *ReplicateEventsV2Request) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetWorkflowExecution returns the value of WorkflowExecution if it is set or its
// zero value if it is unset.
func (v *ReplicateEventsV2Request) GetWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.WorkflowExecution != nil {
		return v.WorkflowExecution
	}

	return
}

// IsSetWorkflowExecution returns true if WorkflowExecution is not nil.
func (v *ReplicateEventsV2Request) IsSetWorkflowExecution() bool {
	return v != nil && v.WorkflowExecution != nil
}

// GetVersionHistoryItems returns the value of VersionHistoryItems if it is set or its
// zero value if it is unset.
func (v *ReplicateEventsV2Request) GetVersionHistoryItems() (o []*shared.VersionHistoryItem) {
	if v != nil && v.VersionHistoryItems != nil {
		return v.VersionHistoryItems
	}

	return
}

// IsSetVersionHistoryItems returns true if VersionHistoryItems is not nil.
func (v *ReplicateEventsV2Request) IsSetVersionHistoryItems() bool {
	return v != nil && v.VersionHistoryItems != nil
}

// GetEvents returns the value of Events if it is set or its
// zero value if it is unset.
func (v *ReplicateEventsV2Request) GetEvents() (o *shared.DataBlob) {
	if v != nil && v.Events != nil {
		return v.Events
	}

	return
}

// IsSetEvents returns true if Events is not nil.
func (v *ReplicateEventsV2Request) IsSetEvents() bool {
	return v != nil && v.Events != nil
}

// GetNewRunEvents returns the value of NewRunEvents if it is set or its
// zero value if it is unset.
func (v *ReplicateEventsV2Request) GetNewRunEvents() (o *shared.DataBlob) {
	if v != nil && v.NewRunEvents != nil {
		return v.NewRunEvents
	}

	return
}

// IsSetNewRunEvents returns true if NewRunEvents is not nil.
func (v *ReplicateEventsV2Request) IsSetNewRunEvents() bool {
	return v != nil && v.NewRunEvents != nil
}

type RequestCancelWorkflowExecutionRequest struct {
	DomainUUID                *string                                       `json:"domainUUID,omitempty"`
	CancelRequest             *shared.RequestCancelWorkflowExecutionRequest `json:"cancelRequest,omitempty"`
	ExternalInitiatedEventId  *int64                                        `json:"externalInitiatedEventId,omitempty"`
	ExternalWorkflowExecution *shared.WorkflowExecution                     `json:"externalWorkflowExecution,omitempty"`
	ChildWorkflowOnly         *bool                                         `json:"childWorkflowOnly,omitempty"`
}

// ToWire translates a RequestCancelWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RequestCancelWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.CancelRequest != nil {
		w, err = v.CancelRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ExternalInitiatedEventId != nil {
		w, err = wire.NewValueI64(*(v.ExternalInitiatedEventId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.ExternalWorkflowExecution != nil {
		w, err = v.ExternalWorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.ChildWorkflowOnly != nil {
		w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RequestCancelWorkflowExecutionRequest_Read(w wire.Value) (*shared.RequestCancelWorkflowExecutionRequest, error) {
	var v shared.RequestCancelWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RequestCancelWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RequestCancelWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RequestCancelWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RequestCancelWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.CancelRequest, err = _RequestCancelWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ExternalInitiatedEventId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TStruct {
				v.ExternalWorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.ChildWorkflowOnly = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RequestCancelWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RequestCancelWorkflowExecutionRequest struct could not be encoded.
func (v *RequestCancelWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CancelRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CancelRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExternalInitiatedEventId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ExternalInitiatedEventId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExternalWorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ExternalWorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ChildWorkflowOnly != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.ChildWorkflowOnly)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RequestCancelWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.RequestCancelWorkflowExecutionRequest, error) {
	var v shared.RequestCancelWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RequestCancelWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RequestCancelWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *RequestCancelWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.CancelRequest, err = _RequestCancelWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ExternalInitiatedEventId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TStruct:
			v.ExternalWorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.ChildWorkflowOnly = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RequestCancelWorkflowExecutionRequest
// struct.
func (v *RequestCancelWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.CancelRequest != nil {
		fields[i] = fmt.Sprintf("CancelRequest: %v", v.CancelRequest)
		i++
	}
	if v.ExternalInitiatedEventId != nil {
		fields[i] = fmt.Sprintf("ExternalInitiatedEventId: %v", *(v.ExternalInitiatedEventId))
		i++
	}
	if v.ExternalWorkflowExecution != nil {
		fields[i] = fmt.Sprintf("ExternalWorkflowExecution: %v", v.ExternalWorkflowExecution)
		i++
	}
	if v.ChildWorkflowOnly != nil {
		fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly))
		i++
	}

	return fmt.Sprintf("RequestCancelWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RequestCancelWorkflowExecutionRequest match the
// provided RequestCancelWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *RequestCancelWorkflowExecutionRequest) Equals(rhs *RequestCancelWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.CancelRequest == nil && rhs.CancelRequest == nil) || (v.CancelRequest != nil && rhs.CancelRequest != nil && v.CancelRequest.Equals(rhs.CancelRequest))) {
		return false
	}
	if !_I64_EqualsPtr(v.ExternalInitiatedEventId, rhs.ExternalInitiatedEventId) {
		return false
	}
	if !((v.ExternalWorkflowExecution == nil && rhs.ExternalWorkflowExecution == nil) || (v.ExternalWorkflowExecution != nil && rhs.ExternalWorkflowExecution != nil && v.ExternalWorkflowExecution.Equals(rhs.ExternalWorkflowExecution))) {
		return false
	}
	if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RequestCancelWorkflowExecutionRequest.
func (v *RequestCancelWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.CancelRequest != nil {
		err = multierr.Append(err, enc.AddObject("cancelRequest", v.CancelRequest))
	}
	if v.ExternalInitiatedEventId != nil {
		enc.AddInt64("externalInitiatedEventId", *v.ExternalInitiatedEventId)
	}
	if v.ExternalWorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("externalWorkflowExecution", v.ExternalWorkflowExecution))
	}
	if v.ChildWorkflowOnly != nil {
		enc.AddBool("childWorkflowOnly", *v.ChildWorkflowOnly)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RequestCancelWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RequestCancelWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetCancelRequest returns the value of CancelRequest if it is set or its
// zero value if it is unset.
func (v *RequestCancelWorkflowExecutionRequest) GetCancelRequest() (o *shared.RequestCancelWorkflowExecutionRequest) {
	if v != nil && v.CancelRequest != nil {
		return v.CancelRequest
	}

	return
}

// IsSetCancelRequest returns true if CancelRequest is not nil.
func (v *RequestCancelWorkflowExecutionRequest) IsSetCancelRequest() bool {
	return v != nil && v.CancelRequest != nil
}

// GetExternalInitiatedEventId returns the value of ExternalInitiatedEventId if it is set or its
// zero value if it is unset.
func (v *RequestCancelWorkflowExecutionRequest) GetExternalInitiatedEventId() (o int64) {
	if v != nil && v.ExternalInitiatedEventId != nil {
		return *v.ExternalInitiatedEventId
	}

	return
}

// IsSetExternalInitiatedEventId returns true if ExternalInitiatedEventId is not nil.
func (v *RequestCancelWorkflowExecutionRequest) IsSetExternalInitiatedEventId() bool {
	return v != nil && v.ExternalInitiatedEventId != nil
}

// GetExternalWorkflowExecution returns the value of ExternalWorkflowExecution if it is set or its
// zero value if it is unset.
func (v *RequestCancelWorkflowExecutionRequest) GetExternalWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.ExternalWorkflowExecution != nil {
		return v.ExternalWorkflowExecution
	}

	return
}

// IsSetExternalWorkflowExecution returns true if ExternalWorkflowExecution is not nil.
func (v *RequestCancelWorkflowExecutionRequest) IsSetExternalWorkflowExecution() bool {
	return v != nil && v.ExternalWorkflowExecution != nil
}

// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its
// zero value if it is unset.
func (v *RequestCancelWorkflowExecutionRequest) GetChildWorkflowOnly() (o bool) {
	if v != nil && v.ChildWorkflowOnly != nil {
		return *v.ChildWorkflowOnly
	}

	return
}

// IsSetChildWorkflowOnly returns true if ChildWorkflowOnly is not nil.
func (v *RequestCancelWorkflowExecutionRequest) IsSetChildWorkflowOnly() bool {
	return v != nil && v.ChildWorkflowOnly != nil
}

type ResetStickyTaskListRequest struct {
	DomainUUID *string                   `json:"domainUUID,omitempty"`
	Execution  *shared.WorkflowExecution `json:"execution,omitempty"`
}

// ToWire translates a ResetStickyTaskListRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ResetStickyTaskListRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Execution != nil {
		w, err = v.Execution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a ResetStickyTaskListRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ResetStickyTaskListRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ResetStickyTaskListRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ResetStickyTaskListRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.Execution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ResetStickyTaskListRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ResetStickyTaskListRequest struct could not be encoded.
func (v *ResetStickyTaskListRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Execution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Execution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a ResetStickyTaskListRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ResetStickyTaskListRequest struct could not be generated from the wire
// representation.
func (v *ResetStickyTaskListRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.Execution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ResetStickyTaskListRequest
// struct.
func (v *ResetStickyTaskListRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.Execution != nil {
		fields[i] = fmt.Sprintf("Execution: %v", v.Execution)
		i++
	}

	return fmt.Sprintf("ResetStickyTaskListRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ResetStickyTaskListRequest match the
// provided ResetStickyTaskListRequest.
//
// This function performs a deep comparison.
func (v *ResetStickyTaskListRequest) Equals(rhs *ResetStickyTaskListRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.Execution == nil && rhs.Execution == nil) || (v.Execution != nil && rhs.Execution != nil && v.Execution.Equals(rhs.Execution))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ResetStickyTaskListRequest.
func (v *ResetStickyTaskListRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.Execution != nil {
		err = multierr.Append(err, enc.AddObject("execution", v.Execution))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *ResetStickyTaskListRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *ResetStickyTaskListRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetExecution returns the value of Execution if it is set or its
// zero value if it is unset.
func (v *ResetStickyTaskListRequest) GetExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.Execution != nil {
		return v.Execution
	}

	return
}

// IsSetExecution returns true if Execution is not nil.
func (v *ResetStickyTaskListRequest) IsSetExecution() bool {
	return v != nil && v.Execution != nil
}

type ResetStickyTaskListResponse struct {
}

// ToWire translates a ResetStickyTaskListResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ResetStickyTaskListResponse) ToWire() (wire.Value, error) {
	var (
		fields [0]wire.Field
		i      int = 0
	)

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a ResetStickyTaskListResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ResetStickyTaskListResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ResetStickyTaskListResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ResetStickyTaskListResponse) FromWire(w wire.Value) error {

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		}
	}

	return nil
}

// Encode serializes a ResetStickyTaskListResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ResetStickyTaskListResponse struct could not be encoded.
func (v *ResetStickyTaskListResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a ResetStickyTaskListResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ResetStickyTaskListResponse struct could not be generated from the wire
// representation.
func (v *ResetStickyTaskListResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ResetStickyTaskListResponse
// struct.
func (v *ResetStickyTaskListResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [0]string
	i := 0

	return fmt.Sprintf("ResetStickyTaskListResponse{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ResetStickyTaskListResponse match the
// provided ResetStickyTaskListResponse.
//
// This function performs a deep comparison.
func (v *ResetStickyTaskListResponse) Equals(rhs *ResetStickyTaskListResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ResetStickyTaskListResponse.
func (v *ResetStickyTaskListResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	return err
}

type ResetWorkflowExecutionRequest struct {
	DomainUUID   *string                               `json:"domainUUID,omitempty"`
	ResetRequest *shared.ResetWorkflowExecutionRequest `json:"resetRequest,omitempty"`
}

// ToWire translates a ResetWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ResetWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ResetRequest != nil {
		w, err = v.ResetRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ResetWorkflowExecutionRequest_Read(w wire.Value) (*shared.ResetWorkflowExecutionRequest, error) {
	var v shared.ResetWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a ResetWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ResetWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ResetWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ResetWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.ResetRequest, err = _ResetWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ResetWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ResetWorkflowExecutionRequest struct could not be encoded.
func (v *ResetWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ResetRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ResetRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ResetWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.ResetWorkflowExecutionRequest, error) {
	var v shared.ResetWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a ResetWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ResetWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *ResetWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.ResetRequest, err = _ResetWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ResetWorkflowExecutionRequest
// struct.
func (v *ResetWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.ResetRequest != nil {
		fields[i] = fmt.Sprintf("ResetRequest: %v", v.ResetRequest)
		i++
	}

	return fmt.Sprintf("ResetWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ResetWorkflowExecutionRequest match the
// provided ResetWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *ResetWorkflowExecutionRequest) Equals(rhs *ResetWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.ResetRequest == nil && rhs.ResetRequest == nil) || (v.ResetRequest != nil && rhs.ResetRequest != nil && v.ResetRequest.Equals(rhs.ResetRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ResetWorkflowExecutionRequest.
func (v *ResetWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.ResetRequest != nil {
		err = multierr.Append(err, enc.AddObject("resetRequest", v.ResetRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *ResetWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *ResetWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetResetRequest returns the value of ResetRequest if it is set or its
// zero value if it is unset.
func (v *ResetWorkflowExecutionRequest) GetResetRequest() (o *shared.ResetWorkflowExecutionRequest) {
	if v != nil && v.ResetRequest != nil {
		return v.ResetRequest
	}

	return
}

// IsSetResetRequest returns true if ResetRequest is not nil.
func (v *ResetWorkflowExecutionRequest) IsSetResetRequest() bool {
	return v != nil && v.ResetRequest != nil
}

type RespondActivityTaskCanceledRequest struct {
	DomainUUID    *string                                    `json:"domainUUID,omitempty"`
	CancelRequest *shared.RespondActivityTaskCanceledRequest `json:"cancelRequest,omitempty"`
}

// ToWire translates a RespondActivityTaskCanceledRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RespondActivityTaskCanceledRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.CancelRequest != nil {
		w, err = v.CancelRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondActivityTaskCanceledRequest_Read(w wire.Value) (*shared.RespondActivityTaskCanceledRequest, error) {
	var v shared.RespondActivityTaskCanceledRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RespondActivityTaskCanceledRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RespondActivityTaskCanceledRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RespondActivityTaskCanceledRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RespondActivityTaskCanceledRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.CancelRequest, err = _RespondActivityTaskCanceledRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RespondActivityTaskCanceledRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RespondActivityTaskCanceledRequest struct could not be encoded.
func (v *RespondActivityTaskCanceledRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CancelRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CancelRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondActivityTaskCanceledRequest_Decode(sr stream.Reader) (*shared.RespondActivityTaskCanceledRequest, error) {
	var v shared.RespondActivityTaskCanceledRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RespondActivityTaskCanceledRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RespondActivityTaskCanceledRequest struct could not be generated from the wire
// representation.
func (v *RespondActivityTaskCanceledRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.CancelRequest, err = _RespondActivityTaskCanceledRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RespondActivityTaskCanceledRequest
// struct.
func (v *RespondActivityTaskCanceledRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.CancelRequest != nil {
		fields[i] = fmt.Sprintf("CancelRequest: %v", v.CancelRequest)
		i++
	}

	return fmt.Sprintf("RespondActivityTaskCanceledRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RespondActivityTaskCanceledRequest match the
// provided RespondActivityTaskCanceledRequest.
//
// This function performs a deep comparison.
func (v *RespondActivityTaskCanceledRequest) Equals(rhs *RespondActivityTaskCanceledRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.CancelRequest == nil && rhs.CancelRequest == nil) || (v.CancelRequest != nil && rhs.CancelRequest != nil && v.CancelRequest.Equals(rhs.CancelRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RespondActivityTaskCanceledRequest.
func (v *RespondActivityTaskCanceledRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.CancelRequest != nil {
		err = multierr.Append(err, enc.AddObject("cancelRequest", v.CancelRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RespondActivityTaskCanceledRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RespondActivityTaskCanceledRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetCancelRequest returns the value of CancelRequest if it is set or its
// zero value if it is unset.
func (v *RespondActivityTaskCanceledRequest) GetCancelRequest() (o *shared.RespondActivityTaskCanceledRequest) {
	if v != nil && v.CancelRequest != nil {
		return v.CancelRequest
	}

	return
}

// IsSetCancelRequest returns true if CancelRequest is not nil.
func (v *RespondActivityTaskCanceledRequest) IsSetCancelRequest() bool {
	return v != nil && v.CancelRequest != nil
}

type RespondActivityTaskCompletedRequest struct {
	DomainUUID      *string                                     `json:"domainUUID,omitempty"`
	CompleteRequest *shared.RespondActivityTaskCompletedRequest `json:"completeRequest,omitempty"`
}

// ToWire translates a RespondActivityTaskCompletedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RespondActivityTaskCompletedRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.CompleteRequest != nil {
		w, err = v.CompleteRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondActivityTaskCompletedRequest_Read(w wire.Value) (*shared.RespondActivityTaskCompletedRequest, error) {
	var v shared.RespondActivityTaskCompletedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RespondActivityTaskCompletedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RespondActivityTaskCompletedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RespondActivityTaskCompletedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RespondActivityTaskCompletedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.CompleteRequest, err = _RespondActivityTaskCompletedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RespondActivityTaskCompletedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RespondActivityTaskCompletedRequest struct could not be encoded.
func (v *RespondActivityTaskCompletedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CompleteRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompleteRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondActivityTaskCompletedRequest_Decode(sr stream.Reader) (*shared.RespondActivityTaskCompletedRequest, error) {
	var v shared.RespondActivityTaskCompletedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RespondActivityTaskCompletedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RespondActivityTaskCompletedRequest struct could not be generated from the wire
// representation.
func (v *RespondActivityTaskCompletedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.CompleteRequest, err = _RespondActivityTaskCompletedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RespondActivityTaskCompletedRequest
// struct.
func (v *RespondActivityTaskCompletedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.CompleteRequest != nil {
		fields[i] = fmt.Sprintf("CompleteRequest: %v", v.CompleteRequest)
		i++
	}

	return fmt.Sprintf("RespondActivityTaskCompletedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RespondActivityTaskCompletedRequest match the
// provided RespondActivityTaskCompletedRequest.
//
// This function performs a deep comparison.
func (v *RespondActivityTaskCompletedRequest) Equals(rhs *RespondActivityTaskCompletedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.CompleteRequest == nil && rhs.CompleteRequest == nil) || (v.CompleteRequest != nil && rhs.CompleteRequest != nil && v.CompleteRequest.Equals(rhs.CompleteRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RespondActivityTaskCompletedRequest.
func (v *RespondActivityTaskCompletedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.CompleteRequest != nil {
		err = multierr.Append(err, enc.AddObject("completeRequest", v.CompleteRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RespondActivityTaskCompletedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RespondActivityTaskCompletedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetCompleteRequest returns the value of CompleteRequest if it is set or its
// zero value if it is unset.
func (v *RespondActivityTaskCompletedRequest) GetCompleteRequest() (o *shared.RespondActivityTaskCompletedRequest) {
	if v != nil && v.CompleteRequest != nil {
		return v.CompleteRequest
	}

	return
}

// IsSetCompleteRequest returns true if CompleteRequest is not nil.
func (v *RespondActivityTaskCompletedRequest) IsSetCompleteRequest() bool {
	return v != nil && v.CompleteRequest != nil
}

type RespondActivityTaskFailedRequest struct {
	DomainUUID    *string                                  `json:"domainUUID,omitempty"`
	FailedRequest *shared.RespondActivityTaskFailedRequest `json:"failedRequest,omitempty"`
}

// ToWire translates a RespondActivityTaskFailedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RespondActivityTaskFailedRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.FailedRequest != nil {
		w, err = v.FailedRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondActivityTaskFailedRequest_Read(w wire.Value) (*shared.RespondActivityTaskFailedRequest, error) {
	var v shared.RespondActivityTaskFailedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RespondActivityTaskFailedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RespondActivityTaskFailedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RespondActivityTaskFailedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RespondActivityTaskFailedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.FailedRequest, err = _RespondActivityTaskFailedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RespondActivityTaskFailedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RespondActivityTaskFailedRequest struct could not be encoded.
func (v *RespondActivityTaskFailedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.FailedRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.FailedRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondActivityTaskFailedRequest_Decode(sr stream.Reader) (*shared.RespondActivityTaskFailedRequest, error) {
	var v shared.RespondActivityTaskFailedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RespondActivityTaskFailedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RespondActivityTaskFailedRequest struct could not be generated from the wire
// representation.
func (v *RespondActivityTaskFailedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.FailedRequest, err = _RespondActivityTaskFailedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RespondActivityTaskFailedRequest
// struct.
func (v *RespondActivityTaskFailedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.FailedRequest != nil {
		fields[i] = fmt.Sprintf("FailedRequest: %v", v.FailedRequest)
		i++
	}

	return fmt.Sprintf("RespondActivityTaskFailedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RespondActivityTaskFailedRequest match the
// provided RespondActivityTaskFailedRequest.
//
// This function performs a deep comparison.
func (v *RespondActivityTaskFailedRequest) Equals(rhs *RespondActivityTaskFailedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.FailedRequest == nil && rhs.FailedRequest == nil) || (v.FailedRequest != nil && rhs.FailedRequest != nil && v.FailedRequest.Equals(rhs.FailedRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RespondActivityTaskFailedRequest.
func (v *RespondActivityTaskFailedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.FailedRequest != nil {
		err = multierr.Append(err, enc.AddObject("failedRequest", v.FailedRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RespondActivityTaskFailedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RespondActivityTaskFailedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetFailedRequest returns the value of FailedRequest if it is set or its
// zero value if it is unset.
func (v *RespondActivityTaskFailedRequest) GetFailedRequest() (o *shared.RespondActivityTaskFailedRequest) {
	if v != nil && v.FailedRequest != nil {
		return v.FailedRequest
	}

	return
}

// IsSetFailedRequest returns true if FailedRequest is not nil.
func (v *RespondActivityTaskFailedRequest) IsSetFailedRequest() bool {
	return v != nil && v.FailedRequest != nil
}

type RespondDecisionTaskCompletedRequest struct {
	DomainUUID      *string                                     `json:"domainUUID,omitempty"`
	CompleteRequest *shared.RespondDecisionTaskCompletedRequest `json:"completeRequest,omitempty"`
}

// ToWire translates a RespondDecisionTaskCompletedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RespondDecisionTaskCompletedRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.CompleteRequest != nil {
		w, err = v.CompleteRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondDecisionTaskCompletedRequest_Read(w wire.Value) (*shared.RespondDecisionTaskCompletedRequest, error) {
	var v shared.RespondDecisionTaskCompletedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RespondDecisionTaskCompletedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RespondDecisionTaskCompletedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RespondDecisionTaskCompletedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RespondDecisionTaskCompletedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.CompleteRequest, err = _RespondDecisionTaskCompletedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RespondDecisionTaskCompletedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RespondDecisionTaskCompletedRequest struct could not be encoded.
func (v *RespondDecisionTaskCompletedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CompleteRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompleteRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondDecisionTaskCompletedRequest_Decode(sr stream.Reader) (*shared.RespondDecisionTaskCompletedRequest, error) {
	var v shared.RespondDecisionTaskCompletedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RespondDecisionTaskCompletedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RespondDecisionTaskCompletedRequest struct could not be generated from the wire
// representation.
func (v *RespondDecisionTaskCompletedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.CompleteRequest, err = _RespondDecisionTaskCompletedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RespondDecisionTaskCompletedRequest
// struct.
func (v *RespondDecisionTaskCompletedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.CompleteRequest != nil {
		fields[i] = fmt.Sprintf("CompleteRequest: %v", v.CompleteRequest)
		i++
	}

	return fmt.Sprintf("RespondDecisionTaskCompletedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RespondDecisionTaskCompletedRequest match the
// provided RespondDecisionTaskCompletedRequest.
//
// This function performs a deep comparison.
func (v *RespondDecisionTaskCompletedRequest) Equals(rhs *RespondDecisionTaskCompletedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.CompleteRequest == nil && rhs.CompleteRequest == nil) || (v.CompleteRequest != nil && rhs.CompleteRequest != nil && v.CompleteRequest.Equals(rhs.CompleteRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RespondDecisionTaskCompletedRequest.
func (v *RespondDecisionTaskCompletedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.CompleteRequest != nil {
		err = multierr.Append(err, enc.AddObject("completeRequest", v.CompleteRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RespondDecisionTaskCompletedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RespondDecisionTaskCompletedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetCompleteRequest returns the value of CompleteRequest if it is set or its
// zero value if it is unset.
func (v *RespondDecisionTaskCompletedRequest) GetCompleteRequest() (o *shared.RespondDecisionTaskCompletedRequest) {
	if v != nil && v.CompleteRequest != nil {
		return v.CompleteRequest
	}

	return
}

// IsSetCompleteRequest returns true if CompleteRequest is not nil.
func (v *RespondDecisionTaskCompletedRequest) IsSetCompleteRequest() bool {
	return v != nil && v.CompleteRequest != nil
}

type RespondDecisionTaskCompletedResponse struct {
	StartedResponse             *RecordDecisionTaskStartedResponse           `json:"startedResponse,omitempty"`
	ActivitiesToDispatchLocally map[string]*shared.ActivityLocalDispatchInfo `json:"activitiesToDispatchLocally,omitempty"`
}

type _Map_String_ActivityLocalDispatchInfo_MapItemList map[string]*shared.ActivityLocalDispatchInfo

func (m _Map_String_ActivityLocalDispatchInfo_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*shared.ActivityLocalDispatchInfo', key [%v]: value is nil", k)
		}
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := v.ToWire()
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_ActivityLocalDispatchInfo_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_ActivityLocalDispatchInfo_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_ActivityLocalDispatchInfo_MapItemList) ValueType() wire.Type {
	return wire.TStruct
}

func (_Map_String_ActivityLocalDispatchInfo_MapItemList) Close() {}

// ToWire translates a RespondDecisionTaskCompletedResponse struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RespondDecisionTaskCompletedResponse) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.StartedResponse != nil {
		w, err = v.StartedResponse.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ActivitiesToDispatchLocally != nil {
		w, err = wire.NewValueMap(_Map_String_ActivityLocalDispatchInfo_MapItemList(v.ActivitiesToDispatchLocally)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordDecisionTaskStartedResponse_Read(w wire.Value) (*RecordDecisionTaskStartedResponse, error) {
	var v RecordDecisionTaskStartedResponse
	err := v.FromWire(w)
	return &v, err
}

func _ActivityLocalDispatchInfo_Read(w wire.Value) (*shared.ActivityLocalDispatchInfo, error) {
	var v shared.ActivityLocalDispatchInfo
	err := v.FromWire(w)
	return &v, err
}

func _Map_String_ActivityLocalDispatchInfo_Read(m wire.MapItemList) (map[string]*shared.ActivityLocalDispatchInfo, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make(map[string]*shared.ActivityLocalDispatchInfo, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := _ActivityLocalDispatchInfo_Read(x.Value)
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a RespondDecisionTaskCompletedResponse struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RespondDecisionTaskCompletedResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RespondDecisionTaskCompletedResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RespondDecisionTaskCompletedResponse) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.StartedResponse, err = _RecordDecisionTaskStartedResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TMap {
				v.ActivitiesToDispatchLocally, err = _Map_String_ActivityLocalDispatchInfo_Read(field.Value.GetMap())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _Map_String_ActivityLocalDispatchInfo_Encode(val map[string]*shared.ActivityLocalDispatchInfo, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TStruct,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*shared.ActivityLocalDispatchInfo', key [%v]: value is nil", k)
		}
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a RespondDecisionTaskCompletedResponse struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RespondDecisionTaskCompletedResponse struct could not be encoded.
func (v *RespondDecisionTaskCompletedResponse) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.StartedResponse != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.StartedResponse.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ActivitiesToDispatchLocally != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TMap}); err != nil {
			return err
		}
		if err := _Map_String_ActivityLocalDispatchInfo_Encode(v.ActivitiesToDispatchLocally, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RecordDecisionTaskStartedResponse_Decode(sr stream.Reader) (*RecordDecisionTaskStartedResponse, error) {
	var v RecordDecisionTaskStartedResponse
	err := v.Decode(sr)
	return &v, err
}

func _ActivityLocalDispatchInfo_Decode(sr stream.Reader) (*shared.ActivityLocalDispatchInfo, error) {
	var v shared.ActivityLocalDispatchInfo
	err := v.Decode(sr)
	return &v, err
}

func _Map_String_ActivityLocalDispatchInfo_Decode(sr stream.Reader) (map[string]*shared.ActivityLocalDispatchInfo, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TStruct {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string]*shared.ActivityLocalDispatchInfo, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := _ActivityLocalDispatchInfo_Decode(sr)
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a RespondDecisionTaskCompletedResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RespondDecisionTaskCompletedResponse struct could not be generated from the wire
// representation.
func (v *RespondDecisionTaskCompletedResponse) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.StartedResponse, err = _RecordDecisionTaskStartedResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TMap:
			v.ActivitiesToDispatchLocally, err = _Map_String_ActivityLocalDispatchInfo_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RespondDecisionTaskCompletedResponse
// struct.
func (v *RespondDecisionTaskCompletedResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.StartedResponse != nil {
		fields[i] = fmt.Sprintf("StartedResponse: %v", v.StartedResponse)
		i++
	}
	if v.ActivitiesToDispatchLocally != nil {
		fields[i] = fmt.Sprintf("ActivitiesToDispatchLocally: %v", v.ActivitiesToDispatchLocally)
		i++
	}

	return fmt.Sprintf("RespondDecisionTaskCompletedResponse{%v}", strings.Join(fields[:i], ", "))
}

func _Map_String_ActivityLocalDispatchInfo_Equals(lhs, rhs map[string]*shared.ActivityLocalDispatchInfo) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !lv.Equals(rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this RespondDecisionTaskCompletedResponse match the
// provided RespondDecisionTaskCompletedResponse.
//
// This function performs a deep comparison.
func (v *RespondDecisionTaskCompletedResponse) Equals(rhs *RespondDecisionTaskCompletedResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.StartedResponse == nil && rhs.StartedResponse == nil) || (v.StartedResponse != nil && rhs.StartedResponse != nil && v.StartedResponse.Equals(rhs.StartedResponse))) {
		return false
	}
	if !((v.ActivitiesToDispatchLocally == nil && rhs.ActivitiesToDispatchLocally == nil) || (v.ActivitiesToDispatchLocally != nil && rhs.ActivitiesToDispatchLocally != nil && _Map_String_ActivityLocalDispatchInfo_Equals(v.ActivitiesToDispatchLocally, rhs.ActivitiesToDispatchLocally))) {
		return false
	}

	return true
}

type _Map_String_ActivityLocalDispatchInfo_Zapper map[string]*shared.ActivityLocalDispatchInfo

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_ActivityLocalDispatchInfo_Zapper.
func (m _Map_String_ActivityLocalDispatchInfo_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		err = multierr.Append(err, enc.AddObject((string)(k), v))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RespondDecisionTaskCompletedResponse.
func (v *RespondDecisionTaskCompletedResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.StartedResponse != nil {
		err = multierr.Append(err, enc.AddObject("startedResponse", v.StartedResponse))
	}
	if v.ActivitiesToDispatchLocally != nil {
		err = multierr.Append(err, enc.AddObject("activitiesToDispatchLocally", (_Map_String_ActivityLocalDispatchInfo_Zapper)(v.ActivitiesToDispatchLocally)))
	}
	return err
}

// GetStartedResponse returns the value of StartedResponse if it is set or its
// zero value if it is unset.
func (v *RespondDecisionTaskCompletedResponse) GetStartedResponse() (o *RecordDecisionTaskStartedResponse) {
	if v != nil && v.StartedResponse != nil {
		return v.StartedResponse
	}

	return
}

// IsSetStartedResponse returns true if StartedResponse is not nil.
func (v *RespondDecisionTaskCompletedResponse) IsSetStartedResponse() bool {
	return v != nil && v.StartedResponse != nil
}

// GetActivitiesToDispatchLocally returns the value of ActivitiesToDispatchLocally if it is set or its
// zero value if it is unset.
func (v *RespondDecisionTaskCompletedResponse) GetActivitiesToDispatchLocally() (o map[string]*shared.ActivityLocalDispatchInfo) {
	if v != nil && v.ActivitiesToDispatchLocally != nil {
		return v.ActivitiesToDispatchLocally
	}

	return
}

// IsSetActivitiesToDispatchLocally returns true if ActivitiesToDispatchLocally is not nil.
func (v *RespondDecisionTaskCompletedResponse) IsSetActivitiesToDispatchLocally() bool {
	return v != nil && v.ActivitiesToDispatchLocally != nil
}

type RespondDecisionTaskFailedRequest struct {
	DomainUUID    *string                                  `json:"domainUUID,omitempty"`
	FailedRequest *shared.RespondDecisionTaskFailedRequest `json:"failedRequest,omitempty"`
}

// ToWire translates a RespondDecisionTaskFailedRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *RespondDecisionTaskFailedRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.FailedRequest != nil {
		w, err = v.FailedRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondDecisionTaskFailedRequest_Read(w wire.Value) (*shared.RespondDecisionTaskFailedRequest, error) {
	var v shared.RespondDecisionTaskFailedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a RespondDecisionTaskFailedRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a RespondDecisionTaskFailedRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v RespondDecisionTaskFailedRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *RespondDecisionTaskFailedRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.FailedRequest, err = _RespondDecisionTaskFailedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a RespondDecisionTaskFailedRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a RespondDecisionTaskFailedRequest struct could not be encoded.
func (v *RespondDecisionTaskFailedRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.FailedRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.FailedRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondDecisionTaskFailedRequest_Decode(sr stream.Reader) (*shared.RespondDecisionTaskFailedRequest, error) {
	var v shared.RespondDecisionTaskFailedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a RespondDecisionTaskFailedRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a RespondDecisionTaskFailedRequest struct could not be generated from the wire
// representation.
func (v *RespondDecisionTaskFailedRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.FailedRequest, err = _RespondDecisionTaskFailedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a RespondDecisionTaskFailedRequest
// struct.
func (v *RespondDecisionTaskFailedRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.FailedRequest != nil {
		fields[i] = fmt.Sprintf("FailedRequest: %v", v.FailedRequest)
		i++
	}

	return fmt.Sprintf("RespondDecisionTaskFailedRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this RespondDecisionTaskFailedRequest match the
// provided RespondDecisionTaskFailedRequest.
//
// This function performs a deep comparison.
func (v *RespondDecisionTaskFailedRequest) Equals(rhs *RespondDecisionTaskFailedRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.FailedRequest == nil && rhs.FailedRequest == nil) || (v.FailedRequest != nil && rhs.FailedRequest != nil && v.FailedRequest.Equals(rhs.FailedRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of RespondDecisionTaskFailedRequest.
func (v *RespondDecisionTaskFailedRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.FailedRequest != nil {
		err = multierr.Append(err, enc.AddObject("failedRequest", v.FailedRequest))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *RespondDecisionTaskFailedRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *RespondDecisionTaskFailedRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetFailedRequest returns the value of FailedRequest if it is set or its
// zero value if it is unset.
func (v *RespondDecisionTaskFailedRequest) GetFailedRequest() (o *shared.RespondDecisionTaskFailedRequest) {
	if v != nil && v.FailedRequest != nil {
		return v.FailedRequest
	}

	return
}

// IsSetFailedRequest returns true if FailedRequest is not nil.
func (v *RespondDecisionTaskFailedRequest) IsSetFailedRequest() bool {
	return v != nil && v.FailedRequest != nil
}

type ScheduleDecisionTaskRequest struct {
	DomainUUID        *string                   `json:"domainUUID,omitempty"`
	WorkflowExecution *shared.WorkflowExecution `json:"workflowExecution,omitempty"`
	IsFirstDecision   *bool                     `json:"isFirstDecision,omitempty"`
}

// ToWire translates a ScheduleDecisionTaskRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ScheduleDecisionTaskRequest) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowExecution != nil {
		w, err = v.WorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.IsFirstDecision != nil {
		w, err = wire.NewValueBool(*(v.IsFirstDecision)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a ScheduleDecisionTaskRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ScheduleDecisionTaskRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ScheduleDecisionTaskRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ScheduleDecisionTaskRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.IsFirstDecision = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ScheduleDecisionTaskRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ScheduleDecisionTaskRequest struct could not be encoded.
func (v *ScheduleDecisionTaskRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.IsFirstDecision != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.IsFirstDecision)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a ScheduleDecisionTaskRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ScheduleDecisionTaskRequest struct could not be generated from the wire
// representation.
func (v *ScheduleDecisionTaskRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.WorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.IsFirstDecision = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ScheduleDecisionTaskRequest
// struct.
func (v *ScheduleDecisionTaskRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.WorkflowExecution != nil {
		fields[i] = fmt.Sprintf("WorkflowExecution: %v", v.WorkflowExecution)
		i++
	}
	if v.IsFirstDecision != nil {
		fields[i] = fmt.Sprintf("IsFirstDecision: %v", *(v.IsFirstDecision))
		i++
	}

	return fmt.Sprintf("ScheduleDecisionTaskRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this ScheduleDecisionTaskRequest match the
// provided ScheduleDecisionTaskRequest.
//
// This function performs a deep comparison.
func (v *ScheduleDecisionTaskRequest) Equals(rhs *ScheduleDecisionTaskRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.WorkflowExecution == nil && rhs.WorkflowExecution == nil) || (v.WorkflowExecution != nil && rhs.WorkflowExecution != nil && v.WorkflowExecution.Equals(rhs.WorkflowExecution))) {
		return false
	}
	if !_Bool_EqualsPtr(v.IsFirstDecision, rhs.IsFirstDecision) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ScheduleDecisionTaskRequest.
func (v *ScheduleDecisionTaskRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.WorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecution", v.WorkflowExecution))
	}
	if v.IsFirstDecision != nil {
		enc.AddBool("isFirstDecision", *v.IsFirstDecision)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *ScheduleDecisionTaskRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *ScheduleDecisionTaskRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetWorkflowExecution returns the value of WorkflowExecution if it is set or its
// zero value if it is unset.
func (v *ScheduleDecisionTaskRequest) GetWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.WorkflowExecution != nil {
		return v.WorkflowExecution
	}

	return
}

// IsSetWorkflowExecution returns true if WorkflowExecution is not nil.
func (v *ScheduleDecisionTaskRequest) IsSetWorkflowExecution() bool {
	return v != nil && v.WorkflowExecution != nil
}

// GetIsFirstDecision returns the value of IsFirstDecision if it is set or its
// zero value if it is unset.
func (v *ScheduleDecisionTaskRequest) GetIsFirstDecision() (o bool) {
	if v != nil && v.IsFirstDecision != nil {
		return *v.IsFirstDecision
	}

	return
}

// IsSetIsFirstDecision returns true if IsFirstDecision is not nil.
func (v *ScheduleDecisionTaskRequest) IsSetIsFirstDecision() bool {
	return v != nil && v.IsFirstDecision != nil
}

type ShardOwnershipLostError struct {
	Message *string `json:"message,omitempty"`
	Owner   *string `json:"owner,omitempty"`
}

// ToWire translates a ShardOwnershipLostError struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *ShardOwnershipLostError) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Message != nil {
		w, err = wire.NewValueString(*(v.Message)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Owner != nil {
		w, err = wire.NewValueString(*(v.Owner)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a ShardOwnershipLostError struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a ShardOwnershipLostError struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ShardOwnershipLostError
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ShardOwnershipLostError) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.Message = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.Owner = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ShardOwnershipLostError struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ShardOwnershipLostError struct could not be encoded.
func (v *ShardOwnershipLostError) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Message != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.Message)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Owner != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.Owner)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a ShardOwnershipLostError struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ShardOwnershipLostError struct could not be generated from the wire
// representation.
func (v *ShardOwnershipLostError) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.Message = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.Owner = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a ShardOwnershipLostError
// struct.
func (v *ShardOwnershipLostError) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	if v.Message != nil {
		fields[i] = fmt.Sprintf("Message: %v", *(v.Message))
		i++
	}
	if v.Owner != nil {
		fields[i] = fmt.Sprintf("Owner: %v", *(v.Owner))
		i++
	}

	return fmt.Sprintf("ShardOwnershipLostError{%v}", strings.Join(fields[:i], ", "))
}

// ErrorName is the name of this type as defined in the Thrift
// file.
func (*ShardOwnershipLostError) ErrorName() string {
	return "ShardOwnershipLostError"
}

// Equals returns true if all the fields of this ShardOwnershipLostError match the
// provided ShardOwnershipLostError.
//
// This function performs a deep comparison.
func (v *ShardOwnershipLostError) Equals(rhs *ShardOwnershipLostError) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.Message, rhs.Message) {
		return false
	}
	if !_String_EqualsPtr(v.Owner, rhs.Owner) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ShardOwnershipLostError.
func (v *ShardOwnershipLostError) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Message != nil {
		enc.AddString("message", *v.Message)
	}
	if v.Owner != nil {
		enc.AddString("owner", *v.Owner)
	}
	return err
}

// GetMessage returns the value of Message if it is set or its
// zero value if it is unset.
func (v *ShardOwnershipLostError) GetMessage() (o string) {
	if v != nil && v.Message != nil {
		return *v.Message
	}

	return
}

// IsSetMessage returns true if Message is not nil.
func (v *ShardOwnershipLostError) IsSetMessage() bool {
	return v != nil && v.Message != nil
}

// GetOwner returns the value of Owner if it is set or its
// zero value if it is unset.
func (v *ShardOwnershipLostError) GetOwner() (o string) {
	if v != nil && v.Owner != nil {
		return *v.Owner
	}

	return
}

// IsSetOwner returns true if Owner is not nil.
func (v *ShardOwnershipLostError) IsSetOwner() bool {
	return v != nil && v.Owner != nil
}

func (v *ShardOwnershipLostError) Error() string {
	return v.String()
}

type SignalWithStartWorkflowExecutionRequest struct {
	DomainUUID             *string                                         `json:"domainUUID,omitempty"`
	SignalWithStartRequest *shared.SignalWithStartWorkflowExecutionRequest `json:"signalWithStartRequest,omitempty"`
	PartitionConfig        map[string]string                               `json:"partitionConfig,omitempty"`
}

type _Map_String_String_MapItemList map[string]string

func (m _Map_String_String_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := wire.NewValueString(v), error(nil)
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_String_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_String_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_String_MapItemList) ValueType() wire.Type {
	return wire.TBinary
}

func (_Map_String_String_MapItemList) Close() {}

// ToWire translates a SignalWithStartWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *SignalWithStartWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.SignalWithStartRequest != nil {
		w, err = v.SignalWithStartRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.PartitionConfig != nil {
		w, err = wire.NewValueMap(_Map_String_String_MapItemList(v.PartitionConfig)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _SignalWithStartWorkflowExecutionRequest_Read(w wire.Value) (*shared.SignalWithStartWorkflowExecutionRequest, error) {
	var v shared.SignalWithStartWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

func _Map_String_String_Read(m wire.MapItemList) (map[string]string, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TBinary {
		return nil, nil
	}

	o := make(map[string]string, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := x.Value.GetString(), error(nil)
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a SignalWithStartWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a SignalWithStartWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SignalWithStartWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SignalWithStartWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.SignalWithStartRequest, err = _SignalWithStartWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TMap {
				v.PartitionConfig, err = _Map_String_String_Read(field.Value.GetMap())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _Map_String_String_Encode(val map[string]string, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TBinary,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := sw.WriteString(v); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a SignalWithStartWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SignalWithStartWorkflowExecutionRequest struct could not be encoded.
func (v *SignalWithStartWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.SignalWithStartRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SignalWithStartRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PartitionConfig != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TMap}); err != nil {
			return err
		}
		if err := _Map_String_String_Encode(v.PartitionConfig, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _SignalWithStartWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.SignalWithStartWorkflowExecutionRequest, error) {
	var v shared.SignalWithStartWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

func _Map_String_String_Decode(sr stream.Reader) (map[string]string, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TBinary {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string]string, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a SignalWithStartWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SignalWithStartWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *SignalWithStartWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.SignalWithStartRequest, err = _SignalWithStartWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TMap:
			v.PartitionConfig, err = _Map_String_String_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a SignalWithStartWorkflowExecutionRequest
// struct.
func (v *SignalWithStartWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.SignalWithStartRequest != nil {
		fields[i] = fmt.Sprintf("SignalWithStartRequest: %v", v.SignalWithStartRequest)
		i++
	}
	if v.PartitionConfig != nil {
		fields[i] = fmt.Sprintf("PartitionConfig: %v", v.PartitionConfig)
		i++
	}

	return fmt.Sprintf("SignalWithStartWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

func _Map_String_String_Equals(lhs, rhs map[string]string) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !(lv == rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this SignalWithStartWorkflowExecutionRequest match the
// provided SignalWithStartWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *SignalWithStartWorkflowExecutionRequest) Equals(rhs *SignalWithStartWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.SignalWithStartRequest == nil && rhs.SignalWithStartRequest == nil) || (v.SignalWithStartRequest != nil && rhs.SignalWithStartRequest != nil && v.SignalWithStartRequest.Equals(rhs.SignalWithStartRequest))) {
		return false
	}
	if !((v.PartitionConfig == nil && rhs.PartitionConfig == nil) || (v.PartitionConfig != nil && rhs.PartitionConfig != nil && _Map_String_String_Equals(v.PartitionConfig, rhs.PartitionConfig))) {
		return false
	}

	return true
}

type _Map_String_String_Zapper map[string]string

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_String_Zapper.
func (m _Map_String_String_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		enc.AddString((string)(k), v)
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of SignalWithStartWorkflowExecutionRequest.
func (v *SignalWithStartWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.SignalWithStartRequest != nil {
		err = multierr.Append(err, enc.AddObject("signalWithStartRequest", v.SignalWithStartRequest))
	}
	if v.PartitionConfig != nil {
		err = multierr.Append(err, enc.AddObject("partitionConfig", (_Map_String_String_Zapper)(v.PartitionConfig)))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *SignalWithStartWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *SignalWithStartWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetSignalWithStartRequest returns the value of SignalWithStartRequest if it is set or its
// zero value if it is unset.
func (v *SignalWithStartWorkflowExecutionRequest) GetSignalWithStartRequest() (o *shared.SignalWithStartWorkflowExecutionRequest) {
	if v != nil && v.SignalWithStartRequest != nil {
		return v.SignalWithStartRequest
	}

	return
}

// IsSetSignalWithStartRequest returns true if SignalWithStartRequest is not nil.
func (v *SignalWithStartWorkflowExecutionRequest) IsSetSignalWithStartRequest() bool {
	return v != nil && v.SignalWithStartRequest != nil
}

// GetPartitionConfig returns the value of PartitionConfig if it is set or its
// zero value if it is unset.
func (v *SignalWithStartWorkflowExecutionRequest) GetPartitionConfig() (o map[string]string) {
	if v != nil && v.PartitionConfig != nil {
		return v.PartitionConfig
	}

	return
}

// IsSetPartitionConfig returns true if PartitionConfig is not nil.
func (v *SignalWithStartWorkflowExecutionRequest) IsSetPartitionConfig() bool {
	return v != nil && v.PartitionConfig != nil
}

type SignalWorkflowExecutionRequest struct {
	DomainUUID                *string                                `json:"domainUUID,omitempty"`
	SignalRequest             *shared.SignalWorkflowExecutionRequest `json:"signalRequest,omitempty"`
	ExternalWorkflowExecution *shared.WorkflowExecution              `json:"externalWorkflowExecution,omitempty"`
	ChildWorkflowOnly         *bool                                  `json:"childWorkflowOnly,omitempty"`
}

// ToWire translates a SignalWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *SignalWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.SignalRequest != nil {
		w, err = v.SignalRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ExternalWorkflowExecution != nil {
		w, err = v.ExternalWorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.ChildWorkflowOnly != nil {
		w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _SignalWorkflowExecutionRequest_Read(w wire.Value) (*shared.SignalWorkflowExecutionRequest, error) {
	var v shared.SignalWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a SignalWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a SignalWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SignalWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SignalWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.SignalRequest, err = _SignalWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TStruct {
				v.ExternalWorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.ChildWorkflowOnly = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a SignalWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SignalWorkflowExecutionRequest struct could not be encoded.
func (v *SignalWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.SignalRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SignalRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExternalWorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ExternalWorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ChildWorkflowOnly != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.ChildWorkflowOnly)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _SignalWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.SignalWorkflowExecutionRequest, error) {
	var v shared.SignalWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a SignalWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SignalWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *SignalWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.SignalRequest, err = _SignalWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TStruct:
			v.ExternalWorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.ChildWorkflowOnly = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a SignalWorkflowExecutionRequest
// struct.
func (v *SignalWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.SignalRequest != nil {
		fields[i] = fmt.Sprintf("SignalRequest: %v", v.SignalRequest)
		i++
	}
	if v.ExternalWorkflowExecution != nil {
		fields[i] = fmt.Sprintf("ExternalWorkflowExecution: %v", v.ExternalWorkflowExecution)
		i++
	}
	if v.ChildWorkflowOnly != nil {
		fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly))
		i++
	}

	return fmt.Sprintf("SignalWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this SignalWorkflowExecutionRequest match the
// provided SignalWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *SignalWorkflowExecutionRequest) Equals(rhs *SignalWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.SignalRequest == nil && rhs.SignalRequest == nil) || (v.SignalRequest != nil && rhs.SignalRequest != nil && v.SignalRequest.Equals(rhs.SignalRequest))) {
		return false
	}
	if !((v.ExternalWorkflowExecution == nil && rhs.ExternalWorkflowExecution == nil) || (v.ExternalWorkflowExecution != nil && rhs.ExternalWorkflowExecution != nil && v.ExternalWorkflowExecution.Equals(rhs.ExternalWorkflowExecution))) {
		return false
	}
	if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of SignalWorkflowExecutionRequest.
func (v *SignalWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.SignalRequest != nil {
		err = multierr.Append(err, enc.AddObject("signalRequest", v.SignalRequest))
	}
	if v.ExternalWorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("externalWorkflowExecution", v.ExternalWorkflowExecution))
	}
	if v.ChildWorkflowOnly != nil {
		enc.AddBool("childWorkflowOnly", *v.ChildWorkflowOnly)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *SignalWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *SignalWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetSignalRequest returns the value of SignalRequest if it is set or its
// zero value if it is unset.
func (v *SignalWorkflowExecutionRequest) GetSignalRequest() (o *shared.SignalWorkflowExecutionRequest) {
	if v != nil && v.SignalRequest != nil {
		return v.SignalRequest
	}

	return
}

// IsSetSignalRequest returns true if SignalRequest is not nil.
func (v *SignalWorkflowExecutionRequest) IsSetSignalRequest() bool {
	return v != nil && v.SignalRequest != nil
}

// GetExternalWorkflowExecution returns the value of ExternalWorkflowExecution if it is set or its
// zero value if it is unset.
func (v *SignalWorkflowExecutionRequest) GetExternalWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.ExternalWorkflowExecution != nil {
		return v.ExternalWorkflowExecution
	}

	return
}

// IsSetExternalWorkflowExecution returns true if ExternalWorkflowExecution is not nil.
func (v *SignalWorkflowExecutionRequest) IsSetExternalWorkflowExecution() bool {
	return v != nil && v.ExternalWorkflowExecution != nil
}

// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its
// zero value if it is unset.
func (v *SignalWorkflowExecutionRequest) GetChildWorkflowOnly() (o bool) {
	if v != nil && v.ChildWorkflowOnly != nil {
		return *v.ChildWorkflowOnly
	}

	return
}

// IsSetChildWorkflowOnly returns true if ChildWorkflowOnly is not nil.
func (v *SignalWorkflowExecutionRequest) IsSetChildWorkflowOnly() bool {
	return v != nil && v.ChildWorkflowOnly != nil
}

type StartWorkflowExecutionRequest struct {
	DomainUUID                      *string                               `json:"domainUUID,omitempty"`
	StartRequest                    *shared.StartWorkflowExecutionRequest `json:"startRequest,omitempty"`
	ParentExecutionInfo             *ParentExecutionInfo                  `json:"parentExecutionInfo,omitempty"`
	Attempt                         *int32                                `json:"attempt,omitempty"`
	ExpirationTimestamp             *int64                                `json:"expirationTimestamp,omitempty"`
	ContinueAsNewInitiator          *shared.ContinueAsNewInitiator        `json:"continueAsNewInitiator,omitempty"`
	ContinuedFailureReason          *string                               `json:"continuedFailureReason,omitempty"`
	ContinuedFailureDetails         []byte                                `json:"continuedFailureDetails,omitempty"`
	LastCompletionResult            []byte                                `json:"lastCompletionResult,omitempty"`
	FirstDecisionTaskBackoffSeconds *int32                                `json:"firstDecisionTaskBackoffSeconds,omitempty"`
	PartitionConfig                 map[string]string                     `json:"partitionConfig,omitempty"`
}

// ToWire translates a StartWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *StartWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [11]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.StartRequest != nil {
		w, err = v.StartRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ParentExecutionInfo != nil {
		w, err = v.ParentExecutionInfo.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.Attempt != nil {
		w, err = wire.NewValueI32(*(v.Attempt)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.ExpirationTimestamp != nil {
		w, err = wire.NewValueI64(*(v.ExpirationTimestamp)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.ContinueAsNewInitiator != nil {
		w, err = v.ContinueAsNewInitiator.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 55, Value: w}
		i++
	}
	if v.ContinuedFailureReason != nil {
		w, err = wire.NewValueString(*(v.ContinuedFailureReason)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 56, Value: w}
		i++
	}
	if v.ContinuedFailureDetails != nil {
		w, err = wire.NewValueBinary(v.ContinuedFailureDetails), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 57, Value: w}
		i++
	}
	if v.LastCompletionResult != nil {
		w, err = wire.NewValueBinary(v.LastCompletionResult), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 58, Value: w}
		i++
	}
	if v.FirstDecisionTaskBackoffSeconds != nil {
		w, err = wire.NewValueI32(*(v.FirstDecisionTaskBackoffSeconds)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.PartitionConfig != nil {
		w, err = wire.NewValueMap(_Map_String_String_MapItemList(v.PartitionConfig)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 62, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _StartWorkflowExecutionRequest_Read(w wire.Value) (*shared.StartWorkflowExecutionRequest, error) {
	var v shared.StartWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

func _ParentExecutionInfo_Read(w wire.Value) (*ParentExecutionInfo, error) {
	var v ParentExecutionInfo
	err := v.FromWire(w)
	return &v, err
}

func _ContinueAsNewInitiator_Read(w wire.Value) (shared.ContinueAsNewInitiator, error) {
	var v shared.ContinueAsNewInitiator
	err := v.FromWire(w)
	return v, err
}

// FromWire deserializes a StartWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a StartWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v StartWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *StartWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.StartRequest, err = _StartWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TStruct {
				v.ParentExecutionInfo, err = _ParentExecutionInfo_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.Attempt = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ExpirationTimestamp = &x
				if err != nil {
					return err
				}

			}
		case 55:
			if field.Value.Type() == wire.TI32 {
				var x shared.ContinueAsNewInitiator
				x, err = _ContinueAsNewInitiator_Read(field.Value)
				v.ContinueAsNewInitiator = &x
				if err != nil {
					return err
				}

			}
		case 56:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.ContinuedFailureReason = &x
				if err != nil {
					return err
				}

			}
		case 57:
			if field.Value.Type() == wire.TBinary {
				v.ContinuedFailureDetails, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 58:
			if field.Value.Type() == wire.TBinary {
				v.LastCompletionResult, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.FirstDecisionTaskBackoffSeconds = &x
				if err != nil {
					return err
				}

			}
		case 62:
			if field.Value.Type() == wire.TMap {
				v.PartitionConfig, err = _Map_String_String_Read(field.Value.GetMap())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a StartWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a StartWorkflowExecutionRequest struct could not be encoded.
func (v *StartWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.StartRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ParentExecutionInfo != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ParentExecutionInfo.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Attempt != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.Attempt)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExpirationTimestamp != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ExpirationTimestamp)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ContinueAsNewInitiator != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 55, Type: wire.TI32}); err != nil {
			return err
		}
		if err := v.ContinueAsNewInitiator.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ContinuedFailureReason != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 56, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.ContinuedFailureReason)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ContinuedFailureDetails != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 57, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.ContinuedFailureDetails); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastCompletionResult != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 58, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.LastCompletionResult); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.FirstDecisionTaskBackoffSeconds != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.FirstDecisionTaskBackoffSeconds)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.PartitionConfig != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 62, Type: wire.TMap}); err != nil {
			return err
		}
		if err := _Map_String_String_Encode(v.PartitionConfig, sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _StartWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.StartWorkflowExecutionRequest, error) {
	var v shared.StartWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

func _ParentExecutionInfo_Decode(sr stream.Reader) (*ParentExecutionInfo, error) {
	var v ParentExecutionInfo
	err := v.Decode(sr)
	return &v, err
}

func _ContinueAsNewInitiator_Decode(sr stream.Reader) (shared.ContinueAsNewInitiator, error) {
	var v shared.ContinueAsNewInitiator
	err := v.Decode(sr)
	return v, err
}

// Decode deserializes a StartWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a StartWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *StartWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.StartRequest, err = _StartWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TStruct:
			v.ParentExecutionInfo, err = _ParentExecutionInfo_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.Attempt = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ExpirationTimestamp = &x
			if err != nil {
				return err
			}

		case fh.ID == 55 && fh.Type == wire.TI32:
			var x shared.ContinueAsNewInitiator
			x, err = _ContinueAsNewInitiator_Decode(sr)
			v.ContinueAsNewInitiator = &x
			if err != nil {
				return err
			}

		case fh.ID == 56 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ContinuedFailureReason = &x
			if err != nil {
				return err
			}

		case fh.ID == 57 && fh.Type == wire.TBinary:
			v.ContinuedFailureDetails, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 58 && fh.Type == wire.TBinary:
			v.LastCompletionResult, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.FirstDecisionTaskBackoffSeconds = &x
			if err != nil {
				return err
			}

		case fh.ID == 62 && fh.Type == wire.TMap:
			v.PartitionConfig, err = _Map_String_String_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a StartWorkflowExecutionRequest
// struct.
func (v *StartWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [11]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.StartRequest != nil {
		fields[i] = fmt.Sprintf("StartRequest: %v", v.StartRequest)
		i++
	}
	if v.ParentExecutionInfo != nil {
		fields[i] = fmt.Sprintf("ParentExecutionInfo: %v", v.ParentExecutionInfo)
		i++
	}
	if v.Attempt != nil {
		fields[i] = fmt.Sprintf("Attempt: %v", *(v.Attempt))
		i++
	}
	if v.ExpirationTimestamp != nil {
		fields[i] = fmt.Sprintf("ExpirationTimestamp: %v", *(v.ExpirationTimestamp))
		i++
	}
	if v.ContinueAsNewInitiator != nil {
		fields[i] = fmt.Sprintf("ContinueAsNewInitiator: %v", *(v.ContinueAsNewInitiator))
		i++
	}
	if v.ContinuedFailureReason != nil {
		fields[i] = fmt.Sprintf("ContinuedFailureReason: %v", *(v.ContinuedFailureReason))
		i++
	}
	if v.ContinuedFailureDetails != nil {
		fields[i] = fmt.Sprintf("ContinuedFailureDetails: %v", v.ContinuedFailureDetails)
		i++
	}
	if v.LastCompletionResult != nil {
		fields[i] = fmt.Sprintf("LastCompletionResult: %v", v.LastCompletionResult)
		i++
	}
	if v.FirstDecisionTaskBackoffSeconds != nil {
		fields[i] = fmt.Sprintf("FirstDecisionTaskBackoffSeconds: %v", *(v.FirstDecisionTaskBackoffSeconds))
		i++
	}
	if v.PartitionConfig != nil {
		fields[i] = fmt.Sprintf("PartitionConfig: %v", v.PartitionConfig)
		i++
	}

	return fmt.Sprintf("StartWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

func _ContinueAsNewInitiator_EqualsPtr(lhs, rhs *shared.ContinueAsNewInitiator) bool {
	if lhs != nil && rhs != nil {

		x := *lhs
		y := *rhs
		return x.Equals(y)
	}
	return lhs == nil && rhs == nil
}

// Equals returns true if all the fields of this StartWorkflowExecutionRequest match the
// provided StartWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *StartWorkflowExecutionRequest) Equals(rhs *StartWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.StartRequest == nil && rhs.StartRequest == nil) || (v.StartRequest != nil && rhs.StartRequest != nil && v.StartRequest.Equals(rhs.StartRequest))) {
		return false
	}
	if !((v.ParentExecutionInfo == nil && rhs.ParentExecutionInfo == nil) || (v.ParentExecutionInfo != nil && rhs.ParentExecutionInfo != nil && v.ParentExecutionInfo.Equals(rhs.ParentExecutionInfo))) {
		return false
	}
	if !_I32_EqualsPtr(v.Attempt, rhs.Attempt) {
		return false
	}
	if !_I64_EqualsPtr(v.ExpirationTimestamp, rhs.ExpirationTimestamp) {
		return false
	}
	if !_ContinueAsNewInitiator_EqualsPtr(v.ContinueAsNewInitiator, rhs.ContinueAsNewInitiator) {
		return false
	}
	if !_String_EqualsPtr(v.ContinuedFailureReason, rhs.ContinuedFailureReason) {
		return false
	}
	if !((v.ContinuedFailureDetails == nil && rhs.ContinuedFailureDetails == nil) || (v.ContinuedFailureDetails != nil && rhs.ContinuedFailureDetails != nil && bytes.Equal(v.ContinuedFailureDetails, rhs.ContinuedFailureDetails))) {
		return false
	}
	if !((v.LastCompletionResult == nil && rhs.LastCompletionResult == nil) || (v.LastCompletionResult != nil && rhs.LastCompletionResult != nil && bytes.Equal(v.LastCompletionResult, rhs.LastCompletionResult))) {
		return false
	}
	if !_I32_EqualsPtr(v.FirstDecisionTaskBackoffSeconds, rhs.FirstDecisionTaskBackoffSeconds) {
		return false
	}
	if !((v.PartitionConfig == nil && rhs.PartitionConfig == nil) || (v.PartitionConfig != nil && rhs.PartitionConfig != nil && _Map_String_String_Equals(v.PartitionConfig, rhs.PartitionConfig))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of StartWorkflowExecutionRequest.
func (v *StartWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.StartRequest != nil {
		err = multierr.Append(err, enc.AddObject("startRequest", v.StartRequest))
	}
	if v.ParentExecutionInfo != nil {
		err = multierr.Append(err, enc.AddObject("parentExecutionInfo", v.ParentExecutionInfo))
	}
	if v.Attempt != nil {
		enc.AddInt32("attempt", *v.Attempt)
	}
	if v.ExpirationTimestamp != nil {
		enc.AddInt64("expirationTimestamp", *v.ExpirationTimestamp)
	}
	if v.ContinueAsNewInitiator != nil {
		err = multierr.Append(err, enc.AddObject("continueAsNewInitiator", *v.ContinueAsNewInitiator))
	}
	if v.ContinuedFailureReason != nil {
		enc.AddString("continuedFailureReason", *v.ContinuedFailureReason)
	}
	if v.ContinuedFailureDetails != nil {
		enc.AddString("continuedFailureDetails", base64.StdEncoding.EncodeToString(v.ContinuedFailureDetails))
	}
	if v.LastCompletionResult != nil {
		enc.AddString("lastCompletionResult", base64.StdEncoding.EncodeToString(v.LastCompletionResult))
	}
	if v.FirstDecisionTaskBackoffSeconds != nil {
		enc.AddInt32("firstDecisionTaskBackoffSeconds", *v.FirstDecisionTaskBackoffSeconds)
	}
	if v.PartitionConfig != nil {
		err = multierr.Append(err, enc.AddObject("partitionConfig", (_Map_String_String_Zapper)(v.PartitionConfig)))
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *StartWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetStartRequest returns the value of StartRequest if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetStartRequest() (o *shared.StartWorkflowExecutionRequest) {
	if v != nil && v.StartRequest != nil {
		return v.StartRequest
	}

	return
}

// IsSetStartRequest returns true if StartRequest is not nil.
func (v *StartWorkflowExecutionRequest) IsSetStartRequest() bool {
	return v != nil && v.StartRequest != nil
}

// GetParentExecutionInfo returns the value of ParentExecutionInfo if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetParentExecutionInfo() (o *ParentExecutionInfo) {
	if v != nil && v.ParentExecutionInfo != nil {
		return v.ParentExecutionInfo
	}

	return
}

// IsSetParentExecutionInfo returns true if ParentExecutionInfo is not nil.
func (v *StartWorkflowExecutionRequest) IsSetParentExecutionInfo() bool {
	return v != nil && v.ParentExecutionInfo != nil
}

// GetAttempt returns the value of Attempt if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetAttempt() (o int32) {
	if v != nil && v.Attempt != nil {
		return *v.Attempt
	}

	return
}

// IsSetAttempt returns true if Attempt is not nil.
func (v *StartWorkflowExecutionRequest) IsSetAttempt() bool {
	return v != nil && v.Attempt != nil
}

// GetExpirationTimestamp returns the value of ExpirationTimestamp if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetExpirationTimestamp() (o int64) {
	if v != nil && v.ExpirationTimestamp != nil {
		return *v.ExpirationTimestamp
	}

	return
}

// IsSetExpirationTimestamp returns true if ExpirationTimestamp is not nil.
func (v *StartWorkflowExecutionRequest) IsSetExpirationTimestamp() bool {
	return v != nil && v.ExpirationTimestamp != nil
}

// GetContinueAsNewInitiator returns the value of ContinueAsNewInitiator if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetContinueAsNewInitiator() (o shared.ContinueAsNewInitiator) {
	if v != nil && v.ContinueAsNewInitiator != nil {
		return *v.ContinueAsNewInitiator
	}

	return
}

// IsSetContinueAsNewInitiator returns true if ContinueAsNewInitiator is not nil.
func (v *StartWorkflowExecutionRequest) IsSetContinueAsNewInitiator() bool {
	return v != nil && v.ContinueAsNewInitiator != nil
}

// GetContinuedFailureReason returns the value of ContinuedFailureReason if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetContinuedFailureReason() (o string) {
	if v != nil && v.ContinuedFailureReason != nil {
		return *v.ContinuedFailureReason
	}

	return
}

// IsSetContinuedFailureReason returns true if ContinuedFailureReason is not nil.
func (v *StartWorkflowExecutionRequest) IsSetContinuedFailureReason() bool {
	return v != nil && v.ContinuedFailureReason != nil
}

// GetContinuedFailureDetails returns the value of ContinuedFailureDetails if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetContinuedFailureDetails() (o []byte) {
	if v != nil && v.ContinuedFailureDetails != nil {
		return v.ContinuedFailureDetails
	}

	return
}

// IsSetContinuedFailureDetails returns true if ContinuedFailureDetails is not nil.
func (v *StartWorkflowExecutionRequest) IsSetContinuedFailureDetails() bool {
	return v != nil && v.ContinuedFailureDetails != nil
}

// GetLastCompletionResult returns the value of LastCompletionResult if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetLastCompletionResult() (o []byte) {
	if v != nil && v.LastCompletionResult != nil {
		return v.LastCompletionResult
	}

	return
}

// IsSetLastCompletionResult returns true if LastCompletionResult is not nil.
func (v *StartWorkflowExecutionRequest) IsSetLastCompletionResult() bool {
	return v != nil && v.LastCompletionResult != nil
}

// GetFirstDecisionTaskBackoffSeconds returns the value of FirstDecisionTaskBackoffSeconds if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetFirstDecisionTaskBackoffSeconds() (o int32) {
	if v != nil && v.FirstDecisionTaskBackoffSeconds != nil {
		return *v.FirstDecisionTaskBackoffSeconds
	}

	return
}

// IsSetFirstDecisionTaskBackoffSeconds returns true if FirstDecisionTaskBackoffSeconds is not nil.
func (v *StartWorkflowExecutionRequest) IsSetFirstDecisionTaskBackoffSeconds() bool {
	return v != nil && v.FirstDecisionTaskBackoffSeconds != nil
}

// GetPartitionConfig returns the value of PartitionConfig if it is set or its
// zero value if it is unset.
func (v *StartWorkflowExecutionRequest) GetPartitionConfig() (o map[string]string) {
	if v != nil && v.PartitionConfig != nil {
		return v.PartitionConfig
	}

	return
}

// IsSetPartitionConfig returns true if PartitionConfig is not nil.
func (v *StartWorkflowExecutionRequest) IsSetPartitionConfig() bool {
	return v != nil && v.PartitionConfig != nil
}

type SyncActivityRequest struct {
	DomainId           *string                `json:"domainId,omitempty"`
	WorkflowId         *string                `json:"workflowId,omitempty"`
	RunId              *string                `json:"runId,omitempty"`
	Version            *int64                 `json:"version,omitempty"`
	ScheduledId        *int64                 `json:"scheduledId,omitempty"`
	ScheduledTime      *int64                 `json:"scheduledTime,omitempty"`
	StartedId          *int64                 `json:"startedId,omitempty"`
	StartedTime        *int64                 `json:"startedTime,omitempty"`
	LastHeartbeatTime  *int64                 `json:"lastHeartbeatTime,omitempty"`
	Details            []byte                 `json:"details,omitempty"`
	Attempt            *int32                 `json:"attempt,omitempty"`
	LastFailureReason  *string                `json:"lastFailureReason,omitempty"`
	LastWorkerIdentity *string                `json:"lastWorkerIdentity,omitempty"`
	LastFailureDetails []byte                 `json:"lastFailureDetails,omitempty"`
	VersionHistory     *shared.VersionHistory `json:"versionHistory,omitempty"`
}

// ToWire translates a SyncActivityRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *SyncActivityRequest) ToWire() (wire.Value, error) {
	var (
		fields [15]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainId != nil {
		w, err = wire.NewValueString(*(v.DomainId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.WorkflowId != nil {
		w, err = wire.NewValueString(*(v.WorkflowId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.RunId != nil {
		w, err = wire.NewValueString(*(v.RunId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.Version != nil {
		w, err = wire.NewValueI64(*(v.Version)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.ScheduledId != nil {
		w, err = wire.NewValueI64(*(v.ScheduledId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.ScheduledTime != nil {
		w, err = wire.NewValueI64(*(v.ScheduledTime)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.StartedId != nil {
		w, err = wire.NewValueI64(*(v.StartedId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}
	if v.StartedTime != nil {
		w, err = wire.NewValueI64(*(v.StartedTime)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 80, Value: w}
		i++
	}
	if v.LastHeartbeatTime != nil {
		w, err = wire.NewValueI64(*(v.LastHeartbeatTime)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 90, Value: w}
		i++
	}
	if v.Details != nil {
		w, err = wire.NewValueBinary(v.Details), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 100, Value: w}
		i++
	}
	if v.Attempt != nil {
		w, err = wire.NewValueI32(*(v.Attempt)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 110, Value: w}
		i++
	}
	if v.LastFailureReason != nil {
		w, err = wire.NewValueString(*(v.LastFailureReason)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 120, Value: w}
		i++
	}
	if v.LastWorkerIdentity != nil {
		w, err = wire.NewValueString(*(v.LastWorkerIdentity)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 130, Value: w}
		i++
	}
	if v.LastFailureDetails != nil {
		w, err = wire.NewValueBinary(v.LastFailureDetails), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 140, Value: w}
		i++
	}
	if v.VersionHistory != nil {
		w, err = v.VersionHistory.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 150, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _VersionHistory_Read(w wire.Value) (*shared.VersionHistory, error) {
	var v shared.VersionHistory
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a SyncActivityRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a SyncActivityRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SyncActivityRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SyncActivityRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainId = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.WorkflowId = &x
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.RunId = &x
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.Version = &x
				if err != nil {
					return err
				}

			}
		case 50:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduledId = &x
				if err != nil {
					return err
				}

			}
		case 60:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ScheduledTime = &x
				if err != nil {
					return err
				}

			}
		case 70:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.StartedId = &x
				if err != nil {
					return err
				}

			}
		case 80:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.StartedTime = &x
				if err != nil {
					return err
				}

			}
		case 90:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.LastHeartbeatTime = &x
				if err != nil {
					return err
				}

			}
		case 100:
			if field.Value.Type() == wire.TBinary {
				v.Details, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 110:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.Attempt = &x
				if err != nil {
					return err
				}

			}
		case 120:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.LastFailureReason = &x
				if err != nil {
					return err
				}

			}
		case 130:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.LastWorkerIdentity = &x
				if err != nil {
					return err
				}

			}
		case 140:
			if field.Value.Type() == wire.TBinary {
				v.LastFailureDetails, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		case 150:
			if field.Value.Type() == wire.TStruct {
				v.VersionHistory, err = _VersionHistory_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a SyncActivityRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SyncActivityRequest struct could not be encoded.
func (v *SyncActivityRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.WorkflowId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.RunId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.RunId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Version != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.Version)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduledId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduledId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ScheduledTime != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ScheduledTime)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartedId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 70, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.StartedId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.StartedTime != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 80, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.StartedTime)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastHeartbeatTime != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 90, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.LastHeartbeatTime)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Details != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 100, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.Details); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Attempt != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 110, Type: wire.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.Attempt)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastFailureReason != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 120, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.LastFailureReason)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastWorkerIdentity != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 130, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.LastWorkerIdentity)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LastFailureDetails != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 140, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteBinary(v.LastFailureDetails); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.VersionHistory != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 150, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.VersionHistory.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _VersionHistory_Decode(sr stream.Reader) (*shared.VersionHistory, error) {
	var v shared.VersionHistory
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a SyncActivityRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SyncActivityRequest struct could not be generated from the wire
// representation.
func (v *SyncActivityRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainId = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.WorkflowId = &x
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.RunId = &x
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.Version = &x
			if err != nil {
				return err
			}

		case fh.ID == 50 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduledId = &x
			if err != nil {
				return err
			}

		case fh.ID == 60 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduledTime = &x
			if err != nil {
				return err
			}

		case fh.ID == 70 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.StartedId = &x
			if err != nil {
				return err
			}

		case fh.ID == 80 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.StartedTime = &x
			if err != nil {
				return err
			}

		case fh.ID == 90 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.LastHeartbeatTime = &x
			if err != nil {
				return err
			}

		case fh.ID == 100 && fh.Type == wire.TBinary:
			v.Details, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 110 && fh.Type == wire.TI32:
			var x int32
			x, err = sr.ReadInt32()
			v.Attempt = &x
			if err != nil {
				return err
			}

		case fh.ID == 120 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.LastFailureReason = &x
			if err != nil {
				return err
			}

		case fh.ID == 130 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.LastWorkerIdentity = &x
			if err != nil {
				return err
			}

		case fh.ID == 140 && fh.Type == wire.TBinary:
			v.LastFailureDetails, err = sr.ReadBinary()
			if err != nil {
				return err
			}

		case fh.ID == 150 && fh.Type == wire.TStruct:
			v.VersionHistory, err = _VersionHistory_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a SyncActivityRequest
// struct.
func (v *SyncActivityRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [15]string
	i := 0
	if v.DomainId != nil {
		fields[i] = fmt.Sprintf("DomainId: %v", *(v.DomainId))
		i++
	}
	if v.WorkflowId != nil {
		fields[i] = fmt.Sprintf("WorkflowId: %v", *(v.WorkflowId))
		i++
	}
	if v.RunId != nil {
		fields[i] = fmt.Sprintf("RunId: %v", *(v.RunId))
		i++
	}
	if v.Version != nil {
		fields[i] = fmt.Sprintf("Version: %v", *(v.Version))
		i++
	}
	if v.ScheduledId != nil {
		fields[i] = fmt.Sprintf("ScheduledId: %v", *(v.ScheduledId))
		i++
	}
	if v.ScheduledTime != nil {
		fields[i] = fmt.Sprintf("ScheduledTime: %v", *(v.ScheduledTime))
		i++
	}
	if v.StartedId != nil {
		fields[i] = fmt.Sprintf("StartedId: %v", *(v.StartedId))
		i++
	}
	if v.StartedTime != nil {
		fields[i] = fmt.Sprintf("StartedTime: %v", *(v.StartedTime))
		i++
	}
	if v.LastHeartbeatTime != nil {
		fields[i] = fmt.Sprintf("LastHeartbeatTime: %v", *(v.LastHeartbeatTime))
		i++
	}
	if v.Details != nil {
		fields[i] = fmt.Sprintf("Details: %v", v.Details)
		i++
	}
	if v.Attempt != nil {
		fields[i] = fmt.Sprintf("Attempt: %v", *(v.Attempt))
		i++
	}
	if v.LastFailureReason != nil {
		fields[i] = fmt.Sprintf("LastFailureReason: %v", *(v.LastFailureReason))
		i++
	}
	if v.LastWorkerIdentity != nil {
		fields[i] = fmt.Sprintf("LastWorkerIdentity: %v", *(v.LastWorkerIdentity))
		i++
	}
	if v.LastFailureDetails != nil {
		fields[i] = fmt.Sprintf("LastFailureDetails: %v", v.LastFailureDetails)
		i++
	}
	if v.VersionHistory != nil {
		fields[i] = fmt.Sprintf("VersionHistory: %v", v.VersionHistory)
		i++
	}

	return fmt.Sprintf("SyncActivityRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this SyncActivityRequest match the
// provided SyncActivityRequest.
//
// This function performs a deep comparison.
func (v *SyncActivityRequest) Equals(rhs *SyncActivityRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainId, rhs.DomainId) {
		return false
	}
	if !_String_EqualsPtr(v.WorkflowId, rhs.WorkflowId) {
		return false
	}
	if !_String_EqualsPtr(v.RunId, rhs.RunId) {
		return false
	}
	if !_I64_EqualsPtr(v.Version, rhs.Version) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduledId, rhs.ScheduledId) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduledTime, rhs.ScheduledTime) {
		return false
	}
	if !_I64_EqualsPtr(v.StartedId, rhs.StartedId) {
		return false
	}
	if !_I64_EqualsPtr(v.StartedTime, rhs.StartedTime) {
		return false
	}
	if !_I64_EqualsPtr(v.LastHeartbeatTime, rhs.LastHeartbeatTime) {
		return false
	}
	if !((v.Details == nil && rhs.Details == nil) || (v.Details != nil && rhs.Details != nil && bytes.Equal(v.Details, rhs.Details))) {
		return false
	}
	if !_I32_EqualsPtr(v.Attempt, rhs.Attempt) {
		return false
	}
	if !_String_EqualsPtr(v.LastFailureReason, rhs.LastFailureReason) {
		return false
	}
	if !_String_EqualsPtr(v.LastWorkerIdentity, rhs.LastWorkerIdentity) {
		return false
	}
	if !((v.LastFailureDetails == nil && rhs.LastFailureDetails == nil) || (v.LastFailureDetails != nil && rhs.LastFailureDetails != nil && bytes.Equal(v.LastFailureDetails, rhs.LastFailureDetails))) {
		return false
	}
	if !((v.VersionHistory == nil && rhs.VersionHistory == nil) || (v.VersionHistory != nil && rhs.VersionHistory != nil && v.VersionHistory.Equals(rhs.VersionHistory))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of SyncActivityRequest.
func (v *SyncActivityRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainId != nil {
		enc.AddString("domainId", *v.DomainId)
	}
	if v.WorkflowId != nil {
		enc.AddString("workflowId", *v.WorkflowId)
	}
	if v.RunId != nil {
		enc.AddString("runId", *v.RunId)
	}
	if v.Version != nil {
		enc.AddInt64("version", *v.Version)
	}
	if v.ScheduledId != nil {
		enc.AddInt64("scheduledId", *v.ScheduledId)
	}
	if v.ScheduledTime != nil {
		enc.AddInt64("scheduledTime", *v.ScheduledTime)
	}
	if v.StartedId != nil {
		enc.AddInt64("startedId", *v.StartedId)
	}
	if v.StartedTime != nil {
		enc.AddInt64("startedTime", *v.StartedTime)
	}
	if v.LastHeartbeatTime != nil {
		enc.AddInt64("lastHeartbeatTime", *v.LastHeartbeatTime)
	}
	if v.Details != nil {
		enc.AddString("details", base64.StdEncoding.EncodeToString(v.Details))
	}
	if v.Attempt != nil {
		enc.AddInt32("attempt", *v.Attempt)
	}
	if v.LastFailureReason != nil {
		enc.AddString("lastFailureReason", *v.LastFailureReason)
	}
	if v.LastWorkerIdentity != nil {
		enc.AddString("lastWorkerIdentity", *v.LastWorkerIdentity)
	}
	if v.LastFailureDetails != nil {
		enc.AddString("lastFailureDetails", base64.StdEncoding.EncodeToString(v.LastFailureDetails))
	}
	if v.VersionHistory != nil {
		err = multierr.Append(err, enc.AddObject("versionHistory", v.VersionHistory))
	}
	return err
}

// GetDomainId returns the value of DomainId if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetDomainId() (o string) {
	if v != nil && v.DomainId != nil {
		return *v.DomainId
	}

	return
}

// IsSetDomainId returns true if DomainId is not nil.
func (v *SyncActivityRequest) IsSetDomainId() bool {
	return v != nil && v.DomainId != nil
}

// GetWorkflowId returns the value of WorkflowId if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetWorkflowId() (o string) {
	if v != nil && v.WorkflowId != nil {
		return *v.WorkflowId
	}

	return
}

// IsSetWorkflowId returns true if WorkflowId is not nil.
func (v *SyncActivityRequest) IsSetWorkflowId() bool {
	return v != nil && v.WorkflowId != nil
}

// GetRunId returns the value of RunId if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetRunId() (o string) {
	if v != nil && v.RunId != nil {
		return *v.RunId
	}

	return
}

// IsSetRunId returns true if RunId is not nil.
func (v *SyncActivityRequest) IsSetRunId() bool {
	return v != nil && v.RunId != nil
}

// GetVersion returns the value of Version if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetVersion() (o int64) {
	if v != nil && v.Version != nil {
		return *v.Version
	}

	return
}

// IsSetVersion returns true if Version is not nil.
func (v *SyncActivityRequest) IsSetVersion() bool {
	return v != nil && v.Version != nil
}

// GetScheduledId returns the value of ScheduledId if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetScheduledId() (o int64) {
	if v != nil && v.ScheduledId != nil {
		return *v.ScheduledId
	}

	return
}

// IsSetScheduledId returns true if ScheduledId is not nil.
func (v *SyncActivityRequest) IsSetScheduledId() bool {
	return v != nil && v.ScheduledId != nil
}

// GetScheduledTime returns the value of ScheduledTime if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetScheduledTime() (o int64) {
	if v != nil && v.ScheduledTime != nil {
		return *v.ScheduledTime
	}

	return
}

// IsSetScheduledTime returns true if ScheduledTime is not nil.
func (v *SyncActivityRequest) IsSetScheduledTime() bool {
	return v != nil && v.ScheduledTime != nil
}

// GetStartedId returns the value of StartedId if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetStartedId() (o int64) {
	if v != nil && v.StartedId != nil {
		return *v.StartedId
	}

	return
}

// IsSetStartedId returns true if StartedId is not nil.
func (v *SyncActivityRequest) IsSetStartedId() bool {
	return v != nil && v.StartedId != nil
}

// GetStartedTime returns the value of StartedTime if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetStartedTime() (o int64) {
	if v != nil && v.StartedTime != nil {
		return *v.StartedTime
	}

	return
}

// IsSetStartedTime returns true if StartedTime is not nil.
func (v *SyncActivityRequest) IsSetStartedTime() bool {
	return v != nil && v.StartedTime != nil
}

// GetLastHeartbeatTime returns the value of LastHeartbeatTime if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetLastHeartbeatTime() (o int64) {
	if v != nil && v.LastHeartbeatTime != nil {
		return *v.LastHeartbeatTime
	}

	return
}

// IsSetLastHeartbeatTime returns true if LastHeartbeatTime is not nil.
func (v *SyncActivityRequest) IsSetLastHeartbeatTime() bool {
	return v != nil && v.LastHeartbeatTime != nil
}

// GetDetails returns the value of Details if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetDetails() (o []byte) {
	if v != nil && v.Details != nil {
		return v.Details
	}

	return
}

// IsSetDetails returns true if Details is not nil.
func (v *SyncActivityRequest) IsSetDetails() bool {
	return v != nil && v.Details != nil
}

// GetAttempt returns the value of Attempt if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetAttempt() (o int32) {
	if v != nil && v.Attempt != nil {
		return *v.Attempt
	}

	return
}

// IsSetAttempt returns true if Attempt is not nil.
func (v *SyncActivityRequest) IsSetAttempt() bool {
	return v != nil && v.Attempt != nil
}

// GetLastFailureReason returns the value of LastFailureReason if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetLastFailureReason() (o string) {
	if v != nil && v.LastFailureReason != nil {
		return *v.LastFailureReason
	}

	return
}

// IsSetLastFailureReason returns true if LastFailureReason is not nil.
func (v *SyncActivityRequest) IsSetLastFailureReason() bool {
	return v != nil && v.LastFailureReason != nil
}

// GetLastWorkerIdentity returns the value of LastWorkerIdentity if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetLastWorkerIdentity() (o string) {
	if v != nil && v.LastWorkerIdentity != nil {
		return *v.LastWorkerIdentity
	}

	return
}

// IsSetLastWorkerIdentity returns true if LastWorkerIdentity is not nil.
func (v *SyncActivityRequest) IsSetLastWorkerIdentity() bool {
	return v != nil && v.LastWorkerIdentity != nil
}

// GetLastFailureDetails returns the value of LastFailureDetails if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetLastFailureDetails() (o []byte) {
	if v != nil && v.LastFailureDetails != nil {
		return v.LastFailureDetails
	}

	return
}

// IsSetLastFailureDetails returns true if LastFailureDetails is not nil.
func (v *SyncActivityRequest) IsSetLastFailureDetails() bool {
	return v != nil && v.LastFailureDetails != nil
}

// GetVersionHistory returns the value of VersionHistory if it is set or its
// zero value if it is unset.
func (v *SyncActivityRequest) GetVersionHistory() (o *shared.VersionHistory) {
	if v != nil && v.VersionHistory != nil {
		return v.VersionHistory
	}

	return
}

// IsSetVersionHistory returns true if VersionHistory is not nil.
func (v *SyncActivityRequest) IsSetVersionHistory() bool {
	return v != nil && v.VersionHistory != nil
}

type SyncShardStatusRequest struct {
	SourceCluster *string `json:"sourceCluster,omitempty"`
	ShardId       *int64  `json:"shardId,omitempty"`
	Timestamp     *int64  `json:"timestamp,omitempty"`
}

// ToWire translates a SyncShardStatusRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *SyncShardStatusRequest) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.SourceCluster != nil {
		w, err = wire.NewValueString(*(v.SourceCluster)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ShardId != nil {
		w, err = wire.NewValueI64(*(v.ShardId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.Timestamp != nil {
		w, err = wire.NewValueI64(*(v.Timestamp)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a SyncShardStatusRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a SyncShardStatusRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SyncShardStatusRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SyncShardStatusRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.SourceCluster = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ShardId = &x
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.Timestamp = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a SyncShardStatusRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SyncShardStatusRequest struct could not be encoded.
func (v *SyncShardStatusRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.SourceCluster != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.SourceCluster)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.ShardId)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.Timestamp != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.Timestamp)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a SyncShardStatusRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SyncShardStatusRequest struct could not be generated from the wire
// representation.
func (v *SyncShardStatusRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.SourceCluster = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ShardId = &x
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.Timestamp = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a SyncShardStatusRequest
// struct.
func (v *SyncShardStatusRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.SourceCluster != nil {
		fields[i] = fmt.Sprintf("SourceCluster: %v", *(v.SourceCluster))
		i++
	}
	if v.ShardId != nil {
		fields[i] = fmt.Sprintf("ShardId: %v", *(v.ShardId))
		i++
	}
	if v.Timestamp != nil {
		fields[i] = fmt.Sprintf("Timestamp: %v", *(v.Timestamp))
		i++
	}

	return fmt.Sprintf("SyncShardStatusRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this SyncShardStatusRequest match the
// provided SyncShardStatusRequest.
//
// This function performs a deep comparison.
func (v *SyncShardStatusRequest) Equals(rhs *SyncShardStatusRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.SourceCluster, rhs.SourceCluster) {
		return false
	}
	if !_I64_EqualsPtr(v.ShardId, rhs.ShardId) {
		return false
	}
	if !_I64_EqualsPtr(v.Timestamp, rhs.Timestamp) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of SyncShardStatusRequest.
func (v *SyncShardStatusRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.SourceCluster != nil {
		enc.AddString("sourceCluster", *v.SourceCluster)
	}
	if v.ShardId != nil {
		enc.AddInt64("shardId", *v.ShardId)
	}
	if v.Timestamp != nil {
		enc.AddInt64("timestamp", *v.Timestamp)
	}
	return err
}

// GetSourceCluster returns the value of SourceCluster if it is set or its
// zero value if it is unset.
func (v *SyncShardStatusRequest) GetSourceCluster() (o string) {
	if v != nil && v.SourceCluster != nil {
		return *v.SourceCluster
	}

	return
}

// IsSetSourceCluster returns true if SourceCluster is not nil.
func (v *SyncShardStatusRequest) IsSetSourceCluster() bool {
	return v != nil && v.SourceCluster != nil
}

// GetShardId returns the value of ShardId if it is set or its
// zero value if it is unset.
func (v *SyncShardStatusRequest) GetShardId() (o int64) {
	if v != nil && v.ShardId != nil {
		return *v.ShardId
	}

	return
}

// IsSetShardId returns true if ShardId is not nil.
func (v *SyncShardStatusRequest) IsSetShardId() bool {
	return v != nil && v.ShardId != nil
}

// GetTimestamp returns the value of Timestamp if it is set or its
// zero value if it is unset.
func (v *SyncShardStatusRequest) GetTimestamp() (o int64) {
	if v != nil && v.Timestamp != nil {
		return *v.Timestamp
	}

	return
}

// IsSetTimestamp returns true if Timestamp is not nil.
func (v *SyncShardStatusRequest) IsSetTimestamp() bool {
	return v != nil && v.Timestamp != nil
}

type TerminateWorkflowExecutionRequest struct {
	DomainUUID                *string                                   `json:"domainUUID,omitempty"`
	TerminateRequest          *shared.TerminateWorkflowExecutionRequest `json:"terminateRequest,omitempty"`
	ExternalWorkflowExecution *shared.WorkflowExecution                 `json:"externalWorkflowExecution,omitempty"`
	ChildWorkflowOnly         *bool                                     `json:"childWorkflowOnly,omitempty"`
}

// ToWire translates a TerminateWorkflowExecutionRequest struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *TerminateWorkflowExecutionRequest) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainUUID != nil {
		w, err = wire.NewValueString(*(v.DomainUUID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.TerminateRequest != nil {
		w, err = v.TerminateRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ExternalWorkflowExecution != nil {
		w, err = v.ExternalWorkflowExecution.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.ChildWorkflowOnly != nil {
		w, err = wire.NewValueBool(*(v.ChildWorkflowOnly)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _TerminateWorkflowExecutionRequest_Read(w wire.Value) (*shared.TerminateWorkflowExecutionRequest, error) {
	var v shared.TerminateWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a TerminateWorkflowExecutionRequest struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a TerminateWorkflowExecutionRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v TerminateWorkflowExecutionRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *TerminateWorkflowExecutionRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				var x string
				x, err = field.Value.GetString(), error(nil)
				v.DomainUUID = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TStruct {
				v.TerminateRequest, err = _TerminateWorkflowExecutionRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 30:
			if field.Value.Type() == wire.TStruct {
				v.ExternalWorkflowExecution, err = _WorkflowExecution_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 40:
			if field.Value.Type() == wire.TBool {
				var x bool
				x, err = field.Value.GetBool(), error(nil)
				v.ChildWorkflowOnly = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a TerminateWorkflowExecutionRequest struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a TerminateWorkflowExecutionRequest struct could not be encoded.
func (v *TerminateWorkflowExecutionRequest) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DomainUUID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
			return err
		}
		if err := sw.WriteString(*(v.DomainUUID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.TerminateRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.TerminateRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ExternalWorkflowExecution != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ExternalWorkflowExecution.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ChildWorkflowOnly != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TBool}); err != nil {
			return err
		}
		if err := sw.WriteBool(*(v.ChildWorkflowOnly)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _TerminateWorkflowExecutionRequest_Decode(sr stream.Reader) (*shared.TerminateWorkflowExecutionRequest, error) {
	var v shared.TerminateWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a TerminateWorkflowExecutionRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a TerminateWorkflowExecutionRequest struct could not be generated from the wire
// representation.
func (v *TerminateWorkflowExecutionRequest) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.DomainUUID = &x
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TStruct:
			v.TerminateRequest, err = _TerminateWorkflowExecutionRequest_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TStruct:
			v.ExternalWorkflowExecution, err = _WorkflowExecution_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 40 && fh.Type == wire.TBool:
			var x bool
			x, err = sr.ReadBool()
			v.ChildWorkflowOnly = &x
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a TerminateWorkflowExecutionRequest
// struct.
func (v *TerminateWorkflowExecutionRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.DomainUUID != nil {
		fields[i] = fmt.Sprintf("DomainUUID: %v", *(v.DomainUUID))
		i++
	}
	if v.TerminateRequest != nil {
		fields[i] = fmt.Sprintf("TerminateRequest: %v", v.TerminateRequest)
		i++
	}
	if v.ExternalWorkflowExecution != nil {
		fields[i] = fmt.Sprintf("ExternalWorkflowExecution: %v", v.ExternalWorkflowExecution)
		i++
	}
	if v.ChildWorkflowOnly != nil {
		fields[i] = fmt.Sprintf("ChildWorkflowOnly: %v", *(v.ChildWorkflowOnly))
		i++
	}

	return fmt.Sprintf("TerminateWorkflowExecutionRequest{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this TerminateWorkflowExecutionRequest match the
// provided TerminateWorkflowExecutionRequest.
//
// This function performs a deep comparison.
func (v *TerminateWorkflowExecutionRequest) Equals(rhs *TerminateWorkflowExecutionRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.DomainUUID, rhs.DomainUUID) {
		return false
	}
	if !((v.TerminateRequest == nil && rhs.TerminateRequest == nil) || (v.TerminateRequest != nil && rhs.TerminateRequest != nil && v.TerminateRequest.Equals(rhs.TerminateRequest))) {
		return false
	}
	if !((v.ExternalWorkflowExecution == nil && rhs.ExternalWorkflowExecution == nil) || (v.ExternalWorkflowExecution != nil && rhs.ExternalWorkflowExecution != nil && v.ExternalWorkflowExecution.Equals(rhs.ExternalWorkflowExecution))) {
		return false
	}
	if !_Bool_EqualsPtr(v.ChildWorkflowOnly, rhs.ChildWorkflowOnly) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of TerminateWorkflowExecutionRequest.
func (v *TerminateWorkflowExecutionRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainUUID != nil {
		enc.AddString("domainUUID", *v.DomainUUID)
	}
	if v.TerminateRequest != nil {
		err = multierr.Append(err, enc.AddObject("terminateRequest", v.TerminateRequest))
	}
	if v.ExternalWorkflowExecution != nil {
		err = multierr.Append(err, enc.AddObject("externalWorkflowExecution", v.ExternalWorkflowExecution))
	}
	if v.ChildWorkflowOnly != nil {
		enc.AddBool("childWorkflowOnly", *v.ChildWorkflowOnly)
	}
	return err
}

// GetDomainUUID returns the value of DomainUUID if it is set or its
// zero value if it is unset.
func (v *TerminateWorkflowExecutionRequest) GetDomainUUID() (o string) {
	if v != nil && v.DomainUUID != nil {
		return *v.DomainUUID
	}

	return
}

// IsSetDomainUUID returns true if DomainUUID is not nil.
func (v *TerminateWorkflowExecutionRequest) IsSetDomainUUID() bool {
	return v != nil && v.DomainUUID != nil
}

// GetTerminateRequest returns the value of TerminateRequest if it is set or its
// zero value if it is unset.
func (v *TerminateWorkflowExecutionRequest) GetTerminateRequest() (o *shared.TerminateWorkflowExecutionRequest) {
	if v != nil && v.TerminateRequest != nil {
		return v.TerminateRequest
	}

	return
}

// IsSetTerminateRequest returns true if TerminateRequest is not nil.
func (v *TerminateWorkflowExecutionRequest) IsSetTerminateRequest() bool {
	return v != nil && v.TerminateRequest != nil
}

// GetExternalWorkflowExecution returns the value of ExternalWorkflowExecution if it is set or its
// zero value if it is unset.
func (v *TerminateWorkflowExecutionRequest) GetExternalWorkflowExecution() (o *shared.WorkflowExecution) {
	if v != nil && v.ExternalWorkflowExecution != nil {
		return v.ExternalWorkflowExecution
	}

	return
}

// IsSetExternalWorkflowExecution returns true if ExternalWorkflowExecution is not nil.
func (v *TerminateWorkflowExecutionRequest) IsSetExternalWorkflowExecution() bool {
	return v != nil && v.ExternalWorkflowExecution != nil
}

// GetChildWorkflowOnly returns the value of ChildWorkflowOnly if it is set or its
// zero value if it is unset.
func (v *TerminateWorkflowExecutionRequest) GetChildWorkflowOnly() (o bool) {
	if v != nil && v.ChildWorkflowOnly != nil {
		return *v.ChildWorkflowOnly
	}

	return
}

// IsSetChildWorkflowOnly returns true if ChildWorkflowOnly is not nil.
func (v *TerminateWorkflowExecutionRequest) IsSetChildWorkflowOnly() bool {
	return v != nil && v.ChildWorkflowOnly != nil
}

// fields are required to encourage compact serialization, zeros are expected
type WeightedRatelimitCalls struct {
	// number of allowed requests since last call.
	// assumed to be <1m or so, saturates at MAX_INT32.
	Allowed int32 `json:"allowed,required"`
	// number of rejected requests since last call.
	// assumed to be <1m or so, saturates at MAX_INT32.
	Rejected int32 `json:"rejected,required"`
}

// ToWire translates a WeightedRatelimitCalls struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *WeightedRatelimitCalls) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	w, err = wire.NewValueI32(v.Allowed), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 10, Value: w}
	i++

	w, err = wire.NewValueI32(v.Rejected), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 20, Value: w}
	i++

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a WeightedRatelimitCalls struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a WeightedRatelimitCalls struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v WeightedRatelimitCalls
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *WeightedRatelimitCalls) FromWire(w wire.Value) error {
	var err error

	allowedIsSet := false
	rejectedIsSet := false

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TI32 {
				v.Allowed, err = field.Value.GetI32(), error(nil)
				if err != nil {
					return err
				}
				allowedIsSet = true
			}
		case 20:
			if field.Value.Type() == wire.TI32 {
				v.Rejected, err = field.Value.GetI32(), error(nil)
				if err != nil {
					return err
				}
				rejectedIsSet = true
			}
		}
	}

	if !allowedIsSet {
		return errors.New("field Allowed of WeightedRatelimitCalls is required")
	}

	if !rejectedIsSet {
		return errors.New("field Rejected of WeightedRatelimitCalls is required")
	}

	return nil
}

// Encode serializes a WeightedRatelimitCalls struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a WeightedRatelimitCalls struct could not be encoded.
func (v *WeightedRatelimitCalls) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TI32}); err != nil {
		return err
	}
	if err := sw.WriteInt32(v.Allowed); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TI32}); err != nil {
		return err
	}
	if err := sw.WriteInt32(v.Rejected); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a WeightedRatelimitCalls struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a WeightedRatelimitCalls struct could not be generated from the wire
// representation.
func (v *WeightedRatelimitCalls) Decode(sr stream.Reader) error {

	allowedIsSet := false
	rejectedIsSet := false

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TI32:
			v.Allowed, err = sr.ReadInt32()
			if err != nil {
				return err
			}
			allowedIsSet = true
		case fh.ID == 20 && fh.Type == wire.TI32:
			v.Rejected, err = sr.ReadInt32()
			if err != nil {
				return err
			}
			rejectedIsSet = true
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	if !allowedIsSet {
		return errors.New("field Allowed of WeightedRatelimitCalls is required")
	}

	if !rejectedIsSet {
		return errors.New("field Rejected of WeightedRatelimitCalls is required")
	}

	return nil
}

// String returns a readable string representation of a WeightedRatelimitCalls
// struct.
func (v *WeightedRatelimitCalls) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	fields[i] = fmt.Sprintf("Allowed: %v", v.Allowed)
	i++
	fields[i] = fmt.Sprintf("Rejected: %v", v.Rejected)
	i++

	return fmt.Sprintf("WeightedRatelimitCalls{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this WeightedRatelimitCalls match the
// provided WeightedRatelimitCalls.
//
// This function performs a deep comparison.
func (v *WeightedRatelimitCalls) Equals(rhs *WeightedRatelimitCalls) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !(v.Allowed == rhs.Allowed) {
		return false
	}
	if !(v.Rejected == rhs.Rejected) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of WeightedRatelimitCalls.
func (v *WeightedRatelimitCalls) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	enc.AddInt32("allowed", v.Allowed)
	enc.AddInt32("rejected", v.Rejected)
	return err
}

// GetAllowed returns the value of Allowed if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitCalls) GetAllowed() (o int32) {
	if v != nil {
		o = v.Allowed
	}
	return
}

// GetRejected returns the value of Rejected if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitCalls) GetRejected() (o int32) {
	if v != nil {
		o = v.Rejected
	}
	return
}

// first impl of ratelimiting data, result from aggregator to limiter.
//
// used in an Any with ValueType: WeightedRatelimitQuotasAnyType
type WeightedRatelimitQuotas struct {
	// RPS-weights to allow per key
	Quotas map[string]float64 `json:"quotas,required"`
}

type _Map_String_Double_MapItemList map[string]float64

func (m _Map_String_Double_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := wire.NewValueDouble(v), error(nil)
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_Double_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_Double_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_Double_MapItemList) ValueType() wire.Type {
	return wire.TDouble
}

func (_Map_String_Double_MapItemList) Close() {}

// ToWire translates a WeightedRatelimitQuotas struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *WeightedRatelimitQuotas) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Quotas == nil {
		return w, errors.New("field Quotas of WeightedRatelimitQuotas is required")
	}
	w, err = wire.NewValueMap(_Map_String_Double_MapItemList(v.Quotas)), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 10, Value: w}
	i++

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _Map_String_Double_Read(m wire.MapItemList) (map[string]float64, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TDouble {
		return nil, nil
	}

	o := make(map[string]float64, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := x.Value.GetDouble(), error(nil)
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a WeightedRatelimitQuotas struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a WeightedRatelimitQuotas struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v WeightedRatelimitQuotas
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *WeightedRatelimitQuotas) FromWire(w wire.Value) error {
	var err error

	quotasIsSet := false

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TMap {
				v.Quotas, err = _Map_String_Double_Read(field.Value.GetMap())
				if err != nil {
					return err
				}
				quotasIsSet = true
			}
		}
	}

	if !quotasIsSet {
		return errors.New("field Quotas of WeightedRatelimitQuotas is required")
	}

	return nil
}

func _Map_String_Double_Encode(val map[string]float64, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TDouble,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := sw.WriteDouble(v); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a WeightedRatelimitQuotas struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a WeightedRatelimitQuotas struct could not be encoded.
func (v *WeightedRatelimitQuotas) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Quotas == nil {
		return errors.New("field Quotas of WeightedRatelimitQuotas is required")
	}
	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TMap}); err != nil {
		return err
	}
	if err := _Map_String_Double_Encode(v.Quotas, sw); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

func _Map_String_Double_Decode(sr stream.Reader) (map[string]float64, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TDouble {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string]float64, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := sr.ReadDouble()
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a WeightedRatelimitQuotas struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a WeightedRatelimitQuotas struct could not be generated from the wire
// representation.
func (v *WeightedRatelimitQuotas) Decode(sr stream.Reader) error {

	quotasIsSet := false

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TMap:
			v.Quotas, err = _Map_String_Double_Decode(sr)
			if err != nil {
				return err
			}
			quotasIsSet = true
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	if !quotasIsSet {
		return errors.New("field Quotas of WeightedRatelimitQuotas is required")
	}

	return nil
}

// String returns a readable string representation of a WeightedRatelimitQuotas
// struct.
func (v *WeightedRatelimitQuotas) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	fields[i] = fmt.Sprintf("Quotas: %v", v.Quotas)
	i++

	return fmt.Sprintf("WeightedRatelimitQuotas{%v}", strings.Join(fields[:i], ", "))
}

func _Map_String_Double_Equals(lhs, rhs map[string]float64) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !(lv == rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this WeightedRatelimitQuotas match the
// provided WeightedRatelimitQuotas.
//
// This function performs a deep comparison.
func (v *WeightedRatelimitQuotas) Equals(rhs *WeightedRatelimitQuotas) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_Map_String_Double_Equals(v.Quotas, rhs.Quotas) {
		return false
	}

	return true
}

type _Map_String_Double_Zapper map[string]float64

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_Double_Zapper.
func (m _Map_String_Double_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		enc.AddFloat64((string)(k), v)
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of WeightedRatelimitQuotas.
func (v *WeightedRatelimitQuotas) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	err = multierr.Append(err, enc.AddObject("quotas", (_Map_String_Double_Zapper)(v.Quotas)))
	return err
}

// GetQuotas returns the value of Quotas if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitQuotas) GetQuotas() (o map[string]float64) {
	if v != nil {
		o = v.Quotas
	}
	return
}

// IsSetQuotas returns true if Quotas is not nil.
func (v *WeightedRatelimitQuotas) IsSetQuotas() bool {
	return v != nil && v.Quotas != nil
}

// first impl of ratelimiting data, collected by limiters and sent to aggregators.
//
// used in an Any with ValueType: WeightedRatelimitUsageAnyType
type WeightedRatelimitUsage struct {
	// unique, stable identifier of the calling host, to identify future data from the same host
	Caller string `json:"caller,required"`
	// milliseconds since last update call.  expected to be on the order of a few seconds or less.
	ElapsedMS int32 `json:"elapsedMS,required"`
	// per key, number of allowed vs rejected calls since last update.
	Calls map[string]*WeightedRatelimitCalls `json:"calls,required"`
}

type _Map_String_WeightedRatelimitCalls_MapItemList map[string]*WeightedRatelimitCalls

func (m _Map_String_WeightedRatelimitCalls_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*WeightedRatelimitCalls', key [%v]: value is nil", k)
		}
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := v.ToWire()
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_WeightedRatelimitCalls_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_WeightedRatelimitCalls_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_WeightedRatelimitCalls_MapItemList) ValueType() wire.Type {
	return wire.TStruct
}

func (_Map_String_WeightedRatelimitCalls_MapItemList) Close() {}

// ToWire translates a WeightedRatelimitUsage struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *WeightedRatelimitUsage) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	w, err = wire.NewValueString(v.Caller), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 10, Value: w}
	i++

	w, err = wire.NewValueI32(v.ElapsedMS), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 20, Value: w}
	i++
	if v.Calls == nil {
		return w, errors.New("field Calls of WeightedRatelimitUsage is required")
	}
	w, err = wire.NewValueMap(_Map_String_WeightedRatelimitCalls_MapItemList(v.Calls)), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 30, Value: w}
	i++

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _WeightedRatelimitCalls_Read(w wire.Value) (*WeightedRatelimitCalls, error) {
	var v WeightedRatelimitCalls
	err := v.FromWire(w)
	return &v, err
}

func _Map_String_WeightedRatelimitCalls_Read(m wire.MapItemList) (map[string]*WeightedRatelimitCalls, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make(map[string]*WeightedRatelimitCalls, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := _WeightedRatelimitCalls_Read(x.Value)
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a WeightedRatelimitUsage struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a WeightedRatelimitUsage struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v WeightedRatelimitUsage
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *WeightedRatelimitUsage) FromWire(w wire.Value) error {
	var err error

	callerIsSet := false
	elapsedMSIsSet := false
	callsIsSet := false

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TBinary {
				v.Caller, err = field.Value.GetString(), error(nil)
				if err != nil {
					return err
				}
				callerIsSet = true
			}
		case 20:
			if field.Value.Type() == wire.TI32 {
				v.ElapsedMS, err = field.Value.GetI32(), error(nil)
				if err != nil {
					return err
				}
				elapsedMSIsSet = true
			}
		case 30:
			if field.Value.Type() == wire.TMap {
				v.Calls, err = _Map_String_WeightedRatelimitCalls_Read(field.Value.GetMap())
				if err != nil {
					return err
				}
				callsIsSet = true
			}
		}
	}

	if !callerIsSet {
		return errors.New("field Caller of WeightedRatelimitUsage is required")
	}

	if !elapsedMSIsSet {
		return errors.New("field ElapsedMS of WeightedRatelimitUsage is required")
	}

	if !callsIsSet {
		return errors.New("field Calls of WeightedRatelimitUsage is required")
	}

	return nil
}

func _Map_String_WeightedRatelimitCalls_Encode(val map[string]*WeightedRatelimitCalls, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TStruct,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*WeightedRatelimitCalls', key [%v]: value is nil", k)
		}
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a WeightedRatelimitUsage struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a WeightedRatelimitUsage struct could not be encoded.
func (v *WeightedRatelimitUsage) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TBinary}); err != nil {
		return err
	}
	if err := sw.WriteString(v.Caller); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TI32}); err != nil {
		return err
	}
	if err := sw.WriteInt32(v.ElapsedMS); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	if v.Calls == nil {
		return errors.New("field Calls of WeightedRatelimitUsage is required")
	}
	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, Type: wire.TMap}); err != nil {
		return err
	}
	if err := _Map_String_WeightedRatelimitCalls_Encode(v.Calls, sw); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

func _WeightedRatelimitCalls_Decode(sr stream.Reader) (*WeightedRatelimitCalls, error) {
	var v WeightedRatelimitCalls
	err := v.Decode(sr)
	return &v, err
}

func _Map_String_WeightedRatelimitCalls_Decode(sr stream.Reader) (map[string]*WeightedRatelimitCalls, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TStruct {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string]*WeightedRatelimitCalls, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := _WeightedRatelimitCalls_Decode(sr)
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a WeightedRatelimitUsage struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a WeightedRatelimitUsage struct could not be generated from the wire
// representation.
func (v *WeightedRatelimitUsage) Decode(sr stream.Reader) error {

	callerIsSet := false
	elapsedMSIsSet := false
	callsIsSet := false

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TBinary:
			v.Caller, err = sr.ReadString()
			if err != nil {
				return err
			}
			callerIsSet = true
		case fh.ID == 20 && fh.Type == wire.TI32:
			v.ElapsedMS, err = sr.ReadInt32()
			if err != nil {
				return err
			}
			elapsedMSIsSet = true
		case fh.ID == 30 && fh.Type == wire.TMap:
			v.Calls, err = _Map_String_WeightedRatelimitCalls_Decode(sr)
			if err != nil {
				return err
			}
			callsIsSet = true
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	if !callerIsSet {
		return errors.New("field Caller of WeightedRatelimitUsage is required")
	}

	if !elapsedMSIsSet {
		return errors.New("field ElapsedMS of WeightedRatelimitUsage is required")
	}

	if !callsIsSet {
		return errors.New("field Calls of WeightedRatelimitUsage is required")
	}

	return nil
}

// String returns a readable string representation of a WeightedRatelimitUsage
// struct.
func (v *WeightedRatelimitUsage) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	fields[i] = fmt.Sprintf("Caller: %v", v.Caller)
	i++
	fields[i] = fmt.Sprintf("ElapsedMS: %v", v.ElapsedMS)
	i++
	fields[i] = fmt.Sprintf("Calls: %v", v.Calls)
	i++

	return fmt.Sprintf("WeightedRatelimitUsage{%v}", strings.Join(fields[:i], ", "))
}

func _Map_String_WeightedRatelimitCalls_Equals(lhs, rhs map[string]*WeightedRatelimitCalls) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !lv.Equals(rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this WeightedRatelimitUsage match the
// provided WeightedRatelimitUsage.
//
// This function performs a deep comparison.
func (v *WeightedRatelimitUsage) Equals(rhs *WeightedRatelimitUsage) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !(v.Caller == rhs.Caller) {
		return false
	}
	if !(v.ElapsedMS == rhs.ElapsedMS) {
		return false
	}
	if !_Map_String_WeightedRatelimitCalls_Equals(v.Calls, rhs.Calls) {
		return false
	}

	return true
}

type _Map_String_WeightedRatelimitCalls_Zapper map[string]*WeightedRatelimitCalls

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_WeightedRatelimitCalls_Zapper.
func (m _Map_String_WeightedRatelimitCalls_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		err = multierr.Append(err, enc.AddObject((string)(k), v))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of WeightedRatelimitUsage.
func (v *WeightedRatelimitUsage) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	enc.AddString("caller", v.Caller)
	enc.AddInt32("elapsedMS", v.ElapsedMS)
	err = multierr.Append(err, enc.AddObject("calls", (_Map_String_WeightedRatelimitCalls_Zapper)(v.Calls)))
	return err
}

// GetCaller returns the value of Caller if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitUsage) GetCaller() (o string) {
	if v != nil {
		o = v.Caller
	}
	return
}

// GetElapsedMS returns the value of ElapsedMS if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitUsage) GetElapsedMS() (o int32) {
	if v != nil {
		o = v.ElapsedMS
	}
	return
}

// GetCalls returns the value of Calls if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitUsage) GetCalls() (o map[string]*WeightedRatelimitCalls) {
	if v != nil {
		o = v.Calls
	}
	return
}

// IsSetCalls returns true if Calls is not nil.
func (v *WeightedRatelimitUsage) IsSetCalls() bool {
	return v != nil && v.Calls != nil
}

type WeightedRatelimitUsageQuotaEntry struct {
	// Amount of the quota that the receiving host can use, between 0 and 1
	Weight float64 `json:"weight,required"`
	// RPS estimated across the whole cluster
	Used float64 `json:"used,required"`
}

// ToWire translates a WeightedRatelimitUsageQuotaEntry struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *WeightedRatelimitUsageQuotaEntry) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	w, err = wire.NewValueDouble(v.Weight), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 10, Value: w}
	i++

	w, err = wire.NewValueDouble(v.Used), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 20, Value: w}
	i++

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a WeightedRatelimitUsageQuotaEntry struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a WeightedRatelimitUsageQuotaEntry struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v WeightedRatelimitUsageQuotaEntry
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *WeightedRatelimitUsageQuotaEntry) FromWire(w wire.Value) error {
	var err error

	weightIsSet := false
	usedIsSet := false

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TDouble {
				v.Weight, err = field.Value.GetDouble(), error(nil)
				if err != nil {
					return err
				}
				weightIsSet = true
			}
		case 20:
			if field.Value.Type() == wire.TDouble {
				v.Used, err = field.Value.GetDouble(), error(nil)
				if err != nil {
					return err
				}
				usedIsSet = true
			}
		}
	}

	if !weightIsSet {
		return errors.New("field Weight of WeightedRatelimitUsageQuotaEntry is required")
	}

	if !usedIsSet {
		return errors.New("field Used of WeightedRatelimitUsageQuotaEntry is required")
	}

	return nil
}

// Encode serializes a WeightedRatelimitUsageQuotaEntry struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a WeightedRatelimitUsageQuotaEntry struct could not be encoded.
func (v *WeightedRatelimitUsageQuotaEntry) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TDouble}); err != nil {
		return err
	}
	if err := sw.WriteDouble(v.Weight); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TDouble}); err != nil {
		return err
	}
	if err := sw.WriteDouble(v.Used); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a WeightedRatelimitUsageQuotaEntry struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a WeightedRatelimitUsageQuotaEntry struct could not be generated from the wire
// representation.
func (v *WeightedRatelimitUsageQuotaEntry) Decode(sr stream.Reader) error {

	weightIsSet := false
	usedIsSet := false

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TDouble:
			v.Weight, err = sr.ReadDouble()
			if err != nil {
				return err
			}
			weightIsSet = true
		case fh.ID == 20 && fh.Type == wire.TDouble:
			v.Used, err = sr.ReadDouble()
			if err != nil {
				return err
			}
			usedIsSet = true
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	if !weightIsSet {
		return errors.New("field Weight of WeightedRatelimitUsageQuotaEntry is required")
	}

	if !usedIsSet {
		return errors.New("field Used of WeightedRatelimitUsageQuotaEntry is required")
	}

	return nil
}

// String returns a readable string representation of a WeightedRatelimitUsageQuotaEntry
// struct.
func (v *WeightedRatelimitUsageQuotaEntry) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [2]string
	i := 0
	fields[i] = fmt.Sprintf("Weight: %v", v.Weight)
	i++
	fields[i] = fmt.Sprintf("Used: %v", v.Used)
	i++

	return fmt.Sprintf("WeightedRatelimitUsageQuotaEntry{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this WeightedRatelimitUsageQuotaEntry match the
// provided WeightedRatelimitUsageQuotaEntry.
//
// This function performs a deep comparison.
func (v *WeightedRatelimitUsageQuotaEntry) Equals(rhs *WeightedRatelimitUsageQuotaEntry) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !(v.Weight == rhs.Weight) {
		return false
	}
	if !(v.Used == rhs.Used) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of WeightedRatelimitUsageQuotaEntry.
func (v *WeightedRatelimitUsageQuotaEntry) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	enc.AddFloat64("weight", v.Weight)
	enc.AddFloat64("used", v.Used)
	return err
}

// GetWeight returns the value of Weight if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitUsageQuotaEntry) GetWeight() (o float64) {
	if v != nil {
		o = v.Weight
	}
	return
}

// GetUsed returns the value of Used if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitUsageQuotaEntry) GetUsed() (o float64) {
	if v != nil {
		o = v.Used
	}
	return
}

// second impl, includes unused-RPS data so limiters can decide if they
// want to allow exceeding limits when there is free space.
//
// used in an Any with ValueType: WeightedRatelimitUsageQuotasAnyType
type WeightedRatelimitUsageQuotas struct {
	// RPS weights and total usage per key
	Quotas map[string]*WeightedRatelimitUsageQuotaEntry `json:"quotas,required"`
}

type _Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList map[string]*WeightedRatelimitUsageQuotaEntry

func (m _Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*WeightedRatelimitUsageQuotaEntry', key [%v]: value is nil", k)
		}
		kw, err := wire.NewValueString(k), error(nil)
		if err != nil {
			return err
		}

		vw, err := v.ToWire()
		if err != nil {
			return err
		}
		err = f(wire.MapItem{Key: kw, Value: vw})
		if err != nil {
			return err
		}
	}
	return nil
}

func (m _Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList) Size() int {
	return len(m)
}

func (_Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList) KeyType() wire.Type {
	return wire.TBinary
}

func (_Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList) ValueType() wire.Type {
	return wire.TStruct
}

func (_Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList) Close() {}

// ToWire translates a WeightedRatelimitUsageQuotas struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *WeightedRatelimitUsageQuotas) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Quotas == nil {
		return w, errors.New("field Quotas of WeightedRatelimitUsageQuotas is required")
	}
	w, err = wire.NewValueMap(_Map_String_WeightedRatelimitUsageQuotaEntry_MapItemList(v.Quotas)), error(nil)
	if err != nil {
		return w, err
	}
	fields[i] = wire.Field{ID: 10, Value: w}
	i++

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _WeightedRatelimitUsageQuotaEntry_Read(w wire.Value) (*WeightedRatelimitUsageQuotaEntry, error) {
	var v WeightedRatelimitUsageQuotaEntry
	err := v.FromWire(w)
	return &v, err
}

func _Map_String_WeightedRatelimitUsageQuotaEntry_Read(m wire.MapItemList) (map[string]*WeightedRatelimitUsageQuotaEntry, error) {
	if m.KeyType() != wire.TBinary {
		return nil, nil
	}

	if m.ValueType() != wire.TStruct {
		return nil, nil
	}

	o := make(map[string]*WeightedRatelimitUsageQuotaEntry, m.Size())
	err := m.ForEach(func(x wire.MapItem) error {
		k, err := x.Key.GetString(), error(nil)
		if err != nil {
			return err
		}

		v, err := _WeightedRatelimitUsageQuotaEntry_Read(x.Value)
		if err != nil {
			return err
		}

		o[k] = v
		return nil
	})
	m.Close()
	return o, err
}

// FromWire deserializes a WeightedRatelimitUsageQuotas struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a WeightedRatelimitUsageQuotas struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v WeightedRatelimitUsageQuotas
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *WeightedRatelimitUsageQuotas) FromWire(w wire.Value) error {
	var err error

	quotasIsSet := false

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TMap {
				v.Quotas, err = _Map_String_WeightedRatelimitUsageQuotaEntry_Read(field.Value.GetMap())
				if err != nil {
					return err
				}
				quotasIsSet = true
			}
		}
	}

	if !quotasIsSet {
		return errors.New("field Quotas of WeightedRatelimitUsageQuotas is required")
	}

	return nil
}

func _Map_String_WeightedRatelimitUsageQuotaEntry_Encode(val map[string]*WeightedRatelimitUsageQuotaEntry, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TBinary,
		ValueType: wire.TStruct,
		Length:    len(val),
	}
	if err := sw.WriteMapBegin(mh); err != nil {
		return err
	}

	for k, v := range val {
		if v == nil {
			return fmt.Errorf("invalid map 'map[string]*WeightedRatelimitUsageQuotaEntry', key [%v]: value is nil", k)
		}
		if err := sw.WriteString(k); err != nil {
			return err
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

// Encode serializes a WeightedRatelimitUsageQuotas struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a WeightedRatelimitUsageQuotas struct could not be encoded.
func (v *WeightedRatelimitUsageQuotas) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Quotas == nil {
		return errors.New("field Quotas of WeightedRatelimitUsageQuotas is required")
	}
	if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TMap}); err != nil {
		return err
	}
	if err := _Map_String_WeightedRatelimitUsageQuotaEntry_Encode(v.Quotas, sw); err != nil {
		return err
	}
	if err := sw.WriteFieldEnd(); err != nil {
		return err
	}

	return sw.WriteStructEnd()
}

func _WeightedRatelimitUsageQuotaEntry_Decode(sr stream.Reader) (*WeightedRatelimitUsageQuotaEntry, error) {
	var v WeightedRatelimitUsageQuotaEntry
	err := v.Decode(sr)
	return &v, err
}

func _Map_String_WeightedRatelimitUsageQuotaEntry_Decode(sr stream.Reader) (map[string]*WeightedRatelimitUsageQuotaEntry, error) {
	mh, err := sr.ReadMapBegin()
	if err != nil {
		return nil, err
	}

	if mh.KeyType != wire.TBinary || mh.ValueType != wire.TStruct {
		for i := 0; i < mh.Length; i++ {
			if err := sr.Skip(mh.KeyType); err != nil {
				return nil, err
			}

			if err := sr.Skip(mh.ValueType); err != nil {
				return nil, err
			}
		}
		return nil, sr.ReadMapEnd()
	}

	o := make(map[string]*WeightedRatelimitUsageQuotaEntry, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadString()
		if err != nil {
			return nil, err
		}

		v, err := _WeightedRatelimitUsageQuotaEntry_Decode(sr)
		if err != nil {
			return nil, err
		}

		o[k] = v
	}

	if err = sr.ReadMapEnd(); err != nil {
		return nil, err
	}
	return o, err
}

// Decode deserializes a WeightedRatelimitUsageQuotas struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a WeightedRatelimitUsageQuotas struct could not be generated from the wire
// representation.
func (v *WeightedRatelimitUsageQuotas) Decode(sr stream.Reader) error {

	quotasIsSet := false

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 10 && fh.Type == wire.TMap:
			v.Quotas, err = _Map_String_WeightedRatelimitUsageQuotaEntry_Decode(sr)
			if err != nil {
				return err
			}
			quotasIsSet = true
		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	if !quotasIsSet {
		return errors.New("field Quotas of WeightedRatelimitUsageQuotas is required")
	}

	return nil
}

// String returns a readable string representation of a WeightedRatelimitUsageQuotas
// struct.
func (v *WeightedRatelimitUsageQuotas) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	fields[i] = fmt.Sprintf("Quotas: %v", v.Quotas)
	i++

	return fmt.Sprintf("WeightedRatelimitUsageQuotas{%v}", strings.Join(fields[:i], ", "))
}

func _Map_String_WeightedRatelimitUsageQuotaEntry_Equals(lhs, rhs map[string]*WeightedRatelimitUsageQuotaEntry) bool {
	if len(lhs) != len(rhs) {
		return false
	}

	for lk, lv := range lhs {
		rv, ok := rhs[lk]
		if !ok {
			return false
		}
		if !lv.Equals(rv) {
			return false
		}
	}
	return true
}

// Equals returns true if all the fields of this WeightedRatelimitUsageQuotas match the
// provided WeightedRatelimitUsageQuotas.
//
// This function performs a deep comparison.
func (v *WeightedRatelimitUsageQuotas) Equals(rhs *WeightedRatelimitUsageQuotas) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_Map_String_WeightedRatelimitUsageQuotaEntry_Equals(v.Quotas, rhs.Quotas) {
		return false
	}

	return true
}

type _Map_String_WeightedRatelimitUsageQuotaEntry_Zapper map[string]*WeightedRatelimitUsageQuotaEntry

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of _Map_String_WeightedRatelimitUsageQuotaEntry_Zapper.
func (m _Map_String_WeightedRatelimitUsageQuotaEntry_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	for k, v := range m {
		err = multierr.Append(err, enc.AddObject((string)(k), v))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of WeightedRatelimitUsageQuotas.
func (v *WeightedRatelimitUsageQuotas) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	err = multierr.Append(err, enc.AddObject("quotas", (_Map_String_WeightedRatelimitUsageQuotaEntry_Zapper)(v.Quotas)))
	return err
}

// GetQuotas returns the value of Quotas if it is set or its
// zero value if it is unset.
func (v *WeightedRatelimitUsageQuotas) GetQuotas() (o map[string]*WeightedRatelimitUsageQuotaEntry) {
	if v != nil {
		o = v.Quotas
	}
	return
}

// IsSetQuotas returns true if Quotas is not nil.
func (v *WeightedRatelimitUsageQuotas) IsSetQuotas() bool {
	return v != nil && v.Quotas != nil
}

// ThriftModule represents the IDL file used to generate this package.
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "history",
	Package:  "github.com/uber/cadence/.gen/go/history",
	FilePath: "history.thrift",
	SHA1:     "4f9bc03480287dbdd2c4c579e95be64a2750f07a",
	Includes: []*thriftreflect.ThriftModule{
		replicator.ThriftModule,
		shared.ThriftModule,
	},
	Raw: rawIDL,
}

const rawIDL = "// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\ninclude \"shared.thrift\"\ninclude \"replicator.thrift\"\n\nnamespace java com.uber.cadence.history\n\nexception EventAlreadyStartedError {\n  1: required string message\n}\n\nexception ShardOwnershipLostError {\n  10: optional string message\n  20: optional string owner\n}\n\nstruct ParentExecutionInfo {\n  10: optional string domainUUID\n  15: optional string domain\n  20: optional shared.WorkflowExecution execution\n  30: optional i64 (js.type = \"Long\") initiatedId\n}\n\nstruct StartWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.StartWorkflowExecutionRequest startRequest\n  30: optional ParentExecutionInfo parentExecutionInfo\n  40: optional i32 attempt\n  50: optional i64 (js.type = \"Long\") expirationTimestamp\n  55: optional shared.ContinueAsNewInitiator continueAsNewInitiator\n  56: optional string continuedFailureReason\n  57: optional binary continuedFailureDetails\n  58: optional binary lastCompletionResult\n  60: optional i32 firstDecisionTaskBackoffSeconds\n  62: optional map<string, string> partitionConfig\n}\n\nstruct DescribeMutableStateRequest{\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution execution\n}\n\nstruct DescribeMutableStateResponse{\n  30: optional string mutableStateInCache\n  40: optional string mutableStateInDatabase\n}\n\nstruct GetMutableStateRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution execution\n  30: optional i64 (js.type = \"Long\") expectedNextEventId\n  40: optional binary currentBranchToken\n  50: optional shared.VersionHistoryItem versionHistoryItem\n}\n\nstruct GetMutableStateResponse {\n  10: optional shared.WorkflowExecution execution\n  20: optional shared.WorkflowType workflowType\n  30: optional i64 (js.type = \"Long\") NextEventId\n  35: optional i64 (js.type = \"Long\") PreviousStartedEventId\n  40: optional i64 (js.type = \"Long\") LastFirstEventId\n  50: optional shared.TaskList taskList\n  60: optional shared.TaskList stickyTaskList\n  70: optional string clientLibraryVersion\n  80: optional string clientFeatureVersion\n  90: optional string clientImpl\n  //TODO: isWorkflowRunning is deprecating. workflowState is going replace this field\n  100: optional bool isWorkflowRunning\n  110: optional i32 stickyTaskListScheduleToStartTimeout\n  120: optional i32 eventStoreVersion\n  130: optional binary currentBranchToken\n  // TODO: when migrating to gRPC, make this a enum\n  // TODO: when migrating to gRPC, unify internal & external representation\n  // NOTE: workflowState & workflowCloseState are the same as persistence representation\n  150: optional i32 workflowState\n  160: optional i32 workflowCloseState\n  170: optional shared.VersionHistories versionHistories\n  180: optional bool isStickyTaskListEnabled\n  190: optional i64 (js.type = \"Long\") historySize\n}\n\nstruct PollMutableStateRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution execution\n  30: optional i64 (js.type = \"Long\") expectedNextEventId\n  40: optional binary currentBranchToken\n}\n\nstruct PollMutableStateResponse {\n  10: optional shared.WorkflowExecution execution\n  20: optional shared.WorkflowType workflowType\n  30: optional i64 (js.type = \"Long\") NextEventId\n  35: optional i64 (js.type = \"Long\") PreviousStartedEventId\n  40: optional i64 (js.type = \"Long\") LastFirstEventId\n  50: optional shared.TaskList taskList\n  60: optional shared.TaskList stickyTaskList\n  70: optional string clientLibraryVersion\n  80: optional string clientFeatureVersion\n  90: optional string clientImpl\n  100: optional i32 stickyTaskListScheduleToStartTimeout\n  110: optional binary currentBranchToken\n  130: optional shared.VersionHistories versionHistories\n  // TODO: when migrating to gRPC, make this a enum\n  // TODO: when migrating to gRPC, unify internal & external representation\n  // NOTE: workflowState & workflowCloseState are the same as persistence representation\n  140: optional i32 workflowState\n  150: optional i32 workflowCloseState\n}\n\nstruct ResetStickyTaskListRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution execution\n}\n\nstruct ResetStickyTaskListResponse {\n  // The reason to keep this response is to allow returning\n  // information in the future.\n}\n\nstruct RespondDecisionTaskCompletedRequest {\n  10: optional string domainUUID\n  20: optional shared.RespondDecisionTaskCompletedRequest completeRequest\n}\n\nstruct RespondDecisionTaskCompletedResponse {\n  10: optional RecordDecisionTaskStartedResponse startedResponse\n  20: optional map<string,shared.ActivityLocalDispatchInfo> activitiesToDispatchLocally\n}\n\nstruct RespondDecisionTaskFailedRequest {\n  10: optional string domainUUID\n  20: optional shared.RespondDecisionTaskFailedRequest failedRequest\n}\n\nstruct RecordActivityTaskHeartbeatRequest {\n  10: optional string domainUUID\n  20: optional shared.RecordActivityTaskHeartbeatRequest heartbeatRequest\n}\n\nstruct RespondActivityTaskCompletedRequest {\n  10: optional string domainUUID\n  20: optional shared.RespondActivityTaskCompletedRequest completeRequest\n}\n\nstruct RespondActivityTaskFailedRequest {\n  10: optional string domainUUID\n  20: optional shared.RespondActivityTaskFailedRequest failedRequest\n}\n\nstruct RespondActivityTaskCanceledRequest {\n  10: optional string domainUUID\n  20: optional shared.RespondActivityTaskCanceledRequest cancelRequest\n}\n\nstruct RefreshWorkflowTasksRequest {\n  10: optional string domainUIID\n  20: optional shared.RefreshWorkflowTasksRequest request\n}\n\nstruct RecordActivityTaskStartedRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution workflowExecution\n  30: optional i64 (js.type = \"Long\") scheduleId\n  40: optional i64 (js.type = \"Long\") taskId\n  45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n  50: optional shared.PollForActivityTaskRequest pollRequest\n}\n\nstruct RecordActivityTaskStartedResponse {\n  20: optional shared.HistoryEvent scheduledEvent\n  30: optional i64 (js.type = \"Long\") startedTimestamp\n  40: optional i64 (js.type = \"Long\") attempt\n  50: optional i64 (js.type = \"Long\") scheduledTimestampOfThisAttempt\n  60: optional binary heartbeatDetails\n  70: optional shared.WorkflowType workflowType\n  80: optional string workflowDomain\n}\n\nstruct RecordDecisionTaskStartedRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution workflowExecution\n  30: optional i64 (js.type = \"Long\") scheduleId\n  40: optional i64 (js.type = \"Long\") taskId\n  45: optional string requestId // Unique id of each poll request. Used to ensure at most once delivery of tasks.\n  50: optional shared.PollForDecisionTaskRequest pollRequest\n}\n\nstruct RecordDecisionTaskStartedResponse {\n  10: optional shared.WorkflowType workflowType\n  20: optional i64 (js.type = \"Long\") previousStartedEventId\n  30: optional i64 (js.type = \"Long\") scheduledEventId\n  40: optional i64 (js.type = \"Long\") startedEventId\n  50: optional i64 (js.type = \"Long\") nextEventId\n  60: optional i64 (js.type = \"Long\") attempt\n  70: optional bool stickyExecutionEnabled\n  80: optional shared.TransientDecisionInfo decisionInfo\n  90: optional shared.TaskList WorkflowExecutionTaskList\n  100: optional i32 eventStoreVersion\n  110: optional binary branchToken\n  120: optional i64 (js.type = \"Long\") scheduledTimestamp\n  130: optional i64 (js.type = \"Long\") startedTimestamp\n  140: optional map<string, shared.WorkflowQuery> queries\n  150: optional i64 (js.type = \"Long\") historySize\n}\n\nstruct SignalWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.SignalWorkflowExecutionRequest signalRequest\n  // workflow execution that requests this signal, for making sure\n  // the workflow being signaled is actually a child of the workflow\n  // making the request\n  30: optional shared.WorkflowExecution externalWorkflowExecution\n  40: optional bool childWorkflowOnly\n}\n\nstruct SignalWithStartWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.SignalWithStartWorkflowExecutionRequest signalWithStartRequest\n  30: optional map<string, string> partitionConfig\n}\n\nstruct RemoveSignalMutableStateRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution workflowExecution\n  30: optional string requestId\n}\n\nstruct TerminateWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.TerminateWorkflowExecutionRequest terminateRequest\n  // workflow execution that requests this termination, for making sure\n  // the workflow being terminated is actually a child of the workflow\n  // making the request\n  30: optional shared.WorkflowExecution externalWorkflowExecution\n  40: optional bool childWorkflowOnly\n}\n\nstruct ResetWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.ResetWorkflowExecutionRequest resetRequest\n}\n\nstruct RequestCancelWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.RequestCancelWorkflowExecutionRequest cancelRequest\n  // workflow execution that requests this cancellation, for making sure\n  // the workflow being cancelled is actually a child of the workflow\n  // making the request\n  30: optional i64 (js.type = \"Long\") externalInitiatedEventId\n  40: optional shared.WorkflowExecution externalWorkflowExecution\n  50: optional bool childWorkflowOnly\n}\n\nstruct ScheduleDecisionTaskRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution workflowExecution\n  30: optional bool isFirstDecision\n}\n\nstruct DescribeWorkflowExecutionRequest {\n  10: optional string domainUUID\n  20: optional shared.DescribeWorkflowExecutionRequest request\n}\n\n/**\n* RecordChildExecutionCompletedRequest is used for reporting the completion of child execution to parent workflow\n* execution which started it.  When a child execution is completed it creates this request and calls the\n* RecordChildExecutionCompleted API with the workflowExecution of parent.  It also sets the completedExecution of the\n* child as it could potentially be different than the ChildExecutionStartedEvent of parent in the situation when\n* child creates multiple runs through ContinueAsNew before finally completing.\n**/\nstruct RecordChildExecutionCompletedRequest {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution workflowExecution\n  30: optional i64 (js.type = \"Long\") initiatedId\n  40: optional shared.WorkflowExecution completedExecution\n  50: optional shared.HistoryEvent completionEvent\n  60: optional i64 (js.type = \"Long\") startedId\n}\n\nstruct ReplicateEventsV2Request {\n  10: optional string domainUUID\n  20: optional shared.WorkflowExecution workflowExecution\n  30: optional list<shared.VersionHistoryItem> versionHistoryItems\n  40: optional shared.DataBlob events\n  // new run events does not need version history since there is no prior events\n  60: optional shared.DataBlob newRunEvents\n}\n\nstruct SyncShardStatusRequest {\n  10: optional string sourceCluster\n  20: optional i64 (js.type = \"Long\") shardId\n  30: optional i64 (js.type = \"Long\") timestamp\n}\n\nstruct SyncActivityRequest {\n  10: optional string domainId\n  20: optional string workflowId\n  30: optional string runId\n  40: optional i64 (js.type = \"Long\") version\n  50: optional i64 (js.type = \"Long\") scheduledId\n  60: optional i64 (js.type = \"Long\") scheduledTime\n  70: optional i64 (js.type = \"Long\") startedId\n  80: optional i64 (js.type = \"Long\") startedTime\n  90: optional i64 (js.type = \"Long\") lastHeartbeatTime\n  100: optional binary details\n  110: optional i32 attempt\n  120: optional string lastFailureReason\n  130: optional string lastWorkerIdentity\n  140: optional binary lastFailureDetails\n  150: optional shared.VersionHistory versionHistory\n}\n\nstruct QueryWorkflowRequest {\n  10: optional string domainUUID\n  20: optional shared.QueryWorkflowRequest request\n}\n\nstruct QueryWorkflowResponse {\n  10: optional shared.QueryWorkflowResponse response\n}\n\nstruct ReapplyEventsRequest {\n  10: optional string domainUUID\n  20: optional shared.ReapplyEventsRequest request\n}\n\nstruct FailoverMarkerToken {\n  10: optional list<i32> shardIDs\n  20: optional replicator.FailoverMarkerAttributes failoverMarker\n}\n\nstruct NotifyFailoverMarkersRequest {\n  10: optional list<FailoverMarkerToken> failoverMarkerTokens\n}\n\nstruct ProcessingQueueStates {\n  10: optional map<string, list<ProcessingQueueState>> statesByCluster\n}\n\nstruct ProcessingQueueState {\n  10: optional i32 level\n  20: optional i64 ackLevel\n  30: optional i64 maxLevel\n  40: optional DomainFilter domainFilter\n}\n\nstruct DomainFilter {\n  10: optional list<string> domainIDs\n  20: optional bool reverseMatch\n}\n\nstruct GetFailoverInfoRequest {\n  10: optional string domainID\n}\n\nstruct GetFailoverInfoResponse {\n  10: optional i32 completedShardCount\n  20: optional list<i32> pendingShards\n}\n\nstruct RatelimitUpdateRequest {\n  /**\n  * impl-specific data.\n  *\n  * likely some simple top-level keys and then either:\n  *   - map<ratelimit-key-string, something>\n  *   - list<something>\n  *\n  * this is a single blob rather than a collection to save on\n  * repeated serialization of the type name, and to allow impls\n  * to choose whatever structures are most-convenient for them.\n  */\n  10: optional shared.Any data\n}\n\nstruct RatelimitUpdateResponse {\n  /**\n  * impl-specific data.\n  *\n  * likely some simple top-level keys and then either:\n  *   - map<ratelimit-key-string, something>\n  *   - list<something>\n  *\n  * this is a single blob rather than a collection to save on\n  * repeated serialization of the type name, and to allow impls\n  * to choose whatever structures are most-convenient for them.\n  */\n  10: optional shared.Any data\n}\n\n/**\n* first impl of ratelimiting data, collected by limiters and sent to aggregators.\n*\n* used in an Any with ValueType: WeightedRatelimitUsageAnyType\n*/\nstruct WeightedRatelimitUsage {\n  /** unique, stable identifier of the calling host, to identify future data from the same host */\n  10: required string caller\n  /** milliseconds since last update call.  expected to be on the order of a few seconds or less. */\n  20: required i32 elapsedMS\n  /** per key, number of allowed vs rejected calls since last update. */\n  30: required map<string, WeightedRatelimitCalls> calls\n}\n\n/** Any{ValueType} identifier for WeightedRatelimitUsage data */\nconst string WeightedRatelimitUsageAnyType = \"cadence:loadbalanced:update_request\"\n\n/** fields are required to encourage compact serialization, zeros are expected */\nstruct WeightedRatelimitCalls {\n  /**\n  * number of allowed requests since last call.\n  * assumed to be <1m or so, saturates at MAX_INT32.\n  */\n  10: required i32 allowed\n  /**\n  * number of rejected requests since last call.\n  * assumed to be <1m or so, saturates at MAX_INT32.\n  */\n  20: required i32 rejected\n}\n\n/**\n* first impl of ratelimiting data, result from aggregator to limiter.\n*\n* used in an Any with ValueType: WeightedRatelimitQuotasAnyType\n*/\nstruct WeightedRatelimitQuotas {\n  /** RPS-weights to allow per key */\n  10: required map<string,double> quotas\n}\n\n/** Any{ValueType} identifier for WeightedRatelimitQuotas data */\nconst string WeightedRatelimitQuotasAnyType = \"cadence:loadbalanced:update_response\"\n\n/**\n* second impl, includes unused-RPS data so limiters can decide if they\n* want to allow exceeding limits when there is free space.\n*\n* used in an Any with ValueType: WeightedRatelimitUsageQuotasAnyType\n*/\nstruct WeightedRatelimitUsageQuotas {\n  /** RPS weights and total usage per key */\n  10: required map<string,WeightedRatelimitUsageQuotaEntry> quotas\n}\n\nstruct WeightedRatelimitUsageQuotaEntry {\n  /** Amount of the quota that the receiving host can use, between 0 and 1 */\n  10: required double weight\n  /** RPS estimated across the whole cluster */\n  20: required double used\n}\n\nconst string WeightedRatelimitUsageQuotasAnyType = \"cadence:loadbalanced:update_response_used\"\n\n/**\n* HistoryService provides API to start a new long running workflow instance, as well as query and update the history\n* of workflow instances already created.\n**/\nservice HistoryService {\n  /**\n  * StartWorkflowExecution starts a new long running workflow instance.  It will create the instance with\n  * 'WorkflowExecutionStarted' event in history and also schedule the first DecisionTask for the worker to make the\n  * first decision for this instance.  It will return 'WorkflowExecutionAlreadyStartedError', if an instance already\n  * exists with same workflowId.\n  **/\n  shared.StartWorkflowExecutionResponse StartWorkflowExecution(1: StartWorkflowExecutionRequest startRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.WorkflowExecutionAlreadyStartedError sessionAlreadyExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n    )\n\n  /**\n  * Returns the information from mutable state of workflow execution.\n  * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service.\n  * It returns CurrentBranchChangedError if the workflow version branch has changed.\n  **/\n  GetMutableStateResponse GetMutableState(1: GetMutableStateRequest getRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.LimitExceededError limitExceededError,\n      6: shared.ServiceBusyError serviceBusyError,\n      7: shared.CurrentBranchChangedError currentBranchChangedError,\n    )\n\n  /**\n   * Returns the information from mutable state of workflow execution.\n   * It fails with 'EntityNotExistError' if specified workflow execution in unknown to the service.\n   * It returns CurrentBranchChangedError if the workflow version branch has changed.\n   **/\n   PollMutableStateResponse PollMutableState(1: PollMutableStateRequest pollRequest)\n     throws (\n       1: shared.BadRequestError badRequestError,\n       2: shared.InternalServiceError internalServiceError,\n       3: shared.EntityNotExistsError entityNotExistError,\n       4: ShardOwnershipLostError shardOwnershipLostError,\n       5: shared.LimitExceededError limitExceededError,\n       6: shared.ServiceBusyError serviceBusyError,\n       7: shared.CurrentBranchChangedError currentBranchChangedError,\n     )\n\n  /**\n  * Reset the sticky tasklist related information in mutable state of a given workflow.\n  * Things cleared are:\n  * 1. StickyTaskList\n  * 2. StickyScheduleToStartTimeout\n  * 3. ClientLibraryVersion\n  * 4. ClientFeatureVersion\n  * 5. ClientImpl\n  **/\n  ResetStickyTaskListResponse ResetStickyTaskList(1: ResetStickyTaskListRequest resetRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.LimitExceededError limitExceededError,\n      6: shared.ServiceBusyError serviceBusyError,\n      7: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RecordDecisionTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n  * a PollForDecisionTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n  * if the workflow's execution history already includes a record of the event starting.\n  **/\n  RecordDecisionTaskStartedResponse RecordDecisionTaskStarted(1: RecordDecisionTaskStartedRequest addRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: EventAlreadyStartedError eventAlreadyStartedError,\n      4: shared.EntityNotExistsError entityNotExistError,\n      5: ShardOwnershipLostError shardOwnershipLostError,\n      6: shared.DomainNotActiveError domainNotActiveError,\n      7: shared.LimitExceededError limitExceededError,\n      8: shared.ServiceBusyError serviceBusyError,\n      9: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RecordActivityTaskStarted is called by the Matchingservice before it hands a decision task to the application worker in response to\n  * a PollForActivityTask call. It records in the history the event that the decision task has started. It will return 'EventAlreadyStartedError',\n  * if the workflow's execution history already includes a record of the event starting.\n  **/\n  RecordActivityTaskStartedResponse RecordActivityTaskStarted(1: RecordActivityTaskStartedRequest addRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: EventAlreadyStartedError eventAlreadyStartedError,\n      4: shared.EntityNotExistsError entityNotExistError,\n      5: ShardOwnershipLostError shardOwnershipLostError,\n      6: shared.DomainNotActiveError domainNotActiveError,\n      7: shared.LimitExceededError limitExceededError,\n      8: shared.ServiceBusyError serviceBusyError,\n      9: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RespondDecisionTaskCompleted is called by application worker to complete a DecisionTask handed as a result of\n  * 'PollForDecisionTask' API call.  Completing a DecisionTask will result in new events for the workflow execution and\n  * potentially new ActivityTask being created for corresponding decisions.  It will also create a DecisionTaskCompleted\n  * event in the history for that session.  Use the 'taskToken' provided as response of PollForDecisionTask API call\n  * for completing the DecisionTask.\n  **/\n  RespondDecisionTaskCompletedResponse RespondDecisionTaskCompleted(1: RespondDecisionTaskCompletedRequest completeRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RespondDecisionTaskFailed is called by application worker to indicate failure.  This results in\n  * DecisionTaskFailedEvent written to the history and a new DecisionTask created.  This API can be used by client to\n  * either clear sticky tasklist or report ny panics during DecisionTask processing.\n  **/\n  void RespondDecisionTaskFailed(1: RespondDecisionTaskFailedRequest failedRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RecordActivityTaskHeartbeat is called by application worker while it is processing an ActivityTask.  If worker fails\n  * to heartbeat within 'heartbeatTimeoutSeconds' interval for the ActivityTask, then it will be marked as timedout and\n  * 'ActivityTaskTimedOut' event will be written to the workflow history.  Calling 'RecordActivityTaskHeartbeat' will\n  * fail with 'EntityNotExistsError' in such situations.  Use the 'taskToken' provided as response of\n  * PollForActivityTask API call for heartbeating.\n  **/\n  shared.RecordActivityTaskHeartbeatResponse RecordActivityTaskHeartbeat(1: RecordActivityTaskHeartbeatRequest heartbeatRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RespondActivityTaskCompleted is called by application worker when it is done processing an ActivityTask.  It will\n  * result in a new 'ActivityTaskCompleted' event being written to the workflow history and a new DecisionTask\n  * created for the workflow so new decisions could be made.  Use the 'taskToken' provided as response of\n  * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n  * anymore due to activity timeout.\n  **/\n  void  RespondActivityTaskCompleted(1: RespondActivityTaskCompletedRequest completeRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RespondActivityTaskFailed is called by application worker when it is done processing an ActivityTask.  It will\n  * result in a new 'ActivityTaskFailed' event being written to the workflow history and a new DecisionTask\n  * created for the workflow instance so new decisions could be made.  Use the 'taskToken' provided as response of\n  * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n  * anymore due to activity timeout.\n  **/\n  void RespondActivityTaskFailed(1: RespondActivityTaskFailedRequest failRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RespondActivityTaskCanceled is called by application worker when it is successfully canceled an ActivityTask.  It will\n  * result in a new 'ActivityTaskCanceled' event being written to the workflow history and a new DecisionTask\n  * created for the workflow instance so new decisions could be made.  Use the 'taskToken' provided as response of\n  * PollForActivityTask API call for completion. It fails with 'EntityNotExistsError' if the taskToken is not valid\n  * anymore due to activity timeout.\n  **/\n  void RespondActivityTaskCanceled(1: RespondActivityTaskCanceledRequest canceledRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * SignalWorkflowExecution is used to send a signal event to running workflow execution.  This results in\n  * WorkflowExecutionSignaled event recorded in the history and a decision task being created for the execution.\n  **/\n  void SignalWorkflowExecution(1: SignalWorkflowExecutionRequest signalRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.ServiceBusyError serviceBusyError,\n      7: shared.LimitExceededError limitExceededError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * SignalWithStartWorkflowExecution is used to ensure sending a signal event to a workflow execution.\n  * If workflow is running, this results in WorkflowExecutionSignaled event recorded in the history\n  * and a decision task being created for the execution.\n  * If workflow is not running or not found, it will first try start workflow with given WorkflowIDResuePolicy,\n  * and record WorkflowExecutionStarted and WorkflowExecutionSignaled event in case of success.\n  * It will return `WorkflowExecutionAlreadyStartedError` if start workflow failed with given policy.\n  **/\n  shared.StartWorkflowExecutionResponse SignalWithStartWorkflowExecution(1: SignalWithStartWorkflowExecutionRequest signalWithStartRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: ShardOwnershipLostError shardOwnershipLostError,\n      4: shared.DomainNotActiveError domainNotActiveError,\n      5: shared.LimitExceededError limitExceededError,\n      6: shared.ServiceBusyError serviceBusyError,\n      7: shared.WorkflowExecutionAlreadyStartedError workflowAlreadyStartedError,\n    )\n\n  /**\n  * RemoveSignalMutableState is used to remove a signal request ID that was previously recorded.  This is currently\n  * used to clean execution info when signal decision finished.\n  **/\n  void RemoveSignalMutableState(1: RemoveSignalMutableStateRequest removeRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * TerminateWorkflowExecution terminates an existing workflow execution by recording WorkflowExecutionTerminated event\n  * in the history and immediately terminating the execution instance.\n  **/\n  void TerminateWorkflowExecution(1: TerminateWorkflowExecutionRequest terminateRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * ResetWorkflowExecution reset an existing workflow execution by a firstEventID of a existing event batch\n  * in the history and immediately terminating the current execution instance.\n  * After reset, the history will grow from nextFirstEventID.\n  **/\n  shared.ResetWorkflowExecutionResponse ResetWorkflowExecution(1: ResetWorkflowExecutionRequest resetRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n    )\n\n  /**\n  * RequestCancelWorkflowExecution is called by application worker when it wants to request cancellation of a workflow instance.\n  * It will result in a new 'WorkflowExecutionCancelRequested' event being written to the workflow history and a new DecisionTask\n  * created for the workflow instance so new decisions could be made. It fails with\n  * 'WorkflowExecutionAlreadyCompletedError' if the workflow is not valid\n  * anymore due to completion or with 'EntityNotExistsError' if worfklow doesn't exist.\n  **/\n  void RequestCancelWorkflowExecution(1: RequestCancelWorkflowExecutionRequest cancelRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.CancellationAlreadyRequestedError cancellationAlreadyRequestedError,\n      6: shared.DomainNotActiveError domainNotActiveError,\n      7: shared.LimitExceededError limitExceededError,\n      8: shared.ServiceBusyError serviceBusyError,\n      10: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * ScheduleDecisionTask is used for creating a decision task for already started workflow execution.  This is mainly\n  * used by transfer queue processor during the processing of StartChildWorkflowExecution task, where it first starts\n  * child execution without creating the decision task and then calls this API after updating the mutable state of\n  * parent execution.\n  **/\n  void ScheduleDecisionTask(1: ScheduleDecisionTaskRequest scheduleRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * RecordChildExecutionCompleted is used for reporting the completion of child workflow execution to parent.\n  * This is mainly called by transfer queue processor during the processing of DeleteExecution task.\n  **/\n  void RecordChildExecutionCompleted(1: RecordChildExecutionCompletedRequest completionRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.DomainNotActiveError domainNotActiveError,\n      6: shared.LimitExceededError limitExceededError,\n      7: shared.ServiceBusyError serviceBusyError,\n      8: shared.WorkflowExecutionAlreadyCompletedError workflowExecutionAlreadyCompletedError,\n    )\n\n  /**\n  * DescribeWorkflowExecution returns information about the specified workflow execution.\n  **/\n  shared.DescribeWorkflowExecutionResponse DescribeWorkflowExecution(1: DescribeWorkflowExecutionRequest describeRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.LimitExceededError limitExceededError,\n      6: shared.ServiceBusyError serviceBusyError,\n    )\n\n  void ReplicateEventsV2(1: ReplicateEventsV2Request replicateV2Request)\n    throws (\n        1: shared.BadRequestError badRequestError,\n        2: shared.InternalServiceError internalServiceError,\n        3: shared.EntityNotExistsError entityNotExistError,\n        4: ShardOwnershipLostError shardOwnershipLostError,\n        5: shared.LimitExceededError limitExceededError,\n        6: shared.RetryTaskV2Error retryTaskError,\n        7: shared.ServiceBusyError serviceBusyError,\n    )\n\n  /**\n  * SyncShardStatus sync the status between shards\n  **/\n  void SyncShardStatus(1: SyncShardStatusRequest syncShardStatusRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.LimitExceededError limitExceededError,\n      6: shared.ServiceBusyError serviceBusyError,\n    )\n\n  /**\n  * SyncActivity sync the activity status\n  **/\n  void SyncActivity(1: SyncActivityRequest syncActivityRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.ServiceBusyError serviceBusyError,\n      7: shared.RetryTaskV2Error retryTaskV2Error,\n    )\n\n  /**\n  * DescribeMutableState returns information about the internal states of workflow mutable state.\n  **/\n  DescribeMutableStateResponse DescribeMutableState(1: DescribeMutableStateRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.EntityNotExistsError entityNotExistError,\n      4: shared.AccessDeniedError accessDeniedError,\n      5: ShardOwnershipLostError shardOwnershipLostError,\n      6: shared.LimitExceededError limitExceededError,\n    )\n\n  /**\n  * DescribeHistoryHost returns information about the internal states of a history host\n  **/\n  shared.DescribeHistoryHostResponse DescribeHistoryHost(1: shared.DescribeHistoryHostRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.AccessDeniedError accessDeniedError,\n    )\n\n  /**\n  * CloseShard close the shard\n  **/\n  void CloseShard(1: shared.CloseShardRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.AccessDeniedError accessDeniedError,\n    )\n\n  /**\n  * RemoveTask remove task based on type, taskid, shardid\n  **/\n  void RemoveTask(1: shared.RemoveTaskRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.AccessDeniedError accessDeniedError,\n    )\n\n  /**\n  * ResetQueue reset processing queue state based on cluster name and type\n  **/\n  void ResetQueue(1: shared.ResetQueueRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.AccessDeniedError accessDeniedError,\n    )\n\n  /**\n  * DescribeQueue return queue states based on cluster name and type\n  **/\n  shared.DescribeQueueResponse DescribeQueue(1: shared.DescribeQueueRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.AccessDeniedError accessDeniedError,\n    )\n\n  /**\n  * GetReplicationMessages return replication messages based on the read level\n  **/\n  replicator.GetReplicationMessagesResponse GetReplicationMessages(1: replicator.GetReplicationMessagesRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.LimitExceededError limitExceededError,\n      4: shared.ServiceBusyError serviceBusyError,\n      5: shared.ClientVersionNotSupportedError clientVersionNotSupportedError,\n    )\n\n  /**\n  * GetDLQReplicationMessages return replication messages based on dlq info\n  **/\n  replicator.GetDLQReplicationMessagesResponse GetDLQReplicationMessages(1: replicator.GetDLQReplicationMessagesRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n      4: shared.EntityNotExistsError entityNotExistError,\n    )\n\n  /**\n  * QueryWorkflow returns query result for a specified workflow execution\n  **/\n  QueryWorkflowResponse QueryWorkflow(1: QueryWorkflowRequest queryRequest)\n\tthrows (\n\t  1: shared.BadRequestError badRequestError,\n\t  2: shared.InternalServiceError internalServiceError,\n\t  3: shared.EntityNotExistsError entityNotExistError,\n\t  4: shared.QueryFailedError queryFailedError,\n\t  5: shared.LimitExceededError limitExceededError,\n\t  6: shared.ServiceBusyError serviceBusyError,\n\t  7: shared.ClientVersionNotSupportedError clientVersionNotSupportedError,\n\t)\n\n  /**\n  * ReapplyEvents applies stale events to the current workflow and current run\n  **/\n  void ReapplyEvents(1: ReapplyEventsRequest reapplyEventsRequest)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.DomainNotActiveError domainNotActiveError,\n      4: shared.LimitExceededError limitExceededError,\n      5: shared.ServiceBusyError serviceBusyError,\n      6: ShardOwnershipLostError shardOwnershipLostError,\n      7: shared.EntityNotExistsError entityNotExistError,\n    )\n\n  /**\n  * RefreshWorkflowTasks refreshes all tasks of a workflow\n  **/\n  void RefreshWorkflowTasks(1: RefreshWorkflowTasksRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.DomainNotActiveError domainNotActiveError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n      5: shared.ServiceBusyError serviceBusyError,\n      6: shared.EntityNotExistsError entityNotExistError,\n    )\n\n  /**\n  * ReadDLQMessages returns messages from DLQ\n  **/\n  replicator.ReadDLQMessagesResponse ReadDLQMessages(1: replicator.ReadDLQMessagesRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n      4: shared.EntityNotExistsError entityNotExistError,\n      5: ShardOwnershipLostError shardOwnershipLostError,\n    )\n\n  /**\n  * PurgeDLQMessages purges messages from DLQ\n  **/\n  void PurgeDLQMessages(1: replicator.PurgeDLQMessagesRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n      4: shared.EntityNotExistsError entityNotExistError,\n      5: ShardOwnershipLostError shardOwnershipLostError,\n    )\n\n  /**\n  * MergeDLQMessages merges messages from DLQ\n  **/\n  replicator.MergeDLQMessagesResponse MergeDLQMessages(1: replicator.MergeDLQMessagesRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n      4: shared.EntityNotExistsError entityNotExistError,\n      5: ShardOwnershipLostError shardOwnershipLostError,\n    )\n\n  /**\n  * NotifyFailoverMarkers sends failover marker to the failover coordinator\n  **/\n  void NotifyFailoverMarkers(1: NotifyFailoverMarkersRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n    )\n\n  /**\n  * GetCrossClusterTasks fetches cross cluster tasks\n  **/\n  shared.GetCrossClusterTasksResponse GetCrossClusterTasks(1: shared.GetCrossClusterTasksRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n    )\n\n  /**\n  * RespondCrossClusterTasksCompleted responds the result of processing cross cluster tasks\n  **/\n  shared.RespondCrossClusterTasksCompletedResponse RespondCrossClusterTasksCompleted(1: shared.RespondCrossClusterTasksCompletedRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n    )\n\n  /**\n  * GetFailoverInfo responds the failover info about an on-going graceful failover\n  **/\n  GetFailoverInfoResponse GetFailoverInfo(1: GetFailoverInfoRequest request)\n    throws (\n      1: shared.InternalServiceError internalServiceError,\n      2: shared.ServiceBusyError serviceBusyError,\n      3: ShardOwnershipLostError shardOwnershipLostError,\n      4: shared.EntityNotExistsError entityNotExistError,\n    )\n\n  /**\n  * RatelimitUpdate pushes global-ratelimiting data to aggregating hosts,\n  * and returns data describing how to update the caller's ratelimits.\n  *\n  * For more details, see github.com/uber/cadence/common/quotas/global documentation.\n  *\n  * Request and response structures are intentionally loosely defined, to allow plugging\n  * in externally-defined algorithms without changing protocol-level details.\n  **/\n  RatelimitUpdateResponse RatelimitUpdate(1: RatelimitUpdateRequest request)\n    throws (\n      1: shared.BadRequestError badRequestError,\n      2: shared.InternalServiceError internalServiceError,\n      3: shared.ServiceBusyError serviceBusyError,\n      4: ShardOwnershipLostError shardOwnershipLostError,\n    )\n}\n"

// HistoryService_CloseShard_Args represents the arguments for the HistoryService.CloseShard function.
//
// The arguments for CloseShard are sent and received over the wire as this struct.
type HistoryService_CloseShard_Args struct {
	Request *shared.CloseShardRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_CloseShard_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_CloseShard_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _CloseShardRequest_Read(w wire.Value) (*shared.CloseShardRequest, error) {
	var v shared.CloseShardRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_CloseShard_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_CloseShard_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_CloseShard_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_CloseShard_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _CloseShardRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_CloseShard_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_CloseShard_Args struct could not be encoded.
func (v *HistoryService_CloseShard_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _CloseShardRequest_Decode(sr stream.Reader) (*shared.CloseShardRequest, error) {
	var v shared.CloseShardRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_CloseShard_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_CloseShard_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_CloseShard_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _CloseShardRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_CloseShard_Args
// struct.
func (v *HistoryService_CloseShard_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_CloseShard_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_CloseShard_Args match the
// provided HistoryService_CloseShard_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_CloseShard_Args) Equals(rhs *HistoryService_CloseShard_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_CloseShard_Args.
func (v *HistoryService_CloseShard_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_CloseShard_Args) GetRequest() (o *shared.CloseShardRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_CloseShard_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "CloseShard" for this struct.
func (v *HistoryService_CloseShard_Args) MethodName() string {
	return "CloseShard"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_CloseShard_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_CloseShard_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.CloseShard
// function.
var HistoryService_CloseShard_Helper = struct {
	// Args accepts the parameters of CloseShard in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.CloseShardRequest,
	) *HistoryService_CloseShard_Args

	// IsException returns true if the given error can be thrown
	// by CloseShard.
	//
	// An error can be thrown by CloseShard only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for CloseShard
	// given the error returned by it. The provided error may
	// be nil if CloseShard did not fail.
	//
	// This allows mapping errors returned by CloseShard into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// CloseShard
	//
	//   err := CloseShard(args)
	//   result, err := HistoryService_CloseShard_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from CloseShard: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_CloseShard_Result, error)

	// UnwrapResponse takes the result struct for CloseShard
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if CloseShard threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_CloseShard_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_CloseShard_Result) error
}{}

func init() {
	HistoryService_CloseShard_Helper.Args = func(
		request *shared.CloseShardRequest,
	) *HistoryService_CloseShard_Args {
		return &HistoryService_CloseShard_Args{
			Request: request,
		}
	}

	HistoryService_CloseShard_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.AccessDeniedError:
			return true
		default:
			return false
		}
	}

	HistoryService_CloseShard_Helper.WrapResponse = func(err error) (*HistoryService_CloseShard_Result, error) {
		if err == nil {
			return &HistoryService_CloseShard_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_CloseShard_Result.BadRequestError")
			}
			return &HistoryService_CloseShard_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_CloseShard_Result.InternalServiceError")
			}
			return &HistoryService_CloseShard_Result{InternalServiceError: e}, nil
		case *shared.AccessDeniedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_CloseShard_Result.AccessDeniedError")
			}
			return &HistoryService_CloseShard_Result{AccessDeniedError: e}, nil
		}

		return nil, err
	}
	HistoryService_CloseShard_Helper.UnwrapResponse = func(result *HistoryService_CloseShard_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.AccessDeniedError != nil {
			err = result.AccessDeniedError
			return
		}
		return
	}

}

// HistoryService_CloseShard_Result represents the result of a HistoryService.CloseShard function call.
//
// The result of a CloseShard execution is sent and received over the wire as this struct.
type HistoryService_CloseShard_Result struct {
	BadRequestError      *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	AccessDeniedError    *shared.AccessDeniedError    `json:"accessDeniedError,omitempty"`
}

// ToWire translates a HistoryService_CloseShard_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_CloseShard_Result) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.AccessDeniedError != nil {
		w, err = v.AccessDeniedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_CloseShard_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _BadRequestError_Read(w wire.Value) (*shared.BadRequestError, error) {
	var v shared.BadRequestError
	err := v.FromWire(w)
	return &v, err
}

func _InternalServiceError_Read(w wire.Value) (*shared.InternalServiceError, error) {
	var v shared.InternalServiceError
	err := v.FromWire(w)
	return &v, err
}

func _AccessDeniedError_Read(w wire.Value) (*shared.AccessDeniedError, error) {
	var v shared.AccessDeniedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_CloseShard_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_CloseShard_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_CloseShard_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_CloseShard_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.AccessDeniedError, err = _AccessDeniedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_CloseShard_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_CloseShard_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_CloseShard_Result struct could not be encoded.
func (v *HistoryService_CloseShard_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AccessDeniedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AccessDeniedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_CloseShard_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _BadRequestError_Decode(sr stream.Reader) (*shared.BadRequestError, error) {
	var v shared.BadRequestError
	err := v.Decode(sr)
	return &v, err
}

func _InternalServiceError_Decode(sr stream.Reader) (*shared.InternalServiceError, error) {
	var v shared.InternalServiceError
	err := v.Decode(sr)
	return &v, err
}

func _AccessDeniedError_Decode(sr stream.Reader) (*shared.AccessDeniedError, error) {
	var v shared.AccessDeniedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_CloseShard_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_CloseShard_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_CloseShard_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.AccessDeniedError, err = _AccessDeniedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_CloseShard_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_CloseShard_Result
// struct.
func (v *HistoryService_CloseShard_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.AccessDeniedError != nil {
		fields[i] = fmt.Sprintf("AccessDeniedError: %v", v.AccessDeniedError)
		i++
	}

	return fmt.Sprintf("HistoryService_CloseShard_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_CloseShard_Result match the
// provided HistoryService_CloseShard_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_CloseShard_Result) Equals(rhs *HistoryService_CloseShard_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.AccessDeniedError == nil && rhs.AccessDeniedError == nil) || (v.AccessDeniedError != nil && rhs.AccessDeniedError != nil && v.AccessDeniedError.Equals(rhs.AccessDeniedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_CloseShard_Result.
func (v *HistoryService_CloseShard_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.AccessDeniedError != nil {
		err = multierr.Append(err, enc.AddObject("accessDeniedError", v.AccessDeniedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_CloseShard_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_CloseShard_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_CloseShard_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_CloseShard_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetAccessDeniedError returns the value of AccessDeniedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_CloseShard_Result) GetAccessDeniedError() (o *shared.AccessDeniedError) {
	if v != nil && v.AccessDeniedError != nil {
		return v.AccessDeniedError
	}

	return
}

// IsSetAccessDeniedError returns true if AccessDeniedError is not nil.
func (v *HistoryService_CloseShard_Result) IsSetAccessDeniedError() bool {
	return v != nil && v.AccessDeniedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "CloseShard" for this struct.
func (v *HistoryService_CloseShard_Result) MethodName() string {
	return "CloseShard"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_CloseShard_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_DescribeHistoryHost_Args represents the arguments for the HistoryService.DescribeHistoryHost function.
//
// The arguments for DescribeHistoryHost are sent and received over the wire as this struct.
type HistoryService_DescribeHistoryHost_Args struct {
	Request *shared.DescribeHistoryHostRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_DescribeHistoryHost_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeHistoryHost_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeHistoryHostRequest_Read(w wire.Value) (*shared.DescribeHistoryHostRequest, error) {
	var v shared.DescribeHistoryHostRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeHistoryHost_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeHistoryHost_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeHistoryHost_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeHistoryHost_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _DescribeHistoryHostRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_DescribeHistoryHost_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeHistoryHost_Args struct could not be encoded.
func (v *HistoryService_DescribeHistoryHost_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _DescribeHistoryHostRequest_Decode(sr stream.Reader) (*shared.DescribeHistoryHostRequest, error) {
	var v shared.DescribeHistoryHostRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeHistoryHost_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeHistoryHost_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeHistoryHost_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _DescribeHistoryHostRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeHistoryHost_Args
// struct.
func (v *HistoryService_DescribeHistoryHost_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeHistoryHost_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeHistoryHost_Args match the
// provided HistoryService_DescribeHistoryHost_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeHistoryHost_Args) Equals(rhs *HistoryService_DescribeHistoryHost_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeHistoryHost_Args.
func (v *HistoryService_DescribeHistoryHost_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeHistoryHost_Args) GetRequest() (o *shared.DescribeHistoryHostRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_DescribeHistoryHost_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "DescribeHistoryHost" for this struct.
func (v *HistoryService_DescribeHistoryHost_Args) MethodName() string {
	return "DescribeHistoryHost"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_DescribeHistoryHost_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_DescribeHistoryHost_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.DescribeHistoryHost
// function.
var HistoryService_DescribeHistoryHost_Helper = struct {
	// Args accepts the parameters of DescribeHistoryHost in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.DescribeHistoryHostRequest,
	) *HistoryService_DescribeHistoryHost_Args

	// IsException returns true if the given error can be thrown
	// by DescribeHistoryHost.
	//
	// An error can be thrown by DescribeHistoryHost only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for DescribeHistoryHost
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// DescribeHistoryHost into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by DescribeHistoryHost
	//
	//   value, err := DescribeHistoryHost(args)
	//   result, err := HistoryService_DescribeHistoryHost_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from DescribeHistoryHost: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.DescribeHistoryHostResponse, error) (*HistoryService_DescribeHistoryHost_Result, error)

	// UnwrapResponse takes the result struct for DescribeHistoryHost
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if DescribeHistoryHost threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_DescribeHistoryHost_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_DescribeHistoryHost_Result) (*shared.DescribeHistoryHostResponse, error)
}{}

func init() {
	HistoryService_DescribeHistoryHost_Helper.Args = func(
		request *shared.DescribeHistoryHostRequest,
	) *HistoryService_DescribeHistoryHost_Args {
		return &HistoryService_DescribeHistoryHost_Args{
			Request: request,
		}
	}

	HistoryService_DescribeHistoryHost_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.AccessDeniedError:
			return true
		default:
			return false
		}
	}

	HistoryService_DescribeHistoryHost_Helper.WrapResponse = func(success *shared.DescribeHistoryHostResponse, err error) (*HistoryService_DescribeHistoryHost_Result, error) {
		if err == nil {
			return &HistoryService_DescribeHistoryHost_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeHistoryHost_Result.BadRequestError")
			}
			return &HistoryService_DescribeHistoryHost_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeHistoryHost_Result.InternalServiceError")
			}
			return &HistoryService_DescribeHistoryHost_Result{InternalServiceError: e}, nil
		case *shared.AccessDeniedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeHistoryHost_Result.AccessDeniedError")
			}
			return &HistoryService_DescribeHistoryHost_Result{AccessDeniedError: e}, nil
		}

		return nil, err
	}
	HistoryService_DescribeHistoryHost_Helper.UnwrapResponse = func(result *HistoryService_DescribeHistoryHost_Result) (success *shared.DescribeHistoryHostResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.AccessDeniedError != nil {
			err = result.AccessDeniedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_DescribeHistoryHost_Result represents the result of a HistoryService.DescribeHistoryHost function call.
//
// The result of a DescribeHistoryHost execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_DescribeHistoryHost_Result struct {
	// Value returned by DescribeHistoryHost after a successful execution.
	Success              *shared.DescribeHistoryHostResponse `json:"success,omitempty"`
	BadRequestError      *shared.BadRequestError             `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError        `json:"internalServiceError,omitempty"`
	AccessDeniedError    *shared.AccessDeniedError           `json:"accessDeniedError,omitempty"`
}

// ToWire translates a HistoryService_DescribeHistoryHost_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeHistoryHost_Result) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.AccessDeniedError != nil {
		w, err = v.AccessDeniedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_DescribeHistoryHost_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeHistoryHostResponse_Read(w wire.Value) (*shared.DescribeHistoryHostResponse, error) {
	var v shared.DescribeHistoryHostResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeHistoryHost_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeHistoryHost_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeHistoryHost_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeHistoryHost_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _DescribeHistoryHostResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.AccessDeniedError, err = _AccessDeniedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeHistoryHost_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_DescribeHistoryHost_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeHistoryHost_Result struct could not be encoded.
func (v *HistoryService_DescribeHistoryHost_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AccessDeniedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AccessDeniedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeHistoryHost_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _DescribeHistoryHostResponse_Decode(sr stream.Reader) (*shared.DescribeHistoryHostResponse, error) {
	var v shared.DescribeHistoryHostResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeHistoryHost_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeHistoryHost_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeHistoryHost_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _DescribeHistoryHostResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.AccessDeniedError, err = _AccessDeniedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeHistoryHost_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeHistoryHost_Result
// struct.
func (v *HistoryService_DescribeHistoryHost_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.AccessDeniedError != nil {
		fields[i] = fmt.Sprintf("AccessDeniedError: %v", v.AccessDeniedError)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeHistoryHost_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeHistoryHost_Result match the
// provided HistoryService_DescribeHistoryHost_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeHistoryHost_Result) Equals(rhs *HistoryService_DescribeHistoryHost_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.AccessDeniedError == nil && rhs.AccessDeniedError == nil) || (v.AccessDeniedError != nil && rhs.AccessDeniedError != nil && v.AccessDeniedError.Equals(rhs.AccessDeniedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeHistoryHost_Result.
func (v *HistoryService_DescribeHistoryHost_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.AccessDeniedError != nil {
		err = multierr.Append(err, enc.AddObject("accessDeniedError", v.AccessDeniedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeHistoryHost_Result) GetSuccess() (o *shared.DescribeHistoryHostResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_DescribeHistoryHost_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeHistoryHost_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_DescribeHistoryHost_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeHistoryHost_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_DescribeHistoryHost_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetAccessDeniedError returns the value of AccessDeniedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeHistoryHost_Result) GetAccessDeniedError() (o *shared.AccessDeniedError) {
	if v != nil && v.AccessDeniedError != nil {
		return v.AccessDeniedError
	}

	return
}

// IsSetAccessDeniedError returns true if AccessDeniedError is not nil.
func (v *HistoryService_DescribeHistoryHost_Result) IsSetAccessDeniedError() bool {
	return v != nil && v.AccessDeniedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "DescribeHistoryHost" for this struct.
func (v *HistoryService_DescribeHistoryHost_Result) MethodName() string {
	return "DescribeHistoryHost"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_DescribeHistoryHost_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_DescribeMutableState_Args represents the arguments for the HistoryService.DescribeMutableState function.
//
// The arguments for DescribeMutableState are sent and received over the wire as this struct.
type HistoryService_DescribeMutableState_Args struct {
	Request *DescribeMutableStateRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_DescribeMutableState_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeMutableState_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeMutableStateRequest_Read(w wire.Value) (*DescribeMutableStateRequest, error) {
	var v DescribeMutableStateRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeMutableState_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeMutableState_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeMutableState_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeMutableState_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _DescribeMutableStateRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_DescribeMutableState_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeMutableState_Args struct could not be encoded.
func (v *HistoryService_DescribeMutableState_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _DescribeMutableStateRequest_Decode(sr stream.Reader) (*DescribeMutableStateRequest, error) {
	var v DescribeMutableStateRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeMutableState_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeMutableState_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeMutableState_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _DescribeMutableStateRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeMutableState_Args
// struct.
func (v *HistoryService_DescribeMutableState_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeMutableState_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeMutableState_Args match the
// provided HistoryService_DescribeMutableState_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeMutableState_Args) Equals(rhs *HistoryService_DescribeMutableState_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeMutableState_Args.
func (v *HistoryService_DescribeMutableState_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Args) GetRequest() (o *DescribeMutableStateRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_DescribeMutableState_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "DescribeMutableState" for this struct.
func (v *HistoryService_DescribeMutableState_Args) MethodName() string {
	return "DescribeMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_DescribeMutableState_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_DescribeMutableState_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.DescribeMutableState
// function.
var HistoryService_DescribeMutableState_Helper = struct {
	// Args accepts the parameters of DescribeMutableState in-order and returns
	// the arguments struct for the function.
	Args func(
		request *DescribeMutableStateRequest,
	) *HistoryService_DescribeMutableState_Args

	// IsException returns true if the given error can be thrown
	// by DescribeMutableState.
	//
	// An error can be thrown by DescribeMutableState only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for DescribeMutableState
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// DescribeMutableState into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by DescribeMutableState
	//
	//   value, err := DescribeMutableState(args)
	//   result, err := HistoryService_DescribeMutableState_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from DescribeMutableState: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*DescribeMutableStateResponse, error) (*HistoryService_DescribeMutableState_Result, error)

	// UnwrapResponse takes the result struct for DescribeMutableState
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if DescribeMutableState threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_DescribeMutableState_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_DescribeMutableState_Result) (*DescribeMutableStateResponse, error)
}{}

func init() {
	HistoryService_DescribeMutableState_Helper.Args = func(
		request *DescribeMutableStateRequest,
	) *HistoryService_DescribeMutableState_Args {
		return &HistoryService_DescribeMutableState_Args{
			Request: request,
		}
	}

	HistoryService_DescribeMutableState_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *shared.AccessDeniedError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		default:
			return false
		}
	}

	HistoryService_DescribeMutableState_Helper.WrapResponse = func(success *DescribeMutableStateResponse, err error) (*HistoryService_DescribeMutableState_Result, error) {
		if err == nil {
			return &HistoryService_DescribeMutableState_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeMutableState_Result.BadRequestError")
			}
			return &HistoryService_DescribeMutableState_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeMutableState_Result.InternalServiceError")
			}
			return &HistoryService_DescribeMutableState_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeMutableState_Result.EntityNotExistError")
			}
			return &HistoryService_DescribeMutableState_Result{EntityNotExistError: e}, nil
		case *shared.AccessDeniedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeMutableState_Result.AccessDeniedError")
			}
			return &HistoryService_DescribeMutableState_Result{AccessDeniedError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeMutableState_Result.ShardOwnershipLostError")
			}
			return &HistoryService_DescribeMutableState_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeMutableState_Result.LimitExceededError")
			}
			return &HistoryService_DescribeMutableState_Result{LimitExceededError: e}, nil
		}

		return nil, err
	}
	HistoryService_DescribeMutableState_Helper.UnwrapResponse = func(result *HistoryService_DescribeMutableState_Result) (success *DescribeMutableStateResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.AccessDeniedError != nil {
			err = result.AccessDeniedError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_DescribeMutableState_Result represents the result of a HistoryService.DescribeMutableState function call.
//
// The result of a DescribeMutableState execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_DescribeMutableState_Result struct {
	// Value returned by DescribeMutableState after a successful execution.
	Success                 *DescribeMutableStateResponse `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError       `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError  `json:"internalServiceError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError  `json:"entityNotExistError,omitempty"`
	AccessDeniedError       *shared.AccessDeniedError     `json:"accessDeniedError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError      `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError      *shared.LimitExceededError    `json:"limitExceededError,omitempty"`
}

// ToWire translates a HistoryService_DescribeMutableState_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeMutableState_Result) ToWire() (wire.Value, error) {
	var (
		fields [7]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.AccessDeniedError != nil {
		w, err = v.AccessDeniedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_DescribeMutableState_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeMutableStateResponse_Read(w wire.Value) (*DescribeMutableStateResponse, error) {
	var v DescribeMutableStateResponse
	err := v.FromWire(w)
	return &v, err
}

func _EntityNotExistsError_Read(w wire.Value) (*shared.EntityNotExistsError, error) {
	var v shared.EntityNotExistsError
	err := v.FromWire(w)
	return &v, err
}

func _ShardOwnershipLostError_Read(w wire.Value) (*ShardOwnershipLostError, error) {
	var v ShardOwnershipLostError
	err := v.FromWire(w)
	return &v, err
}

func _LimitExceededError_Read(w wire.Value) (*shared.LimitExceededError, error) {
	var v shared.LimitExceededError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeMutableState_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeMutableState_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeMutableState_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeMutableState_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _DescribeMutableStateResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.AccessDeniedError, err = _AccessDeniedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeMutableState_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_DescribeMutableState_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeMutableState_Result struct could not be encoded.
func (v *HistoryService_DescribeMutableState_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AccessDeniedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AccessDeniedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeMutableState_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _DescribeMutableStateResponse_Decode(sr stream.Reader) (*DescribeMutableStateResponse, error) {
	var v DescribeMutableStateResponse
	err := v.Decode(sr)
	return &v, err
}

func _EntityNotExistsError_Decode(sr stream.Reader) (*shared.EntityNotExistsError, error) {
	var v shared.EntityNotExistsError
	err := v.Decode(sr)
	return &v, err
}

func _ShardOwnershipLostError_Decode(sr stream.Reader) (*ShardOwnershipLostError, error) {
	var v ShardOwnershipLostError
	err := v.Decode(sr)
	return &v, err
}

func _LimitExceededError_Decode(sr stream.Reader) (*shared.LimitExceededError, error) {
	var v shared.LimitExceededError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeMutableState_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeMutableState_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeMutableState_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _DescribeMutableStateResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.AccessDeniedError, err = _AccessDeniedError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeMutableState_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeMutableState_Result
// struct.
func (v *HistoryService_DescribeMutableState_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [7]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.AccessDeniedError != nil {
		fields[i] = fmt.Sprintf("AccessDeniedError: %v", v.AccessDeniedError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeMutableState_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeMutableState_Result match the
// provided HistoryService_DescribeMutableState_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeMutableState_Result) Equals(rhs *HistoryService_DescribeMutableState_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.AccessDeniedError == nil && rhs.AccessDeniedError == nil) || (v.AccessDeniedError != nil && rhs.AccessDeniedError != nil && v.AccessDeniedError.Equals(rhs.AccessDeniedError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeMutableState_Result.
func (v *HistoryService_DescribeMutableState_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.AccessDeniedError != nil {
		err = multierr.Append(err, enc.AddObject("accessDeniedError", v.AccessDeniedError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetSuccess() (o *DescribeMutableStateResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetAccessDeniedError returns the value of AccessDeniedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetAccessDeniedError() (o *shared.AccessDeniedError) {
	if v != nil && v.AccessDeniedError != nil {
		return v.AccessDeniedError
	}

	return
}

// IsSetAccessDeniedError returns true if AccessDeniedError is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetAccessDeniedError() bool {
	return v != nil && v.AccessDeniedError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeMutableState_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_DescribeMutableState_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "DescribeMutableState" for this struct.
func (v *HistoryService_DescribeMutableState_Result) MethodName() string {
	return "DescribeMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_DescribeMutableState_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_DescribeQueue_Args represents the arguments for the HistoryService.DescribeQueue function.
//
// The arguments for DescribeQueue are sent and received over the wire as this struct.
type HistoryService_DescribeQueue_Args struct {
	Request *shared.DescribeQueueRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_DescribeQueue_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeQueue_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeQueueRequest_Read(w wire.Value) (*shared.DescribeQueueRequest, error) {
	var v shared.DescribeQueueRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeQueue_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeQueue_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeQueue_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeQueue_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _DescribeQueueRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_DescribeQueue_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeQueue_Args struct could not be encoded.
func (v *HistoryService_DescribeQueue_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _DescribeQueueRequest_Decode(sr stream.Reader) (*shared.DescribeQueueRequest, error) {
	var v shared.DescribeQueueRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeQueue_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeQueue_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeQueue_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _DescribeQueueRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeQueue_Args
// struct.
func (v *HistoryService_DescribeQueue_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeQueue_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeQueue_Args match the
// provided HistoryService_DescribeQueue_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeQueue_Args) Equals(rhs *HistoryService_DescribeQueue_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeQueue_Args.
func (v *HistoryService_DescribeQueue_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeQueue_Args) GetRequest() (o *shared.DescribeQueueRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_DescribeQueue_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "DescribeQueue" for this struct.
func (v *HistoryService_DescribeQueue_Args) MethodName() string {
	return "DescribeQueue"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_DescribeQueue_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_DescribeQueue_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.DescribeQueue
// function.
var HistoryService_DescribeQueue_Helper = struct {
	// Args accepts the parameters of DescribeQueue in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.DescribeQueueRequest,
	) *HistoryService_DescribeQueue_Args

	// IsException returns true if the given error can be thrown
	// by DescribeQueue.
	//
	// An error can be thrown by DescribeQueue only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for DescribeQueue
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// DescribeQueue into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by DescribeQueue
	//
	//   value, err := DescribeQueue(args)
	//   result, err := HistoryService_DescribeQueue_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from DescribeQueue: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.DescribeQueueResponse, error) (*HistoryService_DescribeQueue_Result, error)

	// UnwrapResponse takes the result struct for DescribeQueue
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if DescribeQueue threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_DescribeQueue_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_DescribeQueue_Result) (*shared.DescribeQueueResponse, error)
}{}

func init() {
	HistoryService_DescribeQueue_Helper.Args = func(
		request *shared.DescribeQueueRequest,
	) *HistoryService_DescribeQueue_Args {
		return &HistoryService_DescribeQueue_Args{
			Request: request,
		}
	}

	HistoryService_DescribeQueue_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.AccessDeniedError:
			return true
		default:
			return false
		}
	}

	HistoryService_DescribeQueue_Helper.WrapResponse = func(success *shared.DescribeQueueResponse, err error) (*HistoryService_DescribeQueue_Result, error) {
		if err == nil {
			return &HistoryService_DescribeQueue_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeQueue_Result.BadRequestError")
			}
			return &HistoryService_DescribeQueue_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeQueue_Result.InternalServiceError")
			}
			return &HistoryService_DescribeQueue_Result{InternalServiceError: e}, nil
		case *shared.AccessDeniedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeQueue_Result.AccessDeniedError")
			}
			return &HistoryService_DescribeQueue_Result{AccessDeniedError: e}, nil
		}

		return nil, err
	}
	HistoryService_DescribeQueue_Helper.UnwrapResponse = func(result *HistoryService_DescribeQueue_Result) (success *shared.DescribeQueueResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.AccessDeniedError != nil {
			err = result.AccessDeniedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_DescribeQueue_Result represents the result of a HistoryService.DescribeQueue function call.
//
// The result of a DescribeQueue execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_DescribeQueue_Result struct {
	// Value returned by DescribeQueue after a successful execution.
	Success              *shared.DescribeQueueResponse `json:"success,omitempty"`
	BadRequestError      *shared.BadRequestError       `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError  `json:"internalServiceError,omitempty"`
	AccessDeniedError    *shared.AccessDeniedError     `json:"accessDeniedError,omitempty"`
}

// ToWire translates a HistoryService_DescribeQueue_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeQueue_Result) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.AccessDeniedError != nil {
		w, err = v.AccessDeniedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_DescribeQueue_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeQueueResponse_Read(w wire.Value) (*shared.DescribeQueueResponse, error) {
	var v shared.DescribeQueueResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeQueue_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeQueue_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeQueue_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeQueue_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _DescribeQueueResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.AccessDeniedError, err = _AccessDeniedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeQueue_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_DescribeQueue_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeQueue_Result struct could not be encoded.
func (v *HistoryService_DescribeQueue_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AccessDeniedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AccessDeniedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeQueue_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _DescribeQueueResponse_Decode(sr stream.Reader) (*shared.DescribeQueueResponse, error) {
	var v shared.DescribeQueueResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeQueue_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeQueue_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeQueue_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _DescribeQueueResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.AccessDeniedError, err = _AccessDeniedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeQueue_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeQueue_Result
// struct.
func (v *HistoryService_DescribeQueue_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.AccessDeniedError != nil {
		fields[i] = fmt.Sprintf("AccessDeniedError: %v", v.AccessDeniedError)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeQueue_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeQueue_Result match the
// provided HistoryService_DescribeQueue_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeQueue_Result) Equals(rhs *HistoryService_DescribeQueue_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.AccessDeniedError == nil && rhs.AccessDeniedError == nil) || (v.AccessDeniedError != nil && rhs.AccessDeniedError != nil && v.AccessDeniedError.Equals(rhs.AccessDeniedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeQueue_Result.
func (v *HistoryService_DescribeQueue_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.AccessDeniedError != nil {
		err = multierr.Append(err, enc.AddObject("accessDeniedError", v.AccessDeniedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeQueue_Result) GetSuccess() (o *shared.DescribeQueueResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_DescribeQueue_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeQueue_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_DescribeQueue_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeQueue_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_DescribeQueue_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetAccessDeniedError returns the value of AccessDeniedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeQueue_Result) GetAccessDeniedError() (o *shared.AccessDeniedError) {
	if v != nil && v.AccessDeniedError != nil {
		return v.AccessDeniedError
	}

	return
}

// IsSetAccessDeniedError returns true if AccessDeniedError is not nil.
func (v *HistoryService_DescribeQueue_Result) IsSetAccessDeniedError() bool {
	return v != nil && v.AccessDeniedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "DescribeQueue" for this struct.
func (v *HistoryService_DescribeQueue_Result) MethodName() string {
	return "DescribeQueue"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_DescribeQueue_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_DescribeWorkflowExecution_Args represents the arguments for the HistoryService.DescribeWorkflowExecution function.
//
// The arguments for DescribeWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_DescribeWorkflowExecution_Args struct {
	DescribeRequest *DescribeWorkflowExecutionRequest `json:"describeRequest,omitempty"`
}

// ToWire translates a HistoryService_DescribeWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DescribeRequest != nil {
		w, err = v.DescribeRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeWorkflowExecutionRequest_1_Read(w wire.Value) (*DescribeWorkflowExecutionRequest, error) {
	var v DescribeWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.DescribeRequest, err = _DescribeWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_DescribeWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_DescribeWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.DescribeRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DescribeRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _DescribeWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*DescribeWorkflowExecutionRequest, error) {
	var v DescribeWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.DescribeRequest, err = _DescribeWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeWorkflowExecution_Args
// struct.
func (v *HistoryService_DescribeWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.DescribeRequest != nil {
		fields[i] = fmt.Sprintf("DescribeRequest: %v", v.DescribeRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeWorkflowExecution_Args match the
// provided HistoryService_DescribeWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeWorkflowExecution_Args) Equals(rhs *HistoryService_DescribeWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.DescribeRequest == nil && rhs.DescribeRequest == nil) || (v.DescribeRequest != nil && rhs.DescribeRequest != nil && v.DescribeRequest.Equals(rhs.DescribeRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeWorkflowExecution_Args.
func (v *HistoryService_DescribeWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DescribeRequest != nil {
		err = multierr.Append(err, enc.AddObject("describeRequest", v.DescribeRequest))
	}
	return err
}

// GetDescribeRequest returns the value of DescribeRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Args) GetDescribeRequest() (o *DescribeWorkflowExecutionRequest) {
	if v != nil && v.DescribeRequest != nil {
		return v.DescribeRequest
	}

	return
}

// IsSetDescribeRequest returns true if DescribeRequest is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Args) IsSetDescribeRequest() bool {
	return v != nil && v.DescribeRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "DescribeWorkflowExecution" for this struct.
func (v *HistoryService_DescribeWorkflowExecution_Args) MethodName() string {
	return "DescribeWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_DescribeWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_DescribeWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.DescribeWorkflowExecution
// function.
var HistoryService_DescribeWorkflowExecution_Helper = struct {
	// Args accepts the parameters of DescribeWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		describeRequest *DescribeWorkflowExecutionRequest,
	) *HistoryService_DescribeWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by DescribeWorkflowExecution.
	//
	// An error can be thrown by DescribeWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for DescribeWorkflowExecution
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// DescribeWorkflowExecution into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by DescribeWorkflowExecution
	//
	//   value, err := DescribeWorkflowExecution(args)
	//   result, err := HistoryService_DescribeWorkflowExecution_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from DescribeWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.DescribeWorkflowExecutionResponse, error) (*HistoryService_DescribeWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for DescribeWorkflowExecution
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if DescribeWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_DescribeWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_DescribeWorkflowExecution_Result) (*shared.DescribeWorkflowExecutionResponse, error)
}{}

func init() {
	HistoryService_DescribeWorkflowExecution_Helper.Args = func(
		describeRequest *DescribeWorkflowExecutionRequest,
	) *HistoryService_DescribeWorkflowExecution_Args {
		return &HistoryService_DescribeWorkflowExecution_Args{
			DescribeRequest: describeRequest,
		}
	}

	HistoryService_DescribeWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_DescribeWorkflowExecution_Helper.WrapResponse = func(success *shared.DescribeWorkflowExecutionResponse, err error) (*HistoryService_DescribeWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_DescribeWorkflowExecution_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_DescribeWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_DescribeWorkflowExecution_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeWorkflowExecution_Result.EntityNotExistError")
			}
			return &HistoryService_DescribeWorkflowExecution_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_DescribeWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_DescribeWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_DescribeWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_DescribeWorkflowExecution_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_DescribeWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_DescribeWorkflowExecution_Result) (success *shared.DescribeWorkflowExecutionResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_DescribeWorkflowExecution_Result represents the result of a HistoryService.DescribeWorkflowExecution function call.
//
// The result of a DescribeWorkflowExecution execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_DescribeWorkflowExecution_Result struct {
	// Value returned by DescribeWorkflowExecution after a successful execution.
	Success                 *shared.DescribeWorkflowExecutionResponse `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError                   `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError              `json:"internalServiceError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError              `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError                  `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError      *shared.LimitExceededError                `json:"limitExceededError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError                  `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_DescribeWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_DescribeWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [7]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_DescribeWorkflowExecution_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DescribeWorkflowExecutionResponse_Read(w wire.Value) (*shared.DescribeWorkflowExecutionResponse, error) {
	var v shared.DescribeWorkflowExecutionResponse
	err := v.FromWire(w)
	return &v, err
}

func _ServiceBusyError_Read(w wire.Value) (*shared.ServiceBusyError, error) {
	var v shared.ServiceBusyError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_DescribeWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_DescribeWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_DescribeWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_DescribeWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _DescribeWorkflowExecutionResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_DescribeWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_DescribeWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_DescribeWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _DescribeWorkflowExecutionResponse_Decode(sr stream.Reader) (*shared.DescribeWorkflowExecutionResponse, error) {
	var v shared.DescribeWorkflowExecutionResponse
	err := v.Decode(sr)
	return &v, err
}

func _ServiceBusyError_Decode(sr stream.Reader) (*shared.ServiceBusyError, error) {
	var v shared.ServiceBusyError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_DescribeWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_DescribeWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_DescribeWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _DescribeWorkflowExecutionResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_DescribeWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_DescribeWorkflowExecution_Result
// struct.
func (v *HistoryService_DescribeWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [7]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_DescribeWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_DescribeWorkflowExecution_Result match the
// provided HistoryService_DescribeWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_DescribeWorkflowExecution_Result) Equals(rhs *HistoryService_DescribeWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_DescribeWorkflowExecution_Result.
func (v *HistoryService_DescribeWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetSuccess() (o *shared.DescribeWorkflowExecutionResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_DescribeWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_DescribeWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "DescribeWorkflowExecution" for this struct.
func (v *HistoryService_DescribeWorkflowExecution_Result) MethodName() string {
	return "DescribeWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_DescribeWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_GetCrossClusterTasks_Args represents the arguments for the HistoryService.GetCrossClusterTasks function.
//
// The arguments for GetCrossClusterTasks are sent and received over the wire as this struct.
type HistoryService_GetCrossClusterTasks_Args struct {
	Request *shared.GetCrossClusterTasksRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_GetCrossClusterTasks_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetCrossClusterTasks_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetCrossClusterTasksRequest_Read(w wire.Value) (*shared.GetCrossClusterTasksRequest, error) {
	var v shared.GetCrossClusterTasksRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetCrossClusterTasks_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetCrossClusterTasks_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetCrossClusterTasks_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetCrossClusterTasks_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _GetCrossClusterTasksRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_GetCrossClusterTasks_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetCrossClusterTasks_Args struct could not be encoded.
func (v *HistoryService_GetCrossClusterTasks_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _GetCrossClusterTasksRequest_Decode(sr stream.Reader) (*shared.GetCrossClusterTasksRequest, error) {
	var v shared.GetCrossClusterTasksRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetCrossClusterTasks_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetCrossClusterTasks_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_GetCrossClusterTasks_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _GetCrossClusterTasksRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetCrossClusterTasks_Args
// struct.
func (v *HistoryService_GetCrossClusterTasks_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_GetCrossClusterTasks_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetCrossClusterTasks_Args match the
// provided HistoryService_GetCrossClusterTasks_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_GetCrossClusterTasks_Args) Equals(rhs *HistoryService_GetCrossClusterTasks_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetCrossClusterTasks_Args.
func (v *HistoryService_GetCrossClusterTasks_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetCrossClusterTasks_Args) GetRequest() (o *shared.GetCrossClusterTasksRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_GetCrossClusterTasks_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "GetCrossClusterTasks" for this struct.
func (v *HistoryService_GetCrossClusterTasks_Args) MethodName() string {
	return "GetCrossClusterTasks"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_GetCrossClusterTasks_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_GetCrossClusterTasks_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.GetCrossClusterTasks
// function.
var HistoryService_GetCrossClusterTasks_Helper = struct {
	// Args accepts the parameters of GetCrossClusterTasks in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.GetCrossClusterTasksRequest,
	) *HistoryService_GetCrossClusterTasks_Args

	// IsException returns true if the given error can be thrown
	// by GetCrossClusterTasks.
	//
	// An error can be thrown by GetCrossClusterTasks only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for GetCrossClusterTasks
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// GetCrossClusterTasks into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by GetCrossClusterTasks
	//
	//   value, err := GetCrossClusterTasks(args)
	//   result, err := HistoryService_GetCrossClusterTasks_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from GetCrossClusterTasks: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.GetCrossClusterTasksResponse, error) (*HistoryService_GetCrossClusterTasks_Result, error)

	// UnwrapResponse takes the result struct for GetCrossClusterTasks
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if GetCrossClusterTasks threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_GetCrossClusterTasks_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_GetCrossClusterTasks_Result) (*shared.GetCrossClusterTasksResponse, error)
}{}

func init() {
	HistoryService_GetCrossClusterTasks_Helper.Args = func(
		request *shared.GetCrossClusterTasksRequest,
	) *HistoryService_GetCrossClusterTasks_Args {
		return &HistoryService_GetCrossClusterTasks_Args{
			Request: request,
		}
	}

	HistoryService_GetCrossClusterTasks_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_GetCrossClusterTasks_Helper.WrapResponse = func(success *shared.GetCrossClusterTasksResponse, err error) (*HistoryService_GetCrossClusterTasks_Result, error) {
		if err == nil {
			return &HistoryService_GetCrossClusterTasks_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetCrossClusterTasks_Result.BadRequestError")
			}
			return &HistoryService_GetCrossClusterTasks_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetCrossClusterTasks_Result.InternalServiceError")
			}
			return &HistoryService_GetCrossClusterTasks_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetCrossClusterTasks_Result.ServiceBusyError")
			}
			return &HistoryService_GetCrossClusterTasks_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_GetCrossClusterTasks_Helper.UnwrapResponse = func(result *HistoryService_GetCrossClusterTasks_Result) (success *shared.GetCrossClusterTasksResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_GetCrossClusterTasks_Result represents the result of a HistoryService.GetCrossClusterTasks function call.
//
// The result of a GetCrossClusterTasks execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_GetCrossClusterTasks_Result struct {
	// Value returned by GetCrossClusterTasks after a successful execution.
	Success              *shared.GetCrossClusterTasksResponse `json:"success,omitempty"`
	BadRequestError      *shared.BadRequestError              `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError         `json:"internalServiceError,omitempty"`
	ServiceBusyError     *shared.ServiceBusyError             `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_GetCrossClusterTasks_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetCrossClusterTasks_Result) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_GetCrossClusterTasks_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetCrossClusterTasksResponse_Read(w wire.Value) (*shared.GetCrossClusterTasksResponse, error) {
	var v shared.GetCrossClusterTasksResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetCrossClusterTasks_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetCrossClusterTasks_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetCrossClusterTasks_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetCrossClusterTasks_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _GetCrossClusterTasksResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetCrossClusterTasks_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_GetCrossClusterTasks_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetCrossClusterTasks_Result struct could not be encoded.
func (v *HistoryService_GetCrossClusterTasks_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_GetCrossClusterTasks_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _GetCrossClusterTasksResponse_Decode(sr stream.Reader) (*shared.GetCrossClusterTasksResponse, error) {
	var v shared.GetCrossClusterTasksResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetCrossClusterTasks_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetCrossClusterTasks_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_GetCrossClusterTasks_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _GetCrossClusterTasksResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetCrossClusterTasks_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetCrossClusterTasks_Result
// struct.
func (v *HistoryService_GetCrossClusterTasks_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_GetCrossClusterTasks_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetCrossClusterTasks_Result match the
// provided HistoryService_GetCrossClusterTasks_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_GetCrossClusterTasks_Result) Equals(rhs *HistoryService_GetCrossClusterTasks_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetCrossClusterTasks_Result.
func (v *HistoryService_GetCrossClusterTasks_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetCrossClusterTasks_Result) GetSuccess() (o *shared.GetCrossClusterTasksResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_GetCrossClusterTasks_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetCrossClusterTasks_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_GetCrossClusterTasks_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetCrossClusterTasks_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_GetCrossClusterTasks_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetCrossClusterTasks_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_GetCrossClusterTasks_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "GetCrossClusterTasks" for this struct.
func (v *HistoryService_GetCrossClusterTasks_Result) MethodName() string {
	return "GetCrossClusterTasks"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_GetCrossClusterTasks_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_GetDLQReplicationMessages_Args represents the arguments for the HistoryService.GetDLQReplicationMessages function.
//
// The arguments for GetDLQReplicationMessages are sent and received over the wire as this struct.
type HistoryService_GetDLQReplicationMessages_Args struct {
	Request *replicator.GetDLQReplicationMessagesRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_GetDLQReplicationMessages_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetDLQReplicationMessages_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetDLQReplicationMessagesRequest_Read(w wire.Value) (*replicator.GetDLQReplicationMessagesRequest, error) {
	var v replicator.GetDLQReplicationMessagesRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetDLQReplicationMessages_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetDLQReplicationMessages_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetDLQReplicationMessages_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetDLQReplicationMessages_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _GetDLQReplicationMessagesRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_GetDLQReplicationMessages_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetDLQReplicationMessages_Args struct could not be encoded.
func (v *HistoryService_GetDLQReplicationMessages_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _GetDLQReplicationMessagesRequest_Decode(sr stream.Reader) (*replicator.GetDLQReplicationMessagesRequest, error) {
	var v replicator.GetDLQReplicationMessagesRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetDLQReplicationMessages_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetDLQReplicationMessages_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_GetDLQReplicationMessages_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _GetDLQReplicationMessagesRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetDLQReplicationMessages_Args
// struct.
func (v *HistoryService_GetDLQReplicationMessages_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_GetDLQReplicationMessages_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetDLQReplicationMessages_Args match the
// provided HistoryService_GetDLQReplicationMessages_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_GetDLQReplicationMessages_Args) Equals(rhs *HistoryService_GetDLQReplicationMessages_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetDLQReplicationMessages_Args.
func (v *HistoryService_GetDLQReplicationMessages_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetDLQReplicationMessages_Args) GetRequest() (o *replicator.GetDLQReplicationMessagesRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_GetDLQReplicationMessages_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "GetDLQReplicationMessages" for this struct.
func (v *HistoryService_GetDLQReplicationMessages_Args) MethodName() string {
	return "GetDLQReplicationMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_GetDLQReplicationMessages_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_GetDLQReplicationMessages_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.GetDLQReplicationMessages
// function.
var HistoryService_GetDLQReplicationMessages_Helper = struct {
	// Args accepts the parameters of GetDLQReplicationMessages in-order and returns
	// the arguments struct for the function.
	Args func(
		request *replicator.GetDLQReplicationMessagesRequest,
	) *HistoryService_GetDLQReplicationMessages_Args

	// IsException returns true if the given error can be thrown
	// by GetDLQReplicationMessages.
	//
	// An error can be thrown by GetDLQReplicationMessages only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for GetDLQReplicationMessages
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// GetDLQReplicationMessages into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by GetDLQReplicationMessages
	//
	//   value, err := GetDLQReplicationMessages(args)
	//   result, err := HistoryService_GetDLQReplicationMessages_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from GetDLQReplicationMessages: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*replicator.GetDLQReplicationMessagesResponse, error) (*HistoryService_GetDLQReplicationMessages_Result, error)

	// UnwrapResponse takes the result struct for GetDLQReplicationMessages
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if GetDLQReplicationMessages threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_GetDLQReplicationMessages_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_GetDLQReplicationMessages_Result) (*replicator.GetDLQReplicationMessagesResponse, error)
}{}

func init() {
	HistoryService_GetDLQReplicationMessages_Helper.Args = func(
		request *replicator.GetDLQReplicationMessagesRequest,
	) *HistoryService_GetDLQReplicationMessages_Args {
		return &HistoryService_GetDLQReplicationMessages_Args{
			Request: request,
		}
	}

	HistoryService_GetDLQReplicationMessages_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.EntityNotExistsError:
			return true
		default:
			return false
		}
	}

	HistoryService_GetDLQReplicationMessages_Helper.WrapResponse = func(success *replicator.GetDLQReplicationMessagesResponse, err error) (*HistoryService_GetDLQReplicationMessages_Result, error) {
		if err == nil {
			return &HistoryService_GetDLQReplicationMessages_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetDLQReplicationMessages_Result.BadRequestError")
			}
			return &HistoryService_GetDLQReplicationMessages_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetDLQReplicationMessages_Result.InternalServiceError")
			}
			return &HistoryService_GetDLQReplicationMessages_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetDLQReplicationMessages_Result.ServiceBusyError")
			}
			return &HistoryService_GetDLQReplicationMessages_Result{ServiceBusyError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetDLQReplicationMessages_Result.EntityNotExistError")
			}
			return &HistoryService_GetDLQReplicationMessages_Result{EntityNotExistError: e}, nil
		}

		return nil, err
	}
	HistoryService_GetDLQReplicationMessages_Helper.UnwrapResponse = func(result *HistoryService_GetDLQReplicationMessages_Result) (success *replicator.GetDLQReplicationMessagesResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_GetDLQReplicationMessages_Result represents the result of a HistoryService.GetDLQReplicationMessages function call.
//
// The result of a GetDLQReplicationMessages execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_GetDLQReplicationMessages_Result struct {
	// Value returned by GetDLQReplicationMessages after a successful execution.
	Success              *replicator.GetDLQReplicationMessagesResponse `json:"success,omitempty"`
	BadRequestError      *shared.BadRequestError                       `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError                  `json:"internalServiceError,omitempty"`
	ServiceBusyError     *shared.ServiceBusyError                      `json:"serviceBusyError,omitempty"`
	EntityNotExistError  *shared.EntityNotExistsError                  `json:"entityNotExistError,omitempty"`
}

// ToWire translates a HistoryService_GetDLQReplicationMessages_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetDLQReplicationMessages_Result) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_GetDLQReplicationMessages_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetDLQReplicationMessagesResponse_Read(w wire.Value) (*replicator.GetDLQReplicationMessagesResponse, error) {
	var v replicator.GetDLQReplicationMessagesResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetDLQReplicationMessages_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetDLQReplicationMessages_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetDLQReplicationMessages_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetDLQReplicationMessages_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _GetDLQReplicationMessagesResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetDLQReplicationMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_GetDLQReplicationMessages_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetDLQReplicationMessages_Result struct could not be encoded.
func (v *HistoryService_GetDLQReplicationMessages_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_GetDLQReplicationMessages_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _GetDLQReplicationMessagesResponse_Decode(sr stream.Reader) (*replicator.GetDLQReplicationMessagesResponse, error) {
	var v replicator.GetDLQReplicationMessagesResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetDLQReplicationMessages_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetDLQReplicationMessages_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_GetDLQReplicationMessages_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _GetDLQReplicationMessagesResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetDLQReplicationMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetDLQReplicationMessages_Result
// struct.
func (v *HistoryService_GetDLQReplicationMessages_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}

	return fmt.Sprintf("HistoryService_GetDLQReplicationMessages_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetDLQReplicationMessages_Result match the
// provided HistoryService_GetDLQReplicationMessages_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_GetDLQReplicationMessages_Result) Equals(rhs *HistoryService_GetDLQReplicationMessages_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetDLQReplicationMessages_Result.
func (v *HistoryService_GetDLQReplicationMessages_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetDLQReplicationMessages_Result) GetSuccess() (o *replicator.GetDLQReplicationMessagesResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_GetDLQReplicationMessages_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetDLQReplicationMessages_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_GetDLQReplicationMessages_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetDLQReplicationMessages_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_GetDLQReplicationMessages_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetDLQReplicationMessages_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_GetDLQReplicationMessages_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetDLQReplicationMessages_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_GetDLQReplicationMessages_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "GetDLQReplicationMessages" for this struct.
func (v *HistoryService_GetDLQReplicationMessages_Result) MethodName() string {
	return "GetDLQReplicationMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_GetDLQReplicationMessages_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_GetFailoverInfo_Args represents the arguments for the HistoryService.GetFailoverInfo function.
//
// The arguments for GetFailoverInfo are sent and received over the wire as this struct.
type HistoryService_GetFailoverInfo_Args struct {
	Request *GetFailoverInfoRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_GetFailoverInfo_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetFailoverInfo_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetFailoverInfoRequest_Read(w wire.Value) (*GetFailoverInfoRequest, error) {
	var v GetFailoverInfoRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetFailoverInfo_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetFailoverInfo_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetFailoverInfo_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetFailoverInfo_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _GetFailoverInfoRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_GetFailoverInfo_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetFailoverInfo_Args struct could not be encoded.
func (v *HistoryService_GetFailoverInfo_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _GetFailoverInfoRequest_Decode(sr stream.Reader) (*GetFailoverInfoRequest, error) {
	var v GetFailoverInfoRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetFailoverInfo_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetFailoverInfo_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_GetFailoverInfo_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _GetFailoverInfoRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetFailoverInfo_Args
// struct.
func (v *HistoryService_GetFailoverInfo_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_GetFailoverInfo_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetFailoverInfo_Args match the
// provided HistoryService_GetFailoverInfo_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_GetFailoverInfo_Args) Equals(rhs *HistoryService_GetFailoverInfo_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetFailoverInfo_Args.
func (v *HistoryService_GetFailoverInfo_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetFailoverInfo_Args) GetRequest() (o *GetFailoverInfoRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_GetFailoverInfo_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "GetFailoverInfo" for this struct.
func (v *HistoryService_GetFailoverInfo_Args) MethodName() string {
	return "GetFailoverInfo"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_GetFailoverInfo_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_GetFailoverInfo_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.GetFailoverInfo
// function.
var HistoryService_GetFailoverInfo_Helper = struct {
	// Args accepts the parameters of GetFailoverInfo in-order and returns
	// the arguments struct for the function.
	Args func(
		request *GetFailoverInfoRequest,
	) *HistoryService_GetFailoverInfo_Args

	// IsException returns true if the given error can be thrown
	// by GetFailoverInfo.
	//
	// An error can be thrown by GetFailoverInfo only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for GetFailoverInfo
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// GetFailoverInfo into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by GetFailoverInfo
	//
	//   value, err := GetFailoverInfo(args)
	//   result, err := HistoryService_GetFailoverInfo_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from GetFailoverInfo: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*GetFailoverInfoResponse, error) (*HistoryService_GetFailoverInfo_Result, error)

	// UnwrapResponse takes the result struct for GetFailoverInfo
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if GetFailoverInfo threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_GetFailoverInfo_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_GetFailoverInfo_Result) (*GetFailoverInfoResponse, error)
}{}

func init() {
	HistoryService_GetFailoverInfo_Helper.Args = func(
		request *GetFailoverInfoRequest,
	) *HistoryService_GetFailoverInfo_Args {
		return &HistoryService_GetFailoverInfo_Args{
			Request: request,
		}
	}

	HistoryService_GetFailoverInfo_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.EntityNotExistsError:
			return true
		default:
			return false
		}
	}

	HistoryService_GetFailoverInfo_Helper.WrapResponse = func(success *GetFailoverInfoResponse, err error) (*HistoryService_GetFailoverInfo_Result, error) {
		if err == nil {
			return &HistoryService_GetFailoverInfo_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetFailoverInfo_Result.InternalServiceError")
			}
			return &HistoryService_GetFailoverInfo_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetFailoverInfo_Result.ServiceBusyError")
			}
			return &HistoryService_GetFailoverInfo_Result{ServiceBusyError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetFailoverInfo_Result.ShardOwnershipLostError")
			}
			return &HistoryService_GetFailoverInfo_Result{ShardOwnershipLostError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetFailoverInfo_Result.EntityNotExistError")
			}
			return &HistoryService_GetFailoverInfo_Result{EntityNotExistError: e}, nil
		}

		return nil, err
	}
	HistoryService_GetFailoverInfo_Helper.UnwrapResponse = func(result *HistoryService_GetFailoverInfo_Result) (success *GetFailoverInfoResponse, err error) {
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_GetFailoverInfo_Result represents the result of a HistoryService.GetFailoverInfo function call.
//
// The result of a GetFailoverInfo execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_GetFailoverInfo_Result struct {
	// Value returned by GetFailoverInfo after a successful execution.
	Success                 *GetFailoverInfoResponse     `json:"success,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"`
}

// ToWire translates a HistoryService_GetFailoverInfo_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetFailoverInfo_Result) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_GetFailoverInfo_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetFailoverInfoResponse_Read(w wire.Value) (*GetFailoverInfoResponse, error) {
	var v GetFailoverInfoResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetFailoverInfo_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetFailoverInfo_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetFailoverInfo_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetFailoverInfo_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _GetFailoverInfoResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetFailoverInfo_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_GetFailoverInfo_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetFailoverInfo_Result struct could not be encoded.
func (v *HistoryService_GetFailoverInfo_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_GetFailoverInfo_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _GetFailoverInfoResponse_Decode(sr stream.Reader) (*GetFailoverInfoResponse, error) {
	var v GetFailoverInfoResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetFailoverInfo_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetFailoverInfo_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_GetFailoverInfo_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _GetFailoverInfoResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetFailoverInfo_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetFailoverInfo_Result
// struct.
func (v *HistoryService_GetFailoverInfo_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}

	return fmt.Sprintf("HistoryService_GetFailoverInfo_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetFailoverInfo_Result match the
// provided HistoryService_GetFailoverInfo_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_GetFailoverInfo_Result) Equals(rhs *HistoryService_GetFailoverInfo_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetFailoverInfo_Result.
func (v *HistoryService_GetFailoverInfo_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetFailoverInfo_Result) GetSuccess() (o *GetFailoverInfoResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_GetFailoverInfo_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetFailoverInfo_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_GetFailoverInfo_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetFailoverInfo_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_GetFailoverInfo_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetFailoverInfo_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_GetFailoverInfo_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetFailoverInfo_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_GetFailoverInfo_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "GetFailoverInfo" for this struct.
func (v *HistoryService_GetFailoverInfo_Result) MethodName() string {
	return "GetFailoverInfo"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_GetFailoverInfo_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_GetMutableState_Args represents the arguments for the HistoryService.GetMutableState function.
//
// The arguments for GetMutableState are sent and received over the wire as this struct.
type HistoryService_GetMutableState_Args struct {
	GetRequest *GetMutableStateRequest `json:"getRequest,omitempty"`
}

// ToWire translates a HistoryService_GetMutableState_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetMutableState_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.GetRequest != nil {
		w, err = v.GetRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetMutableStateRequest_Read(w wire.Value) (*GetMutableStateRequest, error) {
	var v GetMutableStateRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetMutableState_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetMutableState_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetMutableState_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetMutableState_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.GetRequest, err = _GetMutableStateRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_GetMutableState_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetMutableState_Args struct could not be encoded.
func (v *HistoryService_GetMutableState_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.GetRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.GetRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _GetMutableStateRequest_Decode(sr stream.Reader) (*GetMutableStateRequest, error) {
	var v GetMutableStateRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetMutableState_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetMutableState_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_GetMutableState_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.GetRequest, err = _GetMutableStateRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetMutableState_Args
// struct.
func (v *HistoryService_GetMutableState_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.GetRequest != nil {
		fields[i] = fmt.Sprintf("GetRequest: %v", v.GetRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_GetMutableState_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetMutableState_Args match the
// provided HistoryService_GetMutableState_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_GetMutableState_Args) Equals(rhs *HistoryService_GetMutableState_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.GetRequest == nil && rhs.GetRequest == nil) || (v.GetRequest != nil && rhs.GetRequest != nil && v.GetRequest.Equals(rhs.GetRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetMutableState_Args.
func (v *HistoryService_GetMutableState_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.GetRequest != nil {
		err = multierr.Append(err, enc.AddObject("getRequest", v.GetRequest))
	}
	return err
}

// GetGetRequest returns the value of GetRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Args) GetGetRequest() (o *GetMutableStateRequest) {
	if v != nil && v.GetRequest != nil {
		return v.GetRequest
	}

	return
}

// IsSetGetRequest returns true if GetRequest is not nil.
func (v *HistoryService_GetMutableState_Args) IsSetGetRequest() bool {
	return v != nil && v.GetRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "GetMutableState" for this struct.
func (v *HistoryService_GetMutableState_Args) MethodName() string {
	return "GetMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_GetMutableState_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_GetMutableState_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.GetMutableState
// function.
var HistoryService_GetMutableState_Helper = struct {
	// Args accepts the parameters of GetMutableState in-order and returns
	// the arguments struct for the function.
	Args func(
		getRequest *GetMutableStateRequest,
	) *HistoryService_GetMutableState_Args

	// IsException returns true if the given error can be thrown
	// by GetMutableState.
	//
	// An error can be thrown by GetMutableState only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for GetMutableState
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// GetMutableState into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by GetMutableState
	//
	//   value, err := GetMutableState(args)
	//   result, err := HistoryService_GetMutableState_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from GetMutableState: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*GetMutableStateResponse, error) (*HistoryService_GetMutableState_Result, error)

	// UnwrapResponse takes the result struct for GetMutableState
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if GetMutableState threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_GetMutableState_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_GetMutableState_Result) (*GetMutableStateResponse, error)
}{}

func init() {
	HistoryService_GetMutableState_Helper.Args = func(
		getRequest *GetMutableStateRequest,
	) *HistoryService_GetMutableState_Args {
		return &HistoryService_GetMutableState_Args{
			GetRequest: getRequest,
		}
	}

	HistoryService_GetMutableState_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.CurrentBranchChangedError:
			return true
		default:
			return false
		}
	}

	HistoryService_GetMutableState_Helper.WrapResponse = func(success *GetMutableStateResponse, err error) (*HistoryService_GetMutableState_Result, error) {
		if err == nil {
			return &HistoryService_GetMutableState_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.BadRequestError")
			}
			return &HistoryService_GetMutableState_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.InternalServiceError")
			}
			return &HistoryService_GetMutableState_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.EntityNotExistError")
			}
			return &HistoryService_GetMutableState_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.ShardOwnershipLostError")
			}
			return &HistoryService_GetMutableState_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.LimitExceededError")
			}
			return &HistoryService_GetMutableState_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.ServiceBusyError")
			}
			return &HistoryService_GetMutableState_Result{ServiceBusyError: e}, nil
		case *shared.CurrentBranchChangedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetMutableState_Result.CurrentBranchChangedError")
			}
			return &HistoryService_GetMutableState_Result{CurrentBranchChangedError: e}, nil
		}

		return nil, err
	}
	HistoryService_GetMutableState_Helper.UnwrapResponse = func(result *HistoryService_GetMutableState_Result) (success *GetMutableStateResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.CurrentBranchChangedError != nil {
			err = result.CurrentBranchChangedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_GetMutableState_Result represents the result of a HistoryService.GetMutableState function call.
//
// The result of a GetMutableState execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_GetMutableState_Result struct {
	// Value returned by GetMutableState after a successful execution.
	Success                   *GetMutableStateResponse          `json:"success,omitempty"`
	BadRequestError           *shared.BadRequestError           `json:"badRequestError,omitempty"`
	InternalServiceError      *shared.InternalServiceError      `json:"internalServiceError,omitempty"`
	EntityNotExistError       *shared.EntityNotExistsError      `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError   *ShardOwnershipLostError          `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError        *shared.LimitExceededError        `json:"limitExceededError,omitempty"`
	ServiceBusyError          *shared.ServiceBusyError          `json:"serviceBusyError,omitempty"`
	CurrentBranchChangedError *shared.CurrentBranchChangedError `json:"currentBranchChangedError,omitempty"`
}

// ToWire translates a HistoryService_GetMutableState_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetMutableState_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.CurrentBranchChangedError != nil {
		w, err = v.CurrentBranchChangedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_GetMutableState_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetMutableStateResponse_Read(w wire.Value) (*GetMutableStateResponse, error) {
	var v GetMutableStateResponse
	err := v.FromWire(w)
	return &v, err
}

func _CurrentBranchChangedError_Read(w wire.Value) (*shared.CurrentBranchChangedError, error) {
	var v shared.CurrentBranchChangedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetMutableState_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetMutableState_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetMutableState_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetMutableState_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _GetMutableStateResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.CurrentBranchChangedError, err = _CurrentBranchChangedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.CurrentBranchChangedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetMutableState_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_GetMutableState_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetMutableState_Result struct could not be encoded.
func (v *HistoryService_GetMutableState_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CurrentBranchChangedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CurrentBranchChangedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.CurrentBranchChangedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_GetMutableState_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _GetMutableStateResponse_Decode(sr stream.Reader) (*GetMutableStateResponse, error) {
	var v GetMutableStateResponse
	err := v.Decode(sr)
	return &v, err
}

func _CurrentBranchChangedError_Decode(sr stream.Reader) (*shared.CurrentBranchChangedError, error) {
	var v shared.CurrentBranchChangedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetMutableState_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetMutableState_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_GetMutableState_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _GetMutableStateResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.CurrentBranchChangedError, err = _CurrentBranchChangedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.CurrentBranchChangedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetMutableState_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetMutableState_Result
// struct.
func (v *HistoryService_GetMutableState_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.CurrentBranchChangedError != nil {
		fields[i] = fmt.Sprintf("CurrentBranchChangedError: %v", v.CurrentBranchChangedError)
		i++
	}

	return fmt.Sprintf("HistoryService_GetMutableState_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetMutableState_Result match the
// provided HistoryService_GetMutableState_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_GetMutableState_Result) Equals(rhs *HistoryService_GetMutableState_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.CurrentBranchChangedError == nil && rhs.CurrentBranchChangedError == nil) || (v.CurrentBranchChangedError != nil && rhs.CurrentBranchChangedError != nil && v.CurrentBranchChangedError.Equals(rhs.CurrentBranchChangedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetMutableState_Result.
func (v *HistoryService_GetMutableState_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.CurrentBranchChangedError != nil {
		err = multierr.Append(err, enc.AddObject("currentBranchChangedError", v.CurrentBranchChangedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetSuccess() (o *GetMutableStateResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetCurrentBranchChangedError returns the value of CurrentBranchChangedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetMutableState_Result) GetCurrentBranchChangedError() (o *shared.CurrentBranchChangedError) {
	if v != nil && v.CurrentBranchChangedError != nil {
		return v.CurrentBranchChangedError
	}

	return
}

// IsSetCurrentBranchChangedError returns true if CurrentBranchChangedError is not nil.
func (v *HistoryService_GetMutableState_Result) IsSetCurrentBranchChangedError() bool {
	return v != nil && v.CurrentBranchChangedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "GetMutableState" for this struct.
func (v *HistoryService_GetMutableState_Result) MethodName() string {
	return "GetMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_GetMutableState_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_GetReplicationMessages_Args represents the arguments for the HistoryService.GetReplicationMessages function.
//
// The arguments for GetReplicationMessages are sent and received over the wire as this struct.
type HistoryService_GetReplicationMessages_Args struct {
	Request *replicator.GetReplicationMessagesRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_GetReplicationMessages_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetReplicationMessages_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetReplicationMessagesRequest_Read(w wire.Value) (*replicator.GetReplicationMessagesRequest, error) {
	var v replicator.GetReplicationMessagesRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetReplicationMessages_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetReplicationMessages_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetReplicationMessages_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetReplicationMessages_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _GetReplicationMessagesRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_GetReplicationMessages_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetReplicationMessages_Args struct could not be encoded.
func (v *HistoryService_GetReplicationMessages_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _GetReplicationMessagesRequest_Decode(sr stream.Reader) (*replicator.GetReplicationMessagesRequest, error) {
	var v replicator.GetReplicationMessagesRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetReplicationMessages_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetReplicationMessages_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_GetReplicationMessages_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _GetReplicationMessagesRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetReplicationMessages_Args
// struct.
func (v *HistoryService_GetReplicationMessages_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_GetReplicationMessages_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetReplicationMessages_Args match the
// provided HistoryService_GetReplicationMessages_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_GetReplicationMessages_Args) Equals(rhs *HistoryService_GetReplicationMessages_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetReplicationMessages_Args.
func (v *HistoryService_GetReplicationMessages_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Args) GetRequest() (o *replicator.GetReplicationMessagesRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_GetReplicationMessages_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "GetReplicationMessages" for this struct.
func (v *HistoryService_GetReplicationMessages_Args) MethodName() string {
	return "GetReplicationMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_GetReplicationMessages_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_GetReplicationMessages_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.GetReplicationMessages
// function.
var HistoryService_GetReplicationMessages_Helper = struct {
	// Args accepts the parameters of GetReplicationMessages in-order and returns
	// the arguments struct for the function.
	Args func(
		request *replicator.GetReplicationMessagesRequest,
	) *HistoryService_GetReplicationMessages_Args

	// IsException returns true if the given error can be thrown
	// by GetReplicationMessages.
	//
	// An error can be thrown by GetReplicationMessages only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for GetReplicationMessages
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// GetReplicationMessages into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by GetReplicationMessages
	//
	//   value, err := GetReplicationMessages(args)
	//   result, err := HistoryService_GetReplicationMessages_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from GetReplicationMessages: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*replicator.GetReplicationMessagesResponse, error) (*HistoryService_GetReplicationMessages_Result, error)

	// UnwrapResponse takes the result struct for GetReplicationMessages
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if GetReplicationMessages threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_GetReplicationMessages_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_GetReplicationMessages_Result) (*replicator.GetReplicationMessagesResponse, error)
}{}

func init() {
	HistoryService_GetReplicationMessages_Helper.Args = func(
		request *replicator.GetReplicationMessagesRequest,
	) *HistoryService_GetReplicationMessages_Args {
		return &HistoryService_GetReplicationMessages_Args{
			Request: request,
		}
	}

	HistoryService_GetReplicationMessages_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.ClientVersionNotSupportedError:
			return true
		default:
			return false
		}
	}

	HistoryService_GetReplicationMessages_Helper.WrapResponse = func(success *replicator.GetReplicationMessagesResponse, err error) (*HistoryService_GetReplicationMessages_Result, error) {
		if err == nil {
			return &HistoryService_GetReplicationMessages_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetReplicationMessages_Result.BadRequestError")
			}
			return &HistoryService_GetReplicationMessages_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetReplicationMessages_Result.InternalServiceError")
			}
			return &HistoryService_GetReplicationMessages_Result{InternalServiceError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetReplicationMessages_Result.LimitExceededError")
			}
			return &HistoryService_GetReplicationMessages_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetReplicationMessages_Result.ServiceBusyError")
			}
			return &HistoryService_GetReplicationMessages_Result{ServiceBusyError: e}, nil
		case *shared.ClientVersionNotSupportedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_GetReplicationMessages_Result.ClientVersionNotSupportedError")
			}
			return &HistoryService_GetReplicationMessages_Result{ClientVersionNotSupportedError: e}, nil
		}

		return nil, err
	}
	HistoryService_GetReplicationMessages_Helper.UnwrapResponse = func(result *HistoryService_GetReplicationMessages_Result) (success *replicator.GetReplicationMessagesResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.ClientVersionNotSupportedError != nil {
			err = result.ClientVersionNotSupportedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_GetReplicationMessages_Result represents the result of a HistoryService.GetReplicationMessages function call.
//
// The result of a GetReplicationMessages execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_GetReplicationMessages_Result struct {
	// Value returned by GetReplicationMessages after a successful execution.
	Success                        *replicator.GetReplicationMessagesResponse `json:"success,omitempty"`
	BadRequestError                *shared.BadRequestError                    `json:"badRequestError,omitempty"`
	InternalServiceError           *shared.InternalServiceError               `json:"internalServiceError,omitempty"`
	LimitExceededError             *shared.LimitExceededError                 `json:"limitExceededError,omitempty"`
	ServiceBusyError               *shared.ServiceBusyError                   `json:"serviceBusyError,omitempty"`
	ClientVersionNotSupportedError *shared.ClientVersionNotSupportedError     `json:"clientVersionNotSupportedError,omitempty"`
}

// ToWire translates a HistoryService_GetReplicationMessages_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_GetReplicationMessages_Result) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ClientVersionNotSupportedError != nil {
		w, err = v.ClientVersionNotSupportedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_GetReplicationMessages_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _GetReplicationMessagesResponse_Read(w wire.Value) (*replicator.GetReplicationMessagesResponse, error) {
	var v replicator.GetReplicationMessagesResponse
	err := v.FromWire(w)
	return &v, err
}

func _ClientVersionNotSupportedError_Read(w wire.Value) (*shared.ClientVersionNotSupportedError, error) {
	var v shared.ClientVersionNotSupportedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_GetReplicationMessages_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_GetReplicationMessages_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_GetReplicationMessages_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_GetReplicationMessages_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _GetReplicationMessagesResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ClientVersionNotSupportedError, err = _ClientVersionNotSupportedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ClientVersionNotSupportedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetReplicationMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_GetReplicationMessages_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_GetReplicationMessages_Result struct could not be encoded.
func (v *HistoryService_GetReplicationMessages_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientVersionNotSupportedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ClientVersionNotSupportedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ClientVersionNotSupportedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_GetReplicationMessages_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _GetReplicationMessagesResponse_Decode(sr stream.Reader) (*replicator.GetReplicationMessagesResponse, error) {
	var v replicator.GetReplicationMessagesResponse
	err := v.Decode(sr)
	return &v, err
}

func _ClientVersionNotSupportedError_Decode(sr stream.Reader) (*shared.ClientVersionNotSupportedError, error) {
	var v shared.ClientVersionNotSupportedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_GetReplicationMessages_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_GetReplicationMessages_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_GetReplicationMessages_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _GetReplicationMessagesResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ClientVersionNotSupportedError, err = _ClientVersionNotSupportedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ClientVersionNotSupportedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_GetReplicationMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_GetReplicationMessages_Result
// struct.
func (v *HistoryService_GetReplicationMessages_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.ClientVersionNotSupportedError != nil {
		fields[i] = fmt.Sprintf("ClientVersionNotSupportedError: %v", v.ClientVersionNotSupportedError)
		i++
	}

	return fmt.Sprintf("HistoryService_GetReplicationMessages_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_GetReplicationMessages_Result match the
// provided HistoryService_GetReplicationMessages_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_GetReplicationMessages_Result) Equals(rhs *HistoryService_GetReplicationMessages_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.ClientVersionNotSupportedError == nil && rhs.ClientVersionNotSupportedError == nil) || (v.ClientVersionNotSupportedError != nil && rhs.ClientVersionNotSupportedError != nil && v.ClientVersionNotSupportedError.Equals(rhs.ClientVersionNotSupportedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_GetReplicationMessages_Result.
func (v *HistoryService_GetReplicationMessages_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.ClientVersionNotSupportedError != nil {
		err = multierr.Append(err, enc.AddObject("clientVersionNotSupportedError", v.ClientVersionNotSupportedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Result) GetSuccess() (o *replicator.GetReplicationMessagesResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_GetReplicationMessages_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_GetReplicationMessages_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_GetReplicationMessages_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_GetReplicationMessages_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_GetReplicationMessages_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetClientVersionNotSupportedError returns the value of ClientVersionNotSupportedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_GetReplicationMessages_Result) GetClientVersionNotSupportedError() (o *shared.ClientVersionNotSupportedError) {
	if v != nil && v.ClientVersionNotSupportedError != nil {
		return v.ClientVersionNotSupportedError
	}

	return
}

// IsSetClientVersionNotSupportedError returns true if ClientVersionNotSupportedError is not nil.
func (v *HistoryService_GetReplicationMessages_Result) IsSetClientVersionNotSupportedError() bool {
	return v != nil && v.ClientVersionNotSupportedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "GetReplicationMessages" for this struct.
func (v *HistoryService_GetReplicationMessages_Result) MethodName() string {
	return "GetReplicationMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_GetReplicationMessages_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_MergeDLQMessages_Args represents the arguments for the HistoryService.MergeDLQMessages function.
//
// The arguments for MergeDLQMessages are sent and received over the wire as this struct.
type HistoryService_MergeDLQMessages_Args struct {
	Request *replicator.MergeDLQMessagesRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_MergeDLQMessages_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_MergeDLQMessages_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _MergeDLQMessagesRequest_Read(w wire.Value) (*replicator.MergeDLQMessagesRequest, error) {
	var v replicator.MergeDLQMessagesRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_MergeDLQMessages_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_MergeDLQMessages_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_MergeDLQMessages_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_MergeDLQMessages_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _MergeDLQMessagesRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_MergeDLQMessages_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_MergeDLQMessages_Args struct could not be encoded.
func (v *HistoryService_MergeDLQMessages_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _MergeDLQMessagesRequest_Decode(sr stream.Reader) (*replicator.MergeDLQMessagesRequest, error) {
	var v replicator.MergeDLQMessagesRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_MergeDLQMessages_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_MergeDLQMessages_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_MergeDLQMessages_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _MergeDLQMessagesRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_MergeDLQMessages_Args
// struct.
func (v *HistoryService_MergeDLQMessages_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_MergeDLQMessages_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_MergeDLQMessages_Args match the
// provided HistoryService_MergeDLQMessages_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_MergeDLQMessages_Args) Equals(rhs *HistoryService_MergeDLQMessages_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_MergeDLQMessages_Args.
func (v *HistoryService_MergeDLQMessages_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Args) GetRequest() (o *replicator.MergeDLQMessagesRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_MergeDLQMessages_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "MergeDLQMessages" for this struct.
func (v *HistoryService_MergeDLQMessages_Args) MethodName() string {
	return "MergeDLQMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_MergeDLQMessages_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_MergeDLQMessages_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.MergeDLQMessages
// function.
var HistoryService_MergeDLQMessages_Helper = struct {
	// Args accepts the parameters of MergeDLQMessages in-order and returns
	// the arguments struct for the function.
	Args func(
		request *replicator.MergeDLQMessagesRequest,
	) *HistoryService_MergeDLQMessages_Args

	// IsException returns true if the given error can be thrown
	// by MergeDLQMessages.
	//
	// An error can be thrown by MergeDLQMessages only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for MergeDLQMessages
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// MergeDLQMessages into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by MergeDLQMessages
	//
	//   value, err := MergeDLQMessages(args)
	//   result, err := HistoryService_MergeDLQMessages_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from MergeDLQMessages: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*replicator.MergeDLQMessagesResponse, error) (*HistoryService_MergeDLQMessages_Result, error)

	// UnwrapResponse takes the result struct for MergeDLQMessages
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if MergeDLQMessages threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_MergeDLQMessages_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_MergeDLQMessages_Result) (*replicator.MergeDLQMessagesResponse, error)
}{}

func init() {
	HistoryService_MergeDLQMessages_Helper.Args = func(
		request *replicator.MergeDLQMessagesRequest,
	) *HistoryService_MergeDLQMessages_Args {
		return &HistoryService_MergeDLQMessages_Args{
			Request: request,
		}
	}

	HistoryService_MergeDLQMessages_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		default:
			return false
		}
	}

	HistoryService_MergeDLQMessages_Helper.WrapResponse = func(success *replicator.MergeDLQMessagesResponse, err error) (*HistoryService_MergeDLQMessages_Result, error) {
		if err == nil {
			return &HistoryService_MergeDLQMessages_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_MergeDLQMessages_Result.BadRequestError")
			}
			return &HistoryService_MergeDLQMessages_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_MergeDLQMessages_Result.InternalServiceError")
			}
			return &HistoryService_MergeDLQMessages_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_MergeDLQMessages_Result.ServiceBusyError")
			}
			return &HistoryService_MergeDLQMessages_Result{ServiceBusyError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_MergeDLQMessages_Result.EntityNotExistError")
			}
			return &HistoryService_MergeDLQMessages_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_MergeDLQMessages_Result.ShardOwnershipLostError")
			}
			return &HistoryService_MergeDLQMessages_Result{ShardOwnershipLostError: e}, nil
		}

		return nil, err
	}
	HistoryService_MergeDLQMessages_Helper.UnwrapResponse = func(result *HistoryService_MergeDLQMessages_Result) (success *replicator.MergeDLQMessagesResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_MergeDLQMessages_Result represents the result of a HistoryService.MergeDLQMessages function call.
//
// The result of a MergeDLQMessages execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_MergeDLQMessages_Result struct {
	// Value returned by MergeDLQMessages after a successful execution.
	Success                 *replicator.MergeDLQMessagesResponse `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError              `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError         `json:"internalServiceError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError             `json:"serviceBusyError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError         `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError             `json:"shardOwnershipLostError,omitempty"`
}

// ToWire translates a HistoryService_MergeDLQMessages_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_MergeDLQMessages_Result) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_MergeDLQMessages_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _MergeDLQMessagesResponse_Read(w wire.Value) (*replicator.MergeDLQMessagesResponse, error) {
	var v replicator.MergeDLQMessagesResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_MergeDLQMessages_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_MergeDLQMessages_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_MergeDLQMessages_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_MergeDLQMessages_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _MergeDLQMessagesResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_MergeDLQMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_MergeDLQMessages_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_MergeDLQMessages_Result struct could not be encoded.
func (v *HistoryService_MergeDLQMessages_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_MergeDLQMessages_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _MergeDLQMessagesResponse_Decode(sr stream.Reader) (*replicator.MergeDLQMessagesResponse, error) {
	var v replicator.MergeDLQMessagesResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_MergeDLQMessages_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_MergeDLQMessages_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_MergeDLQMessages_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _MergeDLQMessagesResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_MergeDLQMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_MergeDLQMessages_Result
// struct.
func (v *HistoryService_MergeDLQMessages_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}

	return fmt.Sprintf("HistoryService_MergeDLQMessages_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_MergeDLQMessages_Result match the
// provided HistoryService_MergeDLQMessages_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_MergeDLQMessages_Result) Equals(rhs *HistoryService_MergeDLQMessages_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_MergeDLQMessages_Result.
func (v *HistoryService_MergeDLQMessages_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Result) GetSuccess() (o *replicator.MergeDLQMessagesResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_MergeDLQMessages_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_MergeDLQMessages_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_MergeDLQMessages_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_MergeDLQMessages_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_MergeDLQMessages_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_MergeDLQMessages_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_MergeDLQMessages_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "MergeDLQMessages" for this struct.
func (v *HistoryService_MergeDLQMessages_Result) MethodName() string {
	return "MergeDLQMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_MergeDLQMessages_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_NotifyFailoverMarkers_Args represents the arguments for the HistoryService.NotifyFailoverMarkers function.
//
// The arguments for NotifyFailoverMarkers are sent and received over the wire as this struct.
type HistoryService_NotifyFailoverMarkers_Args struct {
	Request *NotifyFailoverMarkersRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_NotifyFailoverMarkers_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_NotifyFailoverMarkers_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _NotifyFailoverMarkersRequest_Read(w wire.Value) (*NotifyFailoverMarkersRequest, error) {
	var v NotifyFailoverMarkersRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_NotifyFailoverMarkers_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_NotifyFailoverMarkers_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_NotifyFailoverMarkers_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_NotifyFailoverMarkers_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _NotifyFailoverMarkersRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_NotifyFailoverMarkers_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_NotifyFailoverMarkers_Args struct could not be encoded.
func (v *HistoryService_NotifyFailoverMarkers_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _NotifyFailoverMarkersRequest_Decode(sr stream.Reader) (*NotifyFailoverMarkersRequest, error) {
	var v NotifyFailoverMarkersRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_NotifyFailoverMarkers_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_NotifyFailoverMarkers_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_NotifyFailoverMarkers_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _NotifyFailoverMarkersRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_NotifyFailoverMarkers_Args
// struct.
func (v *HistoryService_NotifyFailoverMarkers_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_NotifyFailoverMarkers_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_NotifyFailoverMarkers_Args match the
// provided HistoryService_NotifyFailoverMarkers_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_NotifyFailoverMarkers_Args) Equals(rhs *HistoryService_NotifyFailoverMarkers_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_NotifyFailoverMarkers_Args.
func (v *HistoryService_NotifyFailoverMarkers_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_NotifyFailoverMarkers_Args) GetRequest() (o *NotifyFailoverMarkersRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_NotifyFailoverMarkers_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "NotifyFailoverMarkers" for this struct.
func (v *HistoryService_NotifyFailoverMarkers_Args) MethodName() string {
	return "NotifyFailoverMarkers"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_NotifyFailoverMarkers_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_NotifyFailoverMarkers_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.NotifyFailoverMarkers
// function.
var HistoryService_NotifyFailoverMarkers_Helper = struct {
	// Args accepts the parameters of NotifyFailoverMarkers in-order and returns
	// the arguments struct for the function.
	Args func(
		request *NotifyFailoverMarkersRequest,
	) *HistoryService_NotifyFailoverMarkers_Args

	// IsException returns true if the given error can be thrown
	// by NotifyFailoverMarkers.
	//
	// An error can be thrown by NotifyFailoverMarkers only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for NotifyFailoverMarkers
	// given the error returned by it. The provided error may
	// be nil if NotifyFailoverMarkers did not fail.
	//
	// This allows mapping errors returned by NotifyFailoverMarkers into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// NotifyFailoverMarkers
	//
	//   err := NotifyFailoverMarkers(args)
	//   result, err := HistoryService_NotifyFailoverMarkers_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from NotifyFailoverMarkers: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_NotifyFailoverMarkers_Result, error)

	// UnwrapResponse takes the result struct for NotifyFailoverMarkers
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if NotifyFailoverMarkers threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_NotifyFailoverMarkers_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_NotifyFailoverMarkers_Result) error
}{}

func init() {
	HistoryService_NotifyFailoverMarkers_Helper.Args = func(
		request *NotifyFailoverMarkersRequest,
	) *HistoryService_NotifyFailoverMarkers_Args {
		return &HistoryService_NotifyFailoverMarkers_Args{
			Request: request,
		}
	}

	HistoryService_NotifyFailoverMarkers_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_NotifyFailoverMarkers_Helper.WrapResponse = func(err error) (*HistoryService_NotifyFailoverMarkers_Result, error) {
		if err == nil {
			return &HistoryService_NotifyFailoverMarkers_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_NotifyFailoverMarkers_Result.BadRequestError")
			}
			return &HistoryService_NotifyFailoverMarkers_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_NotifyFailoverMarkers_Result.InternalServiceError")
			}
			return &HistoryService_NotifyFailoverMarkers_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_NotifyFailoverMarkers_Result.ServiceBusyError")
			}
			return &HistoryService_NotifyFailoverMarkers_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_NotifyFailoverMarkers_Helper.UnwrapResponse = func(result *HistoryService_NotifyFailoverMarkers_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		return
	}

}

// HistoryService_NotifyFailoverMarkers_Result represents the result of a HistoryService.NotifyFailoverMarkers function call.
//
// The result of a NotifyFailoverMarkers execution is sent and received over the wire as this struct.
type HistoryService_NotifyFailoverMarkers_Result struct {
	BadRequestError      *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	ServiceBusyError     *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_NotifyFailoverMarkers_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_NotifyFailoverMarkers_Result) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_NotifyFailoverMarkers_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_NotifyFailoverMarkers_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_NotifyFailoverMarkers_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_NotifyFailoverMarkers_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_NotifyFailoverMarkers_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_NotifyFailoverMarkers_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_NotifyFailoverMarkers_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_NotifyFailoverMarkers_Result struct could not be encoded.
func (v *HistoryService_NotifyFailoverMarkers_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_NotifyFailoverMarkers_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_NotifyFailoverMarkers_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_NotifyFailoverMarkers_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_NotifyFailoverMarkers_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_NotifyFailoverMarkers_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_NotifyFailoverMarkers_Result
// struct.
func (v *HistoryService_NotifyFailoverMarkers_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_NotifyFailoverMarkers_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_NotifyFailoverMarkers_Result match the
// provided HistoryService_NotifyFailoverMarkers_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_NotifyFailoverMarkers_Result) Equals(rhs *HistoryService_NotifyFailoverMarkers_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_NotifyFailoverMarkers_Result.
func (v *HistoryService_NotifyFailoverMarkers_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_NotifyFailoverMarkers_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_NotifyFailoverMarkers_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_NotifyFailoverMarkers_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_NotifyFailoverMarkers_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_NotifyFailoverMarkers_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_NotifyFailoverMarkers_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "NotifyFailoverMarkers" for this struct.
func (v *HistoryService_NotifyFailoverMarkers_Result) MethodName() string {
	return "NotifyFailoverMarkers"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_NotifyFailoverMarkers_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_PollMutableState_Args represents the arguments for the HistoryService.PollMutableState function.
//
// The arguments for PollMutableState are sent and received over the wire as this struct.
type HistoryService_PollMutableState_Args struct {
	PollRequest *PollMutableStateRequest `json:"pollRequest,omitempty"`
}

// ToWire translates a HistoryService_PollMutableState_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_PollMutableState_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.PollRequest != nil {
		w, err = v.PollRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _PollMutableStateRequest_Read(w wire.Value) (*PollMutableStateRequest, error) {
	var v PollMutableStateRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_PollMutableState_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_PollMutableState_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_PollMutableState_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_PollMutableState_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.PollRequest, err = _PollMutableStateRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_PollMutableState_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_PollMutableState_Args struct could not be encoded.
func (v *HistoryService_PollMutableState_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.PollRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.PollRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _PollMutableStateRequest_Decode(sr stream.Reader) (*PollMutableStateRequest, error) {
	var v PollMutableStateRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_PollMutableState_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_PollMutableState_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_PollMutableState_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.PollRequest, err = _PollMutableStateRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_PollMutableState_Args
// struct.
func (v *HistoryService_PollMutableState_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.PollRequest != nil {
		fields[i] = fmt.Sprintf("PollRequest: %v", v.PollRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_PollMutableState_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_PollMutableState_Args match the
// provided HistoryService_PollMutableState_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_PollMutableState_Args) Equals(rhs *HistoryService_PollMutableState_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.PollRequest == nil && rhs.PollRequest == nil) || (v.PollRequest != nil && rhs.PollRequest != nil && v.PollRequest.Equals(rhs.PollRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_PollMutableState_Args.
func (v *HistoryService_PollMutableState_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.PollRequest != nil {
		err = multierr.Append(err, enc.AddObject("pollRequest", v.PollRequest))
	}
	return err
}

// GetPollRequest returns the value of PollRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Args) GetPollRequest() (o *PollMutableStateRequest) {
	if v != nil && v.PollRequest != nil {
		return v.PollRequest
	}

	return
}

// IsSetPollRequest returns true if PollRequest is not nil.
func (v *HistoryService_PollMutableState_Args) IsSetPollRequest() bool {
	return v != nil && v.PollRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "PollMutableState" for this struct.
func (v *HistoryService_PollMutableState_Args) MethodName() string {
	return "PollMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_PollMutableState_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_PollMutableState_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.PollMutableState
// function.
var HistoryService_PollMutableState_Helper = struct {
	// Args accepts the parameters of PollMutableState in-order and returns
	// the arguments struct for the function.
	Args func(
		pollRequest *PollMutableStateRequest,
	) *HistoryService_PollMutableState_Args

	// IsException returns true if the given error can be thrown
	// by PollMutableState.
	//
	// An error can be thrown by PollMutableState only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for PollMutableState
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// PollMutableState into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by PollMutableState
	//
	//   value, err := PollMutableState(args)
	//   result, err := HistoryService_PollMutableState_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from PollMutableState: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*PollMutableStateResponse, error) (*HistoryService_PollMutableState_Result, error)

	// UnwrapResponse takes the result struct for PollMutableState
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if PollMutableState threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_PollMutableState_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_PollMutableState_Result) (*PollMutableStateResponse, error)
}{}

func init() {
	HistoryService_PollMutableState_Helper.Args = func(
		pollRequest *PollMutableStateRequest,
	) *HistoryService_PollMutableState_Args {
		return &HistoryService_PollMutableState_Args{
			PollRequest: pollRequest,
		}
	}

	HistoryService_PollMutableState_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.CurrentBranchChangedError:
			return true
		default:
			return false
		}
	}

	HistoryService_PollMutableState_Helper.WrapResponse = func(success *PollMutableStateResponse, err error) (*HistoryService_PollMutableState_Result, error) {
		if err == nil {
			return &HistoryService_PollMutableState_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.BadRequestError")
			}
			return &HistoryService_PollMutableState_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.InternalServiceError")
			}
			return &HistoryService_PollMutableState_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.EntityNotExistError")
			}
			return &HistoryService_PollMutableState_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.ShardOwnershipLostError")
			}
			return &HistoryService_PollMutableState_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.LimitExceededError")
			}
			return &HistoryService_PollMutableState_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.ServiceBusyError")
			}
			return &HistoryService_PollMutableState_Result{ServiceBusyError: e}, nil
		case *shared.CurrentBranchChangedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PollMutableState_Result.CurrentBranchChangedError")
			}
			return &HistoryService_PollMutableState_Result{CurrentBranchChangedError: e}, nil
		}

		return nil, err
	}
	HistoryService_PollMutableState_Helper.UnwrapResponse = func(result *HistoryService_PollMutableState_Result) (success *PollMutableStateResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.CurrentBranchChangedError != nil {
			err = result.CurrentBranchChangedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_PollMutableState_Result represents the result of a HistoryService.PollMutableState function call.
//
// The result of a PollMutableState execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_PollMutableState_Result struct {
	// Value returned by PollMutableState after a successful execution.
	Success                   *PollMutableStateResponse         `json:"success,omitempty"`
	BadRequestError           *shared.BadRequestError           `json:"badRequestError,omitempty"`
	InternalServiceError      *shared.InternalServiceError      `json:"internalServiceError,omitempty"`
	EntityNotExistError       *shared.EntityNotExistsError      `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError   *ShardOwnershipLostError          `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError        *shared.LimitExceededError        `json:"limitExceededError,omitempty"`
	ServiceBusyError          *shared.ServiceBusyError          `json:"serviceBusyError,omitempty"`
	CurrentBranchChangedError *shared.CurrentBranchChangedError `json:"currentBranchChangedError,omitempty"`
}

// ToWire translates a HistoryService_PollMutableState_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_PollMutableState_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.CurrentBranchChangedError != nil {
		w, err = v.CurrentBranchChangedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_PollMutableState_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _PollMutableStateResponse_Read(w wire.Value) (*PollMutableStateResponse, error) {
	var v PollMutableStateResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_PollMutableState_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_PollMutableState_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_PollMutableState_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_PollMutableState_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _PollMutableStateResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.CurrentBranchChangedError, err = _CurrentBranchChangedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.CurrentBranchChangedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_PollMutableState_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_PollMutableState_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_PollMutableState_Result struct could not be encoded.
func (v *HistoryService_PollMutableState_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CurrentBranchChangedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CurrentBranchChangedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.CurrentBranchChangedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_PollMutableState_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _PollMutableStateResponse_Decode(sr stream.Reader) (*PollMutableStateResponse, error) {
	var v PollMutableStateResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_PollMutableState_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_PollMutableState_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_PollMutableState_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _PollMutableStateResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.CurrentBranchChangedError, err = _CurrentBranchChangedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.CurrentBranchChangedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_PollMutableState_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_PollMutableState_Result
// struct.
func (v *HistoryService_PollMutableState_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.CurrentBranchChangedError != nil {
		fields[i] = fmt.Sprintf("CurrentBranchChangedError: %v", v.CurrentBranchChangedError)
		i++
	}

	return fmt.Sprintf("HistoryService_PollMutableState_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_PollMutableState_Result match the
// provided HistoryService_PollMutableState_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_PollMutableState_Result) Equals(rhs *HistoryService_PollMutableState_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.CurrentBranchChangedError == nil && rhs.CurrentBranchChangedError == nil) || (v.CurrentBranchChangedError != nil && rhs.CurrentBranchChangedError != nil && v.CurrentBranchChangedError.Equals(rhs.CurrentBranchChangedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_PollMutableState_Result.
func (v *HistoryService_PollMutableState_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.CurrentBranchChangedError != nil {
		err = multierr.Append(err, enc.AddObject("currentBranchChangedError", v.CurrentBranchChangedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetSuccess() (o *PollMutableStateResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetCurrentBranchChangedError returns the value of CurrentBranchChangedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PollMutableState_Result) GetCurrentBranchChangedError() (o *shared.CurrentBranchChangedError) {
	if v != nil && v.CurrentBranchChangedError != nil {
		return v.CurrentBranchChangedError
	}

	return
}

// IsSetCurrentBranchChangedError returns true if CurrentBranchChangedError is not nil.
func (v *HistoryService_PollMutableState_Result) IsSetCurrentBranchChangedError() bool {
	return v != nil && v.CurrentBranchChangedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "PollMutableState" for this struct.
func (v *HistoryService_PollMutableState_Result) MethodName() string {
	return "PollMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_PollMutableState_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_PurgeDLQMessages_Args represents the arguments for the HistoryService.PurgeDLQMessages function.
//
// The arguments for PurgeDLQMessages are sent and received over the wire as this struct.
type HistoryService_PurgeDLQMessages_Args struct {
	Request *replicator.PurgeDLQMessagesRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_PurgeDLQMessages_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_PurgeDLQMessages_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _PurgeDLQMessagesRequest_Read(w wire.Value) (*replicator.PurgeDLQMessagesRequest, error) {
	var v replicator.PurgeDLQMessagesRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_PurgeDLQMessages_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_PurgeDLQMessages_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_PurgeDLQMessages_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_PurgeDLQMessages_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _PurgeDLQMessagesRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_PurgeDLQMessages_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_PurgeDLQMessages_Args struct could not be encoded.
func (v *HistoryService_PurgeDLQMessages_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _PurgeDLQMessagesRequest_Decode(sr stream.Reader) (*replicator.PurgeDLQMessagesRequest, error) {
	var v replicator.PurgeDLQMessagesRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_PurgeDLQMessages_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_PurgeDLQMessages_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_PurgeDLQMessages_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _PurgeDLQMessagesRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_PurgeDLQMessages_Args
// struct.
func (v *HistoryService_PurgeDLQMessages_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_PurgeDLQMessages_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_PurgeDLQMessages_Args match the
// provided HistoryService_PurgeDLQMessages_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_PurgeDLQMessages_Args) Equals(rhs *HistoryService_PurgeDLQMessages_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_PurgeDLQMessages_Args.
func (v *HistoryService_PurgeDLQMessages_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_PurgeDLQMessages_Args) GetRequest() (o *replicator.PurgeDLQMessagesRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_PurgeDLQMessages_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "PurgeDLQMessages" for this struct.
func (v *HistoryService_PurgeDLQMessages_Args) MethodName() string {
	return "PurgeDLQMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_PurgeDLQMessages_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_PurgeDLQMessages_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.PurgeDLQMessages
// function.
var HistoryService_PurgeDLQMessages_Helper = struct {
	// Args accepts the parameters of PurgeDLQMessages in-order and returns
	// the arguments struct for the function.
	Args func(
		request *replicator.PurgeDLQMessagesRequest,
	) *HistoryService_PurgeDLQMessages_Args

	// IsException returns true if the given error can be thrown
	// by PurgeDLQMessages.
	//
	// An error can be thrown by PurgeDLQMessages only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for PurgeDLQMessages
	// given the error returned by it. The provided error may
	// be nil if PurgeDLQMessages did not fail.
	//
	// This allows mapping errors returned by PurgeDLQMessages into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// PurgeDLQMessages
	//
	//   err := PurgeDLQMessages(args)
	//   result, err := HistoryService_PurgeDLQMessages_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from PurgeDLQMessages: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_PurgeDLQMessages_Result, error)

	// UnwrapResponse takes the result struct for PurgeDLQMessages
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if PurgeDLQMessages threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_PurgeDLQMessages_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_PurgeDLQMessages_Result) error
}{}

func init() {
	HistoryService_PurgeDLQMessages_Helper.Args = func(
		request *replicator.PurgeDLQMessagesRequest,
	) *HistoryService_PurgeDLQMessages_Args {
		return &HistoryService_PurgeDLQMessages_Args{
			Request: request,
		}
	}

	HistoryService_PurgeDLQMessages_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		default:
			return false
		}
	}

	HistoryService_PurgeDLQMessages_Helper.WrapResponse = func(err error) (*HistoryService_PurgeDLQMessages_Result, error) {
		if err == nil {
			return &HistoryService_PurgeDLQMessages_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PurgeDLQMessages_Result.BadRequestError")
			}
			return &HistoryService_PurgeDLQMessages_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PurgeDLQMessages_Result.InternalServiceError")
			}
			return &HistoryService_PurgeDLQMessages_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PurgeDLQMessages_Result.ServiceBusyError")
			}
			return &HistoryService_PurgeDLQMessages_Result{ServiceBusyError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PurgeDLQMessages_Result.EntityNotExistError")
			}
			return &HistoryService_PurgeDLQMessages_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_PurgeDLQMessages_Result.ShardOwnershipLostError")
			}
			return &HistoryService_PurgeDLQMessages_Result{ShardOwnershipLostError: e}, nil
		}

		return nil, err
	}
	HistoryService_PurgeDLQMessages_Helper.UnwrapResponse = func(result *HistoryService_PurgeDLQMessages_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		return
	}

}

// HistoryService_PurgeDLQMessages_Result represents the result of a HistoryService.PurgeDLQMessages function call.
//
// The result of a PurgeDLQMessages execution is sent and received over the wire as this struct.
type HistoryService_PurgeDLQMessages_Result struct {
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
}

// ToWire translates a HistoryService_PurgeDLQMessages_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_PurgeDLQMessages_Result) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_PurgeDLQMessages_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_PurgeDLQMessages_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_PurgeDLQMessages_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_PurgeDLQMessages_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_PurgeDLQMessages_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_PurgeDLQMessages_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_PurgeDLQMessages_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_PurgeDLQMessages_Result struct could not be encoded.
func (v *HistoryService_PurgeDLQMessages_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_PurgeDLQMessages_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_PurgeDLQMessages_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_PurgeDLQMessages_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_PurgeDLQMessages_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_PurgeDLQMessages_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_PurgeDLQMessages_Result
// struct.
func (v *HistoryService_PurgeDLQMessages_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}

	return fmt.Sprintf("HistoryService_PurgeDLQMessages_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_PurgeDLQMessages_Result match the
// provided HistoryService_PurgeDLQMessages_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_PurgeDLQMessages_Result) Equals(rhs *HistoryService_PurgeDLQMessages_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_PurgeDLQMessages_Result.
func (v *HistoryService_PurgeDLQMessages_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PurgeDLQMessages_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_PurgeDLQMessages_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PurgeDLQMessages_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_PurgeDLQMessages_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PurgeDLQMessages_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_PurgeDLQMessages_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PurgeDLQMessages_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_PurgeDLQMessages_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_PurgeDLQMessages_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_PurgeDLQMessages_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "PurgeDLQMessages" for this struct.
func (v *HistoryService_PurgeDLQMessages_Result) MethodName() string {
	return "PurgeDLQMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_PurgeDLQMessages_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_QueryWorkflow_Args represents the arguments for the HistoryService.QueryWorkflow function.
//
// The arguments for QueryWorkflow are sent and received over the wire as this struct.
type HistoryService_QueryWorkflow_Args struct {
	QueryRequest *QueryWorkflowRequest `json:"queryRequest,omitempty"`
}

// ToWire translates a HistoryService_QueryWorkflow_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_QueryWorkflow_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.QueryRequest != nil {
		w, err = v.QueryRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _QueryWorkflowRequest_1_Read(w wire.Value) (*QueryWorkflowRequest, error) {
	var v QueryWorkflowRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_QueryWorkflow_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_QueryWorkflow_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_QueryWorkflow_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_QueryWorkflow_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.QueryRequest, err = _QueryWorkflowRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_QueryWorkflow_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_QueryWorkflow_Args struct could not be encoded.
func (v *HistoryService_QueryWorkflow_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.QueryRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.QueryRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _QueryWorkflowRequest_1_Decode(sr stream.Reader) (*QueryWorkflowRequest, error) {
	var v QueryWorkflowRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_QueryWorkflow_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_QueryWorkflow_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_QueryWorkflow_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.QueryRequest, err = _QueryWorkflowRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_QueryWorkflow_Args
// struct.
func (v *HistoryService_QueryWorkflow_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.QueryRequest != nil {
		fields[i] = fmt.Sprintf("QueryRequest: %v", v.QueryRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_QueryWorkflow_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_QueryWorkflow_Args match the
// provided HistoryService_QueryWorkflow_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_QueryWorkflow_Args) Equals(rhs *HistoryService_QueryWorkflow_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.QueryRequest == nil && rhs.QueryRequest == nil) || (v.QueryRequest != nil && rhs.QueryRequest != nil && v.QueryRequest.Equals(rhs.QueryRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_QueryWorkflow_Args.
func (v *HistoryService_QueryWorkflow_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.QueryRequest != nil {
		err = multierr.Append(err, enc.AddObject("queryRequest", v.QueryRequest))
	}
	return err
}

// GetQueryRequest returns the value of QueryRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Args) GetQueryRequest() (o *QueryWorkflowRequest) {
	if v != nil && v.QueryRequest != nil {
		return v.QueryRequest
	}

	return
}

// IsSetQueryRequest returns true if QueryRequest is not nil.
func (v *HistoryService_QueryWorkflow_Args) IsSetQueryRequest() bool {
	return v != nil && v.QueryRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "QueryWorkflow" for this struct.
func (v *HistoryService_QueryWorkflow_Args) MethodName() string {
	return "QueryWorkflow"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_QueryWorkflow_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_QueryWorkflow_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.QueryWorkflow
// function.
var HistoryService_QueryWorkflow_Helper = struct {
	// Args accepts the parameters of QueryWorkflow in-order and returns
	// the arguments struct for the function.
	Args func(
		queryRequest *QueryWorkflowRequest,
	) *HistoryService_QueryWorkflow_Args

	// IsException returns true if the given error can be thrown
	// by QueryWorkflow.
	//
	// An error can be thrown by QueryWorkflow only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for QueryWorkflow
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// QueryWorkflow into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by QueryWorkflow
	//
	//   value, err := QueryWorkflow(args)
	//   result, err := HistoryService_QueryWorkflow_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from QueryWorkflow: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*QueryWorkflowResponse, error) (*HistoryService_QueryWorkflow_Result, error)

	// UnwrapResponse takes the result struct for QueryWorkflow
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if QueryWorkflow threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_QueryWorkflow_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_QueryWorkflow_Result) (*QueryWorkflowResponse, error)
}{}

func init() {
	HistoryService_QueryWorkflow_Helper.Args = func(
		queryRequest *QueryWorkflowRequest,
	) *HistoryService_QueryWorkflow_Args {
		return &HistoryService_QueryWorkflow_Args{
			QueryRequest: queryRequest,
		}
	}

	HistoryService_QueryWorkflow_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *shared.QueryFailedError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.ClientVersionNotSupportedError:
			return true
		default:
			return false
		}
	}

	HistoryService_QueryWorkflow_Helper.WrapResponse = func(success *QueryWorkflowResponse, err error) (*HistoryService_QueryWorkflow_Result, error) {
		if err == nil {
			return &HistoryService_QueryWorkflow_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.BadRequestError")
			}
			return &HistoryService_QueryWorkflow_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.InternalServiceError")
			}
			return &HistoryService_QueryWorkflow_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.EntityNotExistError")
			}
			return &HistoryService_QueryWorkflow_Result{EntityNotExistError: e}, nil
		case *shared.QueryFailedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.QueryFailedError")
			}
			return &HistoryService_QueryWorkflow_Result{QueryFailedError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.LimitExceededError")
			}
			return &HistoryService_QueryWorkflow_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.ServiceBusyError")
			}
			return &HistoryService_QueryWorkflow_Result{ServiceBusyError: e}, nil
		case *shared.ClientVersionNotSupportedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_QueryWorkflow_Result.ClientVersionNotSupportedError")
			}
			return &HistoryService_QueryWorkflow_Result{ClientVersionNotSupportedError: e}, nil
		}

		return nil, err
	}
	HistoryService_QueryWorkflow_Helper.UnwrapResponse = func(result *HistoryService_QueryWorkflow_Result) (success *QueryWorkflowResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.QueryFailedError != nil {
			err = result.QueryFailedError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.ClientVersionNotSupportedError != nil {
			err = result.ClientVersionNotSupportedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_QueryWorkflow_Result represents the result of a HistoryService.QueryWorkflow function call.
//
// The result of a QueryWorkflow execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_QueryWorkflow_Result struct {
	// Value returned by QueryWorkflow after a successful execution.
	Success                        *QueryWorkflowResponse                 `json:"success,omitempty"`
	BadRequestError                *shared.BadRequestError                `json:"badRequestError,omitempty"`
	InternalServiceError           *shared.InternalServiceError           `json:"internalServiceError,omitempty"`
	EntityNotExistError            *shared.EntityNotExistsError           `json:"entityNotExistError,omitempty"`
	QueryFailedError               *shared.QueryFailedError               `json:"queryFailedError,omitempty"`
	LimitExceededError             *shared.LimitExceededError             `json:"limitExceededError,omitempty"`
	ServiceBusyError               *shared.ServiceBusyError               `json:"serviceBusyError,omitempty"`
	ClientVersionNotSupportedError *shared.ClientVersionNotSupportedError `json:"clientVersionNotSupportedError,omitempty"`
}

// ToWire translates a HistoryService_QueryWorkflow_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_QueryWorkflow_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.QueryFailedError != nil {
		w, err = v.QueryFailedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ClientVersionNotSupportedError != nil {
		w, err = v.ClientVersionNotSupportedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_QueryWorkflow_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _QueryWorkflowResponse_1_Read(w wire.Value) (*QueryWorkflowResponse, error) {
	var v QueryWorkflowResponse
	err := v.FromWire(w)
	return &v, err
}

func _QueryFailedError_Read(w wire.Value) (*shared.QueryFailedError, error) {
	var v shared.QueryFailedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_QueryWorkflow_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_QueryWorkflow_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_QueryWorkflow_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_QueryWorkflow_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _QueryWorkflowResponse_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.QueryFailedError, err = _QueryFailedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ClientVersionNotSupportedError, err = _ClientVersionNotSupportedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.QueryFailedError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ClientVersionNotSupportedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_QueryWorkflow_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_QueryWorkflow_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_QueryWorkflow_Result struct could not be encoded.
func (v *HistoryService_QueryWorkflow_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.QueryFailedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.QueryFailedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ClientVersionNotSupportedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ClientVersionNotSupportedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.QueryFailedError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ClientVersionNotSupportedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_QueryWorkflow_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _QueryWorkflowResponse_1_Decode(sr stream.Reader) (*QueryWorkflowResponse, error) {
	var v QueryWorkflowResponse
	err := v.Decode(sr)
	return &v, err
}

func _QueryFailedError_Decode(sr stream.Reader) (*shared.QueryFailedError, error) {
	var v shared.QueryFailedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_QueryWorkflow_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_QueryWorkflow_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_QueryWorkflow_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _QueryWorkflowResponse_1_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.QueryFailedError, err = _QueryFailedError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ClientVersionNotSupportedError, err = _ClientVersionNotSupportedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.QueryFailedError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ClientVersionNotSupportedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_QueryWorkflow_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_QueryWorkflow_Result
// struct.
func (v *HistoryService_QueryWorkflow_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.QueryFailedError != nil {
		fields[i] = fmt.Sprintf("QueryFailedError: %v", v.QueryFailedError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.ClientVersionNotSupportedError != nil {
		fields[i] = fmt.Sprintf("ClientVersionNotSupportedError: %v", v.ClientVersionNotSupportedError)
		i++
	}

	return fmt.Sprintf("HistoryService_QueryWorkflow_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_QueryWorkflow_Result match the
// provided HistoryService_QueryWorkflow_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_QueryWorkflow_Result) Equals(rhs *HistoryService_QueryWorkflow_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.QueryFailedError == nil && rhs.QueryFailedError == nil) || (v.QueryFailedError != nil && rhs.QueryFailedError != nil && v.QueryFailedError.Equals(rhs.QueryFailedError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.ClientVersionNotSupportedError == nil && rhs.ClientVersionNotSupportedError == nil) || (v.ClientVersionNotSupportedError != nil && rhs.ClientVersionNotSupportedError != nil && v.ClientVersionNotSupportedError.Equals(rhs.ClientVersionNotSupportedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_QueryWorkflow_Result.
func (v *HistoryService_QueryWorkflow_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.QueryFailedError != nil {
		err = multierr.Append(err, enc.AddObject("queryFailedError", v.QueryFailedError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.ClientVersionNotSupportedError != nil {
		err = multierr.Append(err, enc.AddObject("clientVersionNotSupportedError", v.ClientVersionNotSupportedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetSuccess() (o *QueryWorkflowResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetQueryFailedError returns the value of QueryFailedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetQueryFailedError() (o *shared.QueryFailedError) {
	if v != nil && v.QueryFailedError != nil {
		return v.QueryFailedError
	}

	return
}

// IsSetQueryFailedError returns true if QueryFailedError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetQueryFailedError() bool {
	return v != nil && v.QueryFailedError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetClientVersionNotSupportedError returns the value of ClientVersionNotSupportedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_QueryWorkflow_Result) GetClientVersionNotSupportedError() (o *shared.ClientVersionNotSupportedError) {
	if v != nil && v.ClientVersionNotSupportedError != nil {
		return v.ClientVersionNotSupportedError
	}

	return
}

// IsSetClientVersionNotSupportedError returns true if ClientVersionNotSupportedError is not nil.
func (v *HistoryService_QueryWorkflow_Result) IsSetClientVersionNotSupportedError() bool {
	return v != nil && v.ClientVersionNotSupportedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "QueryWorkflow" for this struct.
func (v *HistoryService_QueryWorkflow_Result) MethodName() string {
	return "QueryWorkflow"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_QueryWorkflow_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RatelimitUpdate_Args represents the arguments for the HistoryService.RatelimitUpdate function.
//
// The arguments for RatelimitUpdate are sent and received over the wire as this struct.
type HistoryService_RatelimitUpdate_Args struct {
	Request *RatelimitUpdateRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_RatelimitUpdate_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RatelimitUpdate_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RatelimitUpdateRequest_Read(w wire.Value) (*RatelimitUpdateRequest, error) {
	var v RatelimitUpdateRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RatelimitUpdate_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RatelimitUpdate_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RatelimitUpdate_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RatelimitUpdate_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _RatelimitUpdateRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RatelimitUpdate_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RatelimitUpdate_Args struct could not be encoded.
func (v *HistoryService_RatelimitUpdate_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RatelimitUpdateRequest_Decode(sr stream.Reader) (*RatelimitUpdateRequest, error) {
	var v RatelimitUpdateRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RatelimitUpdate_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RatelimitUpdate_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RatelimitUpdate_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _RatelimitUpdateRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RatelimitUpdate_Args
// struct.
func (v *HistoryService_RatelimitUpdate_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_RatelimitUpdate_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RatelimitUpdate_Args match the
// provided HistoryService_RatelimitUpdate_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RatelimitUpdate_Args) Equals(rhs *HistoryService_RatelimitUpdate_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RatelimitUpdate_Args.
func (v *HistoryService_RatelimitUpdate_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_RatelimitUpdate_Args) GetRequest() (o *RatelimitUpdateRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_RatelimitUpdate_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RatelimitUpdate" for this struct.
func (v *HistoryService_RatelimitUpdate_Args) MethodName() string {
	return "RatelimitUpdate"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RatelimitUpdate_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RatelimitUpdate_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RatelimitUpdate
// function.
var HistoryService_RatelimitUpdate_Helper = struct {
	// Args accepts the parameters of RatelimitUpdate in-order and returns
	// the arguments struct for the function.
	Args func(
		request *RatelimitUpdateRequest,
	) *HistoryService_RatelimitUpdate_Args

	// IsException returns true if the given error can be thrown
	// by RatelimitUpdate.
	//
	// An error can be thrown by RatelimitUpdate only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RatelimitUpdate
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// RatelimitUpdate into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by RatelimitUpdate
	//
	//   value, err := RatelimitUpdate(args)
	//   result, err := HistoryService_RatelimitUpdate_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RatelimitUpdate: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*RatelimitUpdateResponse, error) (*HistoryService_RatelimitUpdate_Result, error)

	// UnwrapResponse takes the result struct for RatelimitUpdate
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if RatelimitUpdate threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_RatelimitUpdate_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RatelimitUpdate_Result) (*RatelimitUpdateResponse, error)
}{}

func init() {
	HistoryService_RatelimitUpdate_Helper.Args = func(
		request *RatelimitUpdateRequest,
	) *HistoryService_RatelimitUpdate_Args {
		return &HistoryService_RatelimitUpdate_Args{
			Request: request,
		}
	}

	HistoryService_RatelimitUpdate_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *ShardOwnershipLostError:
			return true
		default:
			return false
		}
	}

	HistoryService_RatelimitUpdate_Helper.WrapResponse = func(success *RatelimitUpdateResponse, err error) (*HistoryService_RatelimitUpdate_Result, error) {
		if err == nil {
			return &HistoryService_RatelimitUpdate_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RatelimitUpdate_Result.BadRequestError")
			}
			return &HistoryService_RatelimitUpdate_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RatelimitUpdate_Result.InternalServiceError")
			}
			return &HistoryService_RatelimitUpdate_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RatelimitUpdate_Result.ServiceBusyError")
			}
			return &HistoryService_RatelimitUpdate_Result{ServiceBusyError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RatelimitUpdate_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RatelimitUpdate_Result{ShardOwnershipLostError: e}, nil
		}

		return nil, err
	}
	HistoryService_RatelimitUpdate_Helper.UnwrapResponse = func(result *HistoryService_RatelimitUpdate_Result) (success *RatelimitUpdateResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_RatelimitUpdate_Result represents the result of a HistoryService.RatelimitUpdate function call.
//
// The result of a RatelimitUpdate execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_RatelimitUpdate_Result struct {
	// Value returned by RatelimitUpdate after a successful execution.
	Success                 *RatelimitUpdateResponse     `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
}

// ToWire translates a HistoryService_RatelimitUpdate_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RatelimitUpdate_Result) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RatelimitUpdate_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RatelimitUpdateResponse_Read(w wire.Value) (*RatelimitUpdateResponse, error) {
	var v RatelimitUpdateResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RatelimitUpdate_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RatelimitUpdate_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RatelimitUpdate_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RatelimitUpdate_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _RatelimitUpdateResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RatelimitUpdate_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RatelimitUpdate_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RatelimitUpdate_Result struct could not be encoded.
func (v *HistoryService_RatelimitUpdate_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_RatelimitUpdate_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _RatelimitUpdateResponse_Decode(sr stream.Reader) (*RatelimitUpdateResponse, error) {
	var v RatelimitUpdateResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RatelimitUpdate_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RatelimitUpdate_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RatelimitUpdate_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _RatelimitUpdateResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RatelimitUpdate_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RatelimitUpdate_Result
// struct.
func (v *HistoryService_RatelimitUpdate_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}

	return fmt.Sprintf("HistoryService_RatelimitUpdate_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RatelimitUpdate_Result match the
// provided HistoryService_RatelimitUpdate_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RatelimitUpdate_Result) Equals(rhs *HistoryService_RatelimitUpdate_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RatelimitUpdate_Result.
func (v *HistoryService_RatelimitUpdate_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_RatelimitUpdate_Result) GetSuccess() (o *RatelimitUpdateResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_RatelimitUpdate_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RatelimitUpdate_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RatelimitUpdate_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RatelimitUpdate_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RatelimitUpdate_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RatelimitUpdate_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RatelimitUpdate_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RatelimitUpdate_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RatelimitUpdate_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RatelimitUpdate" for this struct.
func (v *HistoryService_RatelimitUpdate_Result) MethodName() string {
	return "RatelimitUpdate"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RatelimitUpdate_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ReadDLQMessages_Args represents the arguments for the HistoryService.ReadDLQMessages function.
//
// The arguments for ReadDLQMessages are sent and received over the wire as this struct.
type HistoryService_ReadDLQMessages_Args struct {
	Request *replicator.ReadDLQMessagesRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_ReadDLQMessages_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ReadDLQMessages_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ReadDLQMessagesRequest_Read(w wire.Value) (*replicator.ReadDLQMessagesRequest, error) {
	var v replicator.ReadDLQMessagesRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ReadDLQMessages_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ReadDLQMessages_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ReadDLQMessages_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ReadDLQMessages_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _ReadDLQMessagesRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ReadDLQMessages_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ReadDLQMessages_Args struct could not be encoded.
func (v *HistoryService_ReadDLQMessages_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ReadDLQMessagesRequest_Decode(sr stream.Reader) (*replicator.ReadDLQMessagesRequest, error) {
	var v replicator.ReadDLQMessagesRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ReadDLQMessages_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ReadDLQMessages_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ReadDLQMessages_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _ReadDLQMessagesRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ReadDLQMessages_Args
// struct.
func (v *HistoryService_ReadDLQMessages_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_ReadDLQMessages_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ReadDLQMessages_Args match the
// provided HistoryService_ReadDLQMessages_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ReadDLQMessages_Args) Equals(rhs *HistoryService_ReadDLQMessages_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ReadDLQMessages_Args.
func (v *HistoryService_ReadDLQMessages_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Args) GetRequest() (o *replicator.ReadDLQMessagesRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_ReadDLQMessages_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ReadDLQMessages" for this struct.
func (v *HistoryService_ReadDLQMessages_Args) MethodName() string {
	return "ReadDLQMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ReadDLQMessages_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ReadDLQMessages_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ReadDLQMessages
// function.
var HistoryService_ReadDLQMessages_Helper = struct {
	// Args accepts the parameters of ReadDLQMessages in-order and returns
	// the arguments struct for the function.
	Args func(
		request *replicator.ReadDLQMessagesRequest,
	) *HistoryService_ReadDLQMessages_Args

	// IsException returns true if the given error can be thrown
	// by ReadDLQMessages.
	//
	// An error can be thrown by ReadDLQMessages only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ReadDLQMessages
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// ReadDLQMessages into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by ReadDLQMessages
	//
	//   value, err := ReadDLQMessages(args)
	//   result, err := HistoryService_ReadDLQMessages_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ReadDLQMessages: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*replicator.ReadDLQMessagesResponse, error) (*HistoryService_ReadDLQMessages_Result, error)

	// UnwrapResponse takes the result struct for ReadDLQMessages
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if ReadDLQMessages threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_ReadDLQMessages_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ReadDLQMessages_Result) (*replicator.ReadDLQMessagesResponse, error)
}{}

func init() {
	HistoryService_ReadDLQMessages_Helper.Args = func(
		request *replicator.ReadDLQMessagesRequest,
	) *HistoryService_ReadDLQMessages_Args {
		return &HistoryService_ReadDLQMessages_Args{
			Request: request,
		}
	}

	HistoryService_ReadDLQMessages_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		default:
			return false
		}
	}

	HistoryService_ReadDLQMessages_Helper.WrapResponse = func(success *replicator.ReadDLQMessagesResponse, err error) (*HistoryService_ReadDLQMessages_Result, error) {
		if err == nil {
			return &HistoryService_ReadDLQMessages_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReadDLQMessages_Result.BadRequestError")
			}
			return &HistoryService_ReadDLQMessages_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReadDLQMessages_Result.InternalServiceError")
			}
			return &HistoryService_ReadDLQMessages_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReadDLQMessages_Result.ServiceBusyError")
			}
			return &HistoryService_ReadDLQMessages_Result{ServiceBusyError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReadDLQMessages_Result.EntityNotExistError")
			}
			return &HistoryService_ReadDLQMessages_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReadDLQMessages_Result.ShardOwnershipLostError")
			}
			return &HistoryService_ReadDLQMessages_Result{ShardOwnershipLostError: e}, nil
		}

		return nil, err
	}
	HistoryService_ReadDLQMessages_Helper.UnwrapResponse = func(result *HistoryService_ReadDLQMessages_Result) (success *replicator.ReadDLQMessagesResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_ReadDLQMessages_Result represents the result of a HistoryService.ReadDLQMessages function call.
//
// The result of a ReadDLQMessages execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_ReadDLQMessages_Result struct {
	// Value returned by ReadDLQMessages after a successful execution.
	Success                 *replicator.ReadDLQMessagesResponse `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError             `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError        `json:"internalServiceError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError            `json:"serviceBusyError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError        `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError            `json:"shardOwnershipLostError,omitempty"`
}

// ToWire translates a HistoryService_ReadDLQMessages_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ReadDLQMessages_Result) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ReadDLQMessages_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ReadDLQMessagesResponse_Read(w wire.Value) (*replicator.ReadDLQMessagesResponse, error) {
	var v replicator.ReadDLQMessagesResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ReadDLQMessages_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ReadDLQMessages_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ReadDLQMessages_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ReadDLQMessages_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _ReadDLQMessagesResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_ReadDLQMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ReadDLQMessages_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ReadDLQMessages_Result struct could not be encoded.
func (v *HistoryService_ReadDLQMessages_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_ReadDLQMessages_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _ReadDLQMessagesResponse_Decode(sr stream.Reader) (*replicator.ReadDLQMessagesResponse, error) {
	var v replicator.ReadDLQMessagesResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ReadDLQMessages_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ReadDLQMessages_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ReadDLQMessages_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _ReadDLQMessagesResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_ReadDLQMessages_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ReadDLQMessages_Result
// struct.
func (v *HistoryService_ReadDLQMessages_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}

	return fmt.Sprintf("HistoryService_ReadDLQMessages_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ReadDLQMessages_Result match the
// provided HistoryService_ReadDLQMessages_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ReadDLQMessages_Result) Equals(rhs *HistoryService_ReadDLQMessages_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ReadDLQMessages_Result.
func (v *HistoryService_ReadDLQMessages_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Result) GetSuccess() (o *replicator.ReadDLQMessagesResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_ReadDLQMessages_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ReadDLQMessages_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ReadDLQMessages_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_ReadDLQMessages_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_ReadDLQMessages_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReadDLQMessages_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_ReadDLQMessages_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ReadDLQMessages" for this struct.
func (v *HistoryService_ReadDLQMessages_Result) MethodName() string {
	return "ReadDLQMessages"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ReadDLQMessages_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ReapplyEvents_Args represents the arguments for the HistoryService.ReapplyEvents function.
//
// The arguments for ReapplyEvents are sent and received over the wire as this struct.
type HistoryService_ReapplyEvents_Args struct {
	ReapplyEventsRequest *ReapplyEventsRequest `json:"reapplyEventsRequest,omitempty"`
}

// ToWire translates a HistoryService_ReapplyEvents_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ReapplyEvents_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ReapplyEventsRequest != nil {
		w, err = v.ReapplyEventsRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ReapplyEventsRequest_1_Read(w wire.Value) (*ReapplyEventsRequest, error) {
	var v ReapplyEventsRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ReapplyEvents_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ReapplyEvents_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ReapplyEvents_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ReapplyEvents_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.ReapplyEventsRequest, err = _ReapplyEventsRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ReapplyEvents_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ReapplyEvents_Args struct could not be encoded.
func (v *HistoryService_ReapplyEvents_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ReapplyEventsRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ReapplyEventsRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ReapplyEventsRequest_1_Decode(sr stream.Reader) (*ReapplyEventsRequest, error) {
	var v ReapplyEventsRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ReapplyEvents_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ReapplyEvents_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ReapplyEvents_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.ReapplyEventsRequest, err = _ReapplyEventsRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ReapplyEvents_Args
// struct.
func (v *HistoryService_ReapplyEvents_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.ReapplyEventsRequest != nil {
		fields[i] = fmt.Sprintf("ReapplyEventsRequest: %v", v.ReapplyEventsRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_ReapplyEvents_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ReapplyEvents_Args match the
// provided HistoryService_ReapplyEvents_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ReapplyEvents_Args) Equals(rhs *HistoryService_ReapplyEvents_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ReapplyEventsRequest == nil && rhs.ReapplyEventsRequest == nil) || (v.ReapplyEventsRequest != nil && rhs.ReapplyEventsRequest != nil && v.ReapplyEventsRequest.Equals(rhs.ReapplyEventsRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ReapplyEvents_Args.
func (v *HistoryService_ReapplyEvents_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ReapplyEventsRequest != nil {
		err = multierr.Append(err, enc.AddObject("reapplyEventsRequest", v.ReapplyEventsRequest))
	}
	return err
}

// GetReapplyEventsRequest returns the value of ReapplyEventsRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Args) GetReapplyEventsRequest() (o *ReapplyEventsRequest) {
	if v != nil && v.ReapplyEventsRequest != nil {
		return v.ReapplyEventsRequest
	}

	return
}

// IsSetReapplyEventsRequest returns true if ReapplyEventsRequest is not nil.
func (v *HistoryService_ReapplyEvents_Args) IsSetReapplyEventsRequest() bool {
	return v != nil && v.ReapplyEventsRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ReapplyEvents" for this struct.
func (v *HistoryService_ReapplyEvents_Args) MethodName() string {
	return "ReapplyEvents"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ReapplyEvents_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ReapplyEvents_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ReapplyEvents
// function.
var HistoryService_ReapplyEvents_Helper = struct {
	// Args accepts the parameters of ReapplyEvents in-order and returns
	// the arguments struct for the function.
	Args func(
		reapplyEventsRequest *ReapplyEventsRequest,
	) *HistoryService_ReapplyEvents_Args

	// IsException returns true if the given error can be thrown
	// by ReapplyEvents.
	//
	// An error can be thrown by ReapplyEvents only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ReapplyEvents
	// given the error returned by it. The provided error may
	// be nil if ReapplyEvents did not fail.
	//
	// This allows mapping errors returned by ReapplyEvents into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// ReapplyEvents
	//
	//   err := ReapplyEvents(args)
	//   result, err := HistoryService_ReapplyEvents_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ReapplyEvents: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_ReapplyEvents_Result, error)

	// UnwrapResponse takes the result struct for ReapplyEvents
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if ReapplyEvents threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_ReapplyEvents_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ReapplyEvents_Result) error
}{}

func init() {
	HistoryService_ReapplyEvents_Helper.Args = func(
		reapplyEventsRequest *ReapplyEventsRequest,
	) *HistoryService_ReapplyEvents_Args {
		return &HistoryService_ReapplyEvents_Args{
			ReapplyEventsRequest: reapplyEventsRequest,
		}
	}

	HistoryService_ReapplyEvents_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.EntityNotExistsError:
			return true
		default:
			return false
		}
	}

	HistoryService_ReapplyEvents_Helper.WrapResponse = func(err error) (*HistoryService_ReapplyEvents_Result, error) {
		if err == nil {
			return &HistoryService_ReapplyEvents_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.BadRequestError")
			}
			return &HistoryService_ReapplyEvents_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.InternalServiceError")
			}
			return &HistoryService_ReapplyEvents_Result{InternalServiceError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.DomainNotActiveError")
			}
			return &HistoryService_ReapplyEvents_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.LimitExceededError")
			}
			return &HistoryService_ReapplyEvents_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.ServiceBusyError")
			}
			return &HistoryService_ReapplyEvents_Result{ServiceBusyError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.ShardOwnershipLostError")
			}
			return &HistoryService_ReapplyEvents_Result{ShardOwnershipLostError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReapplyEvents_Result.EntityNotExistError")
			}
			return &HistoryService_ReapplyEvents_Result{EntityNotExistError: e}, nil
		}

		return nil, err
	}
	HistoryService_ReapplyEvents_Helper.UnwrapResponse = func(result *HistoryService_ReapplyEvents_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		return
	}

}

// HistoryService_ReapplyEvents_Result represents the result of a HistoryService.ReapplyEvents function call.
//
// The result of a ReapplyEvents execution is sent and received over the wire as this struct.
type HistoryService_ReapplyEvents_Result struct {
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	DomainNotActiveError    *shared.DomainNotActiveError `json:"domainNotActiveError,omitempty"`
	LimitExceededError      *shared.LimitExceededError   `json:"limitExceededError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"`
}

// ToWire translates a HistoryService_ReapplyEvents_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ReapplyEvents_Result) ToWire() (wire.Value, error) {
	var (
		fields [7]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ReapplyEvents_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _DomainNotActiveError_Read(w wire.Value) (*shared.DomainNotActiveError, error) {
	var v shared.DomainNotActiveError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ReapplyEvents_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ReapplyEvents_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ReapplyEvents_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ReapplyEvents_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ReapplyEvents_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ReapplyEvents_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ReapplyEvents_Result struct could not be encoded.
func (v *HistoryService_ReapplyEvents_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_ReapplyEvents_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _DomainNotActiveError_Decode(sr stream.Reader) (*shared.DomainNotActiveError, error) {
	var v shared.DomainNotActiveError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ReapplyEvents_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ReapplyEvents_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ReapplyEvents_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ReapplyEvents_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ReapplyEvents_Result
// struct.
func (v *HistoryService_ReapplyEvents_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [7]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}

	return fmt.Sprintf("HistoryService_ReapplyEvents_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ReapplyEvents_Result match the
// provided HistoryService_ReapplyEvents_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ReapplyEvents_Result) Equals(rhs *HistoryService_ReapplyEvents_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ReapplyEvents_Result.
func (v *HistoryService_ReapplyEvents_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReapplyEvents_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_ReapplyEvents_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ReapplyEvents" for this struct.
func (v *HistoryService_ReapplyEvents_Result) MethodName() string {
	return "ReapplyEvents"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ReapplyEvents_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RecordActivityTaskHeartbeat_Args represents the arguments for the HistoryService.RecordActivityTaskHeartbeat function.
//
// The arguments for RecordActivityTaskHeartbeat are sent and received over the wire as this struct.
type HistoryService_RecordActivityTaskHeartbeat_Args struct {
	HeartbeatRequest *RecordActivityTaskHeartbeatRequest `json:"heartbeatRequest,omitempty"`
}

// ToWire translates a HistoryService_RecordActivityTaskHeartbeat_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.HeartbeatRequest != nil {
		w, err = v.HeartbeatRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordActivityTaskHeartbeatRequest_1_Read(w wire.Value) (*RecordActivityTaskHeartbeatRequest, error) {
	var v RecordActivityTaskHeartbeatRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RecordActivityTaskHeartbeat_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordActivityTaskHeartbeat_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordActivityTaskHeartbeat_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.HeartbeatRequest, err = _RecordActivityTaskHeartbeatRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RecordActivityTaskHeartbeat_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskHeartbeat_Args struct could not be encoded.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.HeartbeatRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.HeartbeatRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RecordActivityTaskHeartbeatRequest_1_Decode(sr stream.Reader) (*RecordActivityTaskHeartbeatRequest, error) {
	var v RecordActivityTaskHeartbeatRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RecordActivityTaskHeartbeat_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskHeartbeat_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.HeartbeatRequest, err = _RecordActivityTaskHeartbeatRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordActivityTaskHeartbeat_Args
// struct.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.HeartbeatRequest != nil {
		fields[i] = fmt.Sprintf("HeartbeatRequest: %v", v.HeartbeatRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordActivityTaskHeartbeat_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordActivityTaskHeartbeat_Args match the
// provided HistoryService_RecordActivityTaskHeartbeat_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) Equals(rhs *HistoryService_RecordActivityTaskHeartbeat_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.HeartbeatRequest == nil && rhs.HeartbeatRequest == nil) || (v.HeartbeatRequest != nil && rhs.HeartbeatRequest != nil && v.HeartbeatRequest.Equals(rhs.HeartbeatRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordActivityTaskHeartbeat_Args.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.HeartbeatRequest != nil {
		err = multierr.Append(err, enc.AddObject("heartbeatRequest", v.HeartbeatRequest))
	}
	return err
}

// GetHeartbeatRequest returns the value of HeartbeatRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) GetHeartbeatRequest() (o *RecordActivityTaskHeartbeatRequest) {
	if v != nil && v.HeartbeatRequest != nil {
		return v.HeartbeatRequest
	}

	return
}

// IsSetHeartbeatRequest returns true if HeartbeatRequest is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) IsSetHeartbeatRequest() bool {
	return v != nil && v.HeartbeatRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RecordActivityTaskHeartbeat" for this struct.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) MethodName() string {
	return "RecordActivityTaskHeartbeat"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RecordActivityTaskHeartbeat_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RecordActivityTaskHeartbeat_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RecordActivityTaskHeartbeat
// function.
var HistoryService_RecordActivityTaskHeartbeat_Helper = struct {
	// Args accepts the parameters of RecordActivityTaskHeartbeat in-order and returns
	// the arguments struct for the function.
	Args func(
		heartbeatRequest *RecordActivityTaskHeartbeatRequest,
	) *HistoryService_RecordActivityTaskHeartbeat_Args

	// IsException returns true if the given error can be thrown
	// by RecordActivityTaskHeartbeat.
	//
	// An error can be thrown by RecordActivityTaskHeartbeat only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RecordActivityTaskHeartbeat
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// RecordActivityTaskHeartbeat into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by RecordActivityTaskHeartbeat
	//
	//   value, err := RecordActivityTaskHeartbeat(args)
	//   result, err := HistoryService_RecordActivityTaskHeartbeat_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RecordActivityTaskHeartbeat: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.RecordActivityTaskHeartbeatResponse, error) (*HistoryService_RecordActivityTaskHeartbeat_Result, error)

	// UnwrapResponse takes the result struct for RecordActivityTaskHeartbeat
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if RecordActivityTaskHeartbeat threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_RecordActivityTaskHeartbeat_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RecordActivityTaskHeartbeat_Result) (*shared.RecordActivityTaskHeartbeatResponse, error)
}{}

func init() {
	HistoryService_RecordActivityTaskHeartbeat_Helper.Args = func(
		heartbeatRequest *RecordActivityTaskHeartbeatRequest,
	) *HistoryService_RecordActivityTaskHeartbeat_Args {
		return &HistoryService_RecordActivityTaskHeartbeat_Args{
			HeartbeatRequest: heartbeatRequest,
		}
	}

	HistoryService_RecordActivityTaskHeartbeat_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RecordActivityTaskHeartbeat_Helper.WrapResponse = func(success *shared.RecordActivityTaskHeartbeatResponse, err error) (*HistoryService_RecordActivityTaskHeartbeat_Result, error) {
		if err == nil {
			return &HistoryService_RecordActivityTaskHeartbeat_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.BadRequestError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.InternalServiceError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.EntityNotExistError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.DomainNotActiveError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.LimitExceededError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.ServiceBusyError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskHeartbeat_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RecordActivityTaskHeartbeat_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RecordActivityTaskHeartbeat_Helper.UnwrapResponse = func(result *HistoryService_RecordActivityTaskHeartbeat_Result) (success *shared.RecordActivityTaskHeartbeatResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_RecordActivityTaskHeartbeat_Result represents the result of a HistoryService.RecordActivityTaskHeartbeat function call.
//
// The result of a RecordActivityTaskHeartbeat execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_RecordActivityTaskHeartbeat_Result struct {
	// Value returned by RecordActivityTaskHeartbeat after a successful execution.
	Success                                *shared.RecordActivityTaskHeartbeatResponse    `json:"success,omitempty"`
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RecordActivityTaskHeartbeat_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) ToWire() (wire.Value, error) {
	var (
		fields [9]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RecordActivityTaskHeartbeat_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordActivityTaskHeartbeatResponse_Read(w wire.Value) (*shared.RecordActivityTaskHeartbeatResponse, error) {
	var v shared.RecordActivityTaskHeartbeatResponse
	err := v.FromWire(w)
	return &v, err
}

func _WorkflowExecutionAlreadyCompletedError_Read(w wire.Value) (*shared.WorkflowExecutionAlreadyCompletedError, error) {
	var v shared.WorkflowExecutionAlreadyCompletedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RecordActivityTaskHeartbeat_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordActivityTaskHeartbeat_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordActivityTaskHeartbeat_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _RecordActivityTaskHeartbeatResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RecordActivityTaskHeartbeat_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RecordActivityTaskHeartbeat_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskHeartbeat_Result struct could not be encoded.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_RecordActivityTaskHeartbeat_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _RecordActivityTaskHeartbeatResponse_Decode(sr stream.Reader) (*shared.RecordActivityTaskHeartbeatResponse, error) {
	var v shared.RecordActivityTaskHeartbeatResponse
	err := v.Decode(sr)
	return &v, err
}

func _WorkflowExecutionAlreadyCompletedError_Decode(sr stream.Reader) (*shared.WorkflowExecutionAlreadyCompletedError, error) {
	var v shared.WorkflowExecutionAlreadyCompletedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RecordActivityTaskHeartbeat_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskHeartbeat_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _RecordActivityTaskHeartbeatResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RecordActivityTaskHeartbeat_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordActivityTaskHeartbeat_Result
// struct.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [9]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordActivityTaskHeartbeat_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordActivityTaskHeartbeat_Result match the
// provided HistoryService_RecordActivityTaskHeartbeat_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) Equals(rhs *HistoryService_RecordActivityTaskHeartbeat_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordActivityTaskHeartbeat_Result.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetSuccess() (o *shared.RecordActivityTaskHeartbeatResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RecordActivityTaskHeartbeat" for this struct.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) MethodName() string {
	return "RecordActivityTaskHeartbeat"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RecordActivityTaskHeartbeat_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RecordActivityTaskStarted_Args represents the arguments for the HistoryService.RecordActivityTaskStarted function.
//
// The arguments for RecordActivityTaskStarted are sent and received over the wire as this struct.
type HistoryService_RecordActivityTaskStarted_Args struct {
	AddRequest *RecordActivityTaskStartedRequest `json:"addRequest,omitempty"`
}

// ToWire translates a HistoryService_RecordActivityTaskStarted_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordActivityTaskStarted_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.AddRequest != nil {
		w, err = v.AddRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordActivityTaskStartedRequest_Read(w wire.Value) (*RecordActivityTaskStartedRequest, error) {
	var v RecordActivityTaskStartedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RecordActivityTaskStarted_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordActivityTaskStarted_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordActivityTaskStarted_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordActivityTaskStarted_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.AddRequest, err = _RecordActivityTaskStartedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RecordActivityTaskStarted_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskStarted_Args struct could not be encoded.
func (v *HistoryService_RecordActivityTaskStarted_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.AddRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AddRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RecordActivityTaskStartedRequest_Decode(sr stream.Reader) (*RecordActivityTaskStartedRequest, error) {
	var v RecordActivityTaskStartedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RecordActivityTaskStarted_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskStarted_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordActivityTaskStarted_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.AddRequest, err = _RecordActivityTaskStartedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordActivityTaskStarted_Args
// struct.
func (v *HistoryService_RecordActivityTaskStarted_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.AddRequest != nil {
		fields[i] = fmt.Sprintf("AddRequest: %v", v.AddRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordActivityTaskStarted_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordActivityTaskStarted_Args match the
// provided HistoryService_RecordActivityTaskStarted_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordActivityTaskStarted_Args) Equals(rhs *HistoryService_RecordActivityTaskStarted_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.AddRequest == nil && rhs.AddRequest == nil) || (v.AddRequest != nil && rhs.AddRequest != nil && v.AddRequest.Equals(rhs.AddRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordActivityTaskStarted_Args.
func (v *HistoryService_RecordActivityTaskStarted_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.AddRequest != nil {
		err = multierr.Append(err, enc.AddObject("addRequest", v.AddRequest))
	}
	return err
}

// GetAddRequest returns the value of AddRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Args) GetAddRequest() (o *RecordActivityTaskStartedRequest) {
	if v != nil && v.AddRequest != nil {
		return v.AddRequest
	}

	return
}

// IsSetAddRequest returns true if AddRequest is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Args) IsSetAddRequest() bool {
	return v != nil && v.AddRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RecordActivityTaskStarted" for this struct.
func (v *HistoryService_RecordActivityTaskStarted_Args) MethodName() string {
	return "RecordActivityTaskStarted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RecordActivityTaskStarted_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RecordActivityTaskStarted_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RecordActivityTaskStarted
// function.
var HistoryService_RecordActivityTaskStarted_Helper = struct {
	// Args accepts the parameters of RecordActivityTaskStarted in-order and returns
	// the arguments struct for the function.
	Args func(
		addRequest *RecordActivityTaskStartedRequest,
	) *HistoryService_RecordActivityTaskStarted_Args

	// IsException returns true if the given error can be thrown
	// by RecordActivityTaskStarted.
	//
	// An error can be thrown by RecordActivityTaskStarted only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RecordActivityTaskStarted
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// RecordActivityTaskStarted into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by RecordActivityTaskStarted
	//
	//   value, err := RecordActivityTaskStarted(args)
	//   result, err := HistoryService_RecordActivityTaskStarted_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RecordActivityTaskStarted: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*RecordActivityTaskStartedResponse, error) (*HistoryService_RecordActivityTaskStarted_Result, error)

	// UnwrapResponse takes the result struct for RecordActivityTaskStarted
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if RecordActivityTaskStarted threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_RecordActivityTaskStarted_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RecordActivityTaskStarted_Result) (*RecordActivityTaskStartedResponse, error)
}{}

func init() {
	HistoryService_RecordActivityTaskStarted_Helper.Args = func(
		addRequest *RecordActivityTaskStartedRequest,
	) *HistoryService_RecordActivityTaskStarted_Args {
		return &HistoryService_RecordActivityTaskStarted_Args{
			AddRequest: addRequest,
		}
	}

	HistoryService_RecordActivityTaskStarted_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *EventAlreadyStartedError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RecordActivityTaskStarted_Helper.WrapResponse = func(success *RecordActivityTaskStartedResponse, err error) (*HistoryService_RecordActivityTaskStarted_Result, error) {
		if err == nil {
			return &HistoryService_RecordActivityTaskStarted_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.BadRequestError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.InternalServiceError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{InternalServiceError: e}, nil
		case *EventAlreadyStartedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.EventAlreadyStartedError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{EventAlreadyStartedError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.EntityNotExistError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.DomainNotActiveError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.LimitExceededError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.ServiceBusyError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordActivityTaskStarted_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RecordActivityTaskStarted_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RecordActivityTaskStarted_Helper.UnwrapResponse = func(result *HistoryService_RecordActivityTaskStarted_Result) (success *RecordActivityTaskStartedResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EventAlreadyStartedError != nil {
			err = result.EventAlreadyStartedError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_RecordActivityTaskStarted_Result represents the result of a HistoryService.RecordActivityTaskStarted function call.
//
// The result of a RecordActivityTaskStarted execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_RecordActivityTaskStarted_Result struct {
	// Value returned by RecordActivityTaskStarted after a successful execution.
	Success                                *RecordActivityTaskStartedResponse             `json:"success,omitempty"`
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EventAlreadyStartedError               *EventAlreadyStartedError                      `json:"eventAlreadyStartedError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RecordActivityTaskStarted_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordActivityTaskStarted_Result) ToWire() (wire.Value, error) {
	var (
		fields [10]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EventAlreadyStartedError != nil {
		w, err = v.EventAlreadyStartedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 9, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RecordActivityTaskStarted_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordActivityTaskStartedResponse_Read(w wire.Value) (*RecordActivityTaskStartedResponse, error) {
	var v RecordActivityTaskStartedResponse
	err := v.FromWire(w)
	return &v, err
}

func _EventAlreadyStartedError_Read(w wire.Value) (*EventAlreadyStartedError, error) {
	var v EventAlreadyStartedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RecordActivityTaskStarted_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordActivityTaskStarted_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordActivityTaskStarted_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordActivityTaskStarted_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _RecordActivityTaskStartedResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EventAlreadyStartedError, err = _EventAlreadyStartedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 9:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EventAlreadyStartedError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RecordActivityTaskStarted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RecordActivityTaskStarted_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskStarted_Result struct could not be encoded.
func (v *HistoryService_RecordActivityTaskStarted_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EventAlreadyStartedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EventAlreadyStartedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 9, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EventAlreadyStartedError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_RecordActivityTaskStarted_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _RecordActivityTaskStartedResponse_Decode(sr stream.Reader) (*RecordActivityTaskStartedResponse, error) {
	var v RecordActivityTaskStartedResponse
	err := v.Decode(sr)
	return &v, err
}

func _EventAlreadyStartedError_Decode(sr stream.Reader) (*EventAlreadyStartedError, error) {
	var v EventAlreadyStartedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RecordActivityTaskStarted_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordActivityTaskStarted_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordActivityTaskStarted_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _RecordActivityTaskStartedResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EventAlreadyStartedError, err = _EventAlreadyStartedError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 9 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EventAlreadyStartedError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RecordActivityTaskStarted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordActivityTaskStarted_Result
// struct.
func (v *HistoryService_RecordActivityTaskStarted_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [10]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EventAlreadyStartedError != nil {
		fields[i] = fmt.Sprintf("EventAlreadyStartedError: %v", v.EventAlreadyStartedError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordActivityTaskStarted_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordActivityTaskStarted_Result match the
// provided HistoryService_RecordActivityTaskStarted_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordActivityTaskStarted_Result) Equals(rhs *HistoryService_RecordActivityTaskStarted_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EventAlreadyStartedError == nil && rhs.EventAlreadyStartedError == nil) || (v.EventAlreadyStartedError != nil && rhs.EventAlreadyStartedError != nil && v.EventAlreadyStartedError.Equals(rhs.EventAlreadyStartedError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordActivityTaskStarted_Result.
func (v *HistoryService_RecordActivityTaskStarted_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EventAlreadyStartedError != nil {
		err = multierr.Append(err, enc.AddObject("eventAlreadyStartedError", v.EventAlreadyStartedError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetSuccess() (o *RecordActivityTaskStartedResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEventAlreadyStartedError returns the value of EventAlreadyStartedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetEventAlreadyStartedError() (o *EventAlreadyStartedError) {
	if v != nil && v.EventAlreadyStartedError != nil {
		return v.EventAlreadyStartedError
	}

	return
}

// IsSetEventAlreadyStartedError returns true if EventAlreadyStartedError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetEventAlreadyStartedError() bool {
	return v != nil && v.EventAlreadyStartedError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordActivityTaskStarted_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RecordActivityTaskStarted_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RecordActivityTaskStarted" for this struct.
func (v *HistoryService_RecordActivityTaskStarted_Result) MethodName() string {
	return "RecordActivityTaskStarted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RecordActivityTaskStarted_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RecordChildExecutionCompleted_Args represents the arguments for the HistoryService.RecordChildExecutionCompleted function.
//
// The arguments for RecordChildExecutionCompleted are sent and received over the wire as this struct.
type HistoryService_RecordChildExecutionCompleted_Args struct {
	CompletionRequest *RecordChildExecutionCompletedRequest `json:"completionRequest,omitempty"`
}

// ToWire translates a HistoryService_RecordChildExecutionCompleted_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordChildExecutionCompleted_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.CompletionRequest != nil {
		w, err = v.CompletionRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordChildExecutionCompletedRequest_Read(w wire.Value) (*RecordChildExecutionCompletedRequest, error) {
	var v RecordChildExecutionCompletedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RecordChildExecutionCompleted_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordChildExecutionCompleted_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordChildExecutionCompleted_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordChildExecutionCompleted_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.CompletionRequest, err = _RecordChildExecutionCompletedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RecordChildExecutionCompleted_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordChildExecutionCompleted_Args struct could not be encoded.
func (v *HistoryService_RecordChildExecutionCompleted_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.CompletionRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompletionRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RecordChildExecutionCompletedRequest_Decode(sr stream.Reader) (*RecordChildExecutionCompletedRequest, error) {
	var v RecordChildExecutionCompletedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RecordChildExecutionCompleted_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordChildExecutionCompleted_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordChildExecutionCompleted_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.CompletionRequest, err = _RecordChildExecutionCompletedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordChildExecutionCompleted_Args
// struct.
func (v *HistoryService_RecordChildExecutionCompleted_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.CompletionRequest != nil {
		fields[i] = fmt.Sprintf("CompletionRequest: %v", v.CompletionRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordChildExecutionCompleted_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordChildExecutionCompleted_Args match the
// provided HistoryService_RecordChildExecutionCompleted_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordChildExecutionCompleted_Args) Equals(rhs *HistoryService_RecordChildExecutionCompleted_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.CompletionRequest == nil && rhs.CompletionRequest == nil) || (v.CompletionRequest != nil && rhs.CompletionRequest != nil && v.CompletionRequest.Equals(rhs.CompletionRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordChildExecutionCompleted_Args.
func (v *HistoryService_RecordChildExecutionCompleted_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.CompletionRequest != nil {
		err = multierr.Append(err, enc.AddObject("completionRequest", v.CompletionRequest))
	}
	return err
}

// GetCompletionRequest returns the value of CompletionRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Args) GetCompletionRequest() (o *RecordChildExecutionCompletedRequest) {
	if v != nil && v.CompletionRequest != nil {
		return v.CompletionRequest
	}

	return
}

// IsSetCompletionRequest returns true if CompletionRequest is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Args) IsSetCompletionRequest() bool {
	return v != nil && v.CompletionRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RecordChildExecutionCompleted" for this struct.
func (v *HistoryService_RecordChildExecutionCompleted_Args) MethodName() string {
	return "RecordChildExecutionCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RecordChildExecutionCompleted_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RecordChildExecutionCompleted_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RecordChildExecutionCompleted
// function.
var HistoryService_RecordChildExecutionCompleted_Helper = struct {
	// Args accepts the parameters of RecordChildExecutionCompleted in-order and returns
	// the arguments struct for the function.
	Args func(
		completionRequest *RecordChildExecutionCompletedRequest,
	) *HistoryService_RecordChildExecutionCompleted_Args

	// IsException returns true if the given error can be thrown
	// by RecordChildExecutionCompleted.
	//
	// An error can be thrown by RecordChildExecutionCompleted only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RecordChildExecutionCompleted
	// given the error returned by it. The provided error may
	// be nil if RecordChildExecutionCompleted did not fail.
	//
	// This allows mapping errors returned by RecordChildExecutionCompleted into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RecordChildExecutionCompleted
	//
	//   err := RecordChildExecutionCompleted(args)
	//   result, err := HistoryService_RecordChildExecutionCompleted_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RecordChildExecutionCompleted: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RecordChildExecutionCompleted_Result, error)

	// UnwrapResponse takes the result struct for RecordChildExecutionCompleted
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RecordChildExecutionCompleted threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RecordChildExecutionCompleted_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RecordChildExecutionCompleted_Result) error
}{}

func init() {
	HistoryService_RecordChildExecutionCompleted_Helper.Args = func(
		completionRequest *RecordChildExecutionCompletedRequest,
	) *HistoryService_RecordChildExecutionCompleted_Args {
		return &HistoryService_RecordChildExecutionCompleted_Args{
			CompletionRequest: completionRequest,
		}
	}

	HistoryService_RecordChildExecutionCompleted_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RecordChildExecutionCompleted_Helper.WrapResponse = func(err error) (*HistoryService_RecordChildExecutionCompleted_Result, error) {
		if err == nil {
			return &HistoryService_RecordChildExecutionCompleted_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.BadRequestError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.InternalServiceError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.EntityNotExistError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.DomainNotActiveError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.LimitExceededError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.ServiceBusyError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordChildExecutionCompleted_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RecordChildExecutionCompleted_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RecordChildExecutionCompleted_Helper.UnwrapResponse = func(result *HistoryService_RecordChildExecutionCompleted_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RecordChildExecutionCompleted_Result represents the result of a HistoryService.RecordChildExecutionCompleted function call.
//
// The result of a RecordChildExecutionCompleted execution is sent and received over the wire as this struct.
type HistoryService_RecordChildExecutionCompleted_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RecordChildExecutionCompleted_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordChildExecutionCompleted_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RecordChildExecutionCompleted_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RecordChildExecutionCompleted_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordChildExecutionCompleted_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordChildExecutionCompleted_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordChildExecutionCompleted_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RecordChildExecutionCompleted_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RecordChildExecutionCompleted_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordChildExecutionCompleted_Result struct could not be encoded.
func (v *HistoryService_RecordChildExecutionCompleted_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RecordChildExecutionCompleted_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RecordChildExecutionCompleted_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordChildExecutionCompleted_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordChildExecutionCompleted_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RecordChildExecutionCompleted_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordChildExecutionCompleted_Result
// struct.
func (v *HistoryService_RecordChildExecutionCompleted_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordChildExecutionCompleted_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordChildExecutionCompleted_Result match the
// provided HistoryService_RecordChildExecutionCompleted_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordChildExecutionCompleted_Result) Equals(rhs *HistoryService_RecordChildExecutionCompleted_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordChildExecutionCompleted_Result.
func (v *HistoryService_RecordChildExecutionCompleted_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordChildExecutionCompleted_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RecordChildExecutionCompleted_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RecordChildExecutionCompleted" for this struct.
func (v *HistoryService_RecordChildExecutionCompleted_Result) MethodName() string {
	return "RecordChildExecutionCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RecordChildExecutionCompleted_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RecordDecisionTaskStarted_Args represents the arguments for the HistoryService.RecordDecisionTaskStarted function.
//
// The arguments for RecordDecisionTaskStarted are sent and received over the wire as this struct.
type HistoryService_RecordDecisionTaskStarted_Args struct {
	AddRequest *RecordDecisionTaskStartedRequest `json:"addRequest,omitempty"`
}

// ToWire translates a HistoryService_RecordDecisionTaskStarted_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordDecisionTaskStarted_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.AddRequest != nil {
		w, err = v.AddRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RecordDecisionTaskStartedRequest_Read(w wire.Value) (*RecordDecisionTaskStartedRequest, error) {
	var v RecordDecisionTaskStartedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RecordDecisionTaskStarted_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordDecisionTaskStarted_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordDecisionTaskStarted_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordDecisionTaskStarted_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.AddRequest, err = _RecordDecisionTaskStartedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RecordDecisionTaskStarted_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordDecisionTaskStarted_Args struct could not be encoded.
func (v *HistoryService_RecordDecisionTaskStarted_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.AddRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AddRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RecordDecisionTaskStartedRequest_Decode(sr stream.Reader) (*RecordDecisionTaskStartedRequest, error) {
	var v RecordDecisionTaskStartedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RecordDecisionTaskStarted_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordDecisionTaskStarted_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordDecisionTaskStarted_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.AddRequest, err = _RecordDecisionTaskStartedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordDecisionTaskStarted_Args
// struct.
func (v *HistoryService_RecordDecisionTaskStarted_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.AddRequest != nil {
		fields[i] = fmt.Sprintf("AddRequest: %v", v.AddRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordDecisionTaskStarted_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordDecisionTaskStarted_Args match the
// provided HistoryService_RecordDecisionTaskStarted_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordDecisionTaskStarted_Args) Equals(rhs *HistoryService_RecordDecisionTaskStarted_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.AddRequest == nil && rhs.AddRequest == nil) || (v.AddRequest != nil && rhs.AddRequest != nil && v.AddRequest.Equals(rhs.AddRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordDecisionTaskStarted_Args.
func (v *HistoryService_RecordDecisionTaskStarted_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.AddRequest != nil {
		err = multierr.Append(err, enc.AddObject("addRequest", v.AddRequest))
	}
	return err
}

// GetAddRequest returns the value of AddRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Args) GetAddRequest() (o *RecordDecisionTaskStartedRequest) {
	if v != nil && v.AddRequest != nil {
		return v.AddRequest
	}

	return
}

// IsSetAddRequest returns true if AddRequest is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Args) IsSetAddRequest() bool {
	return v != nil && v.AddRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RecordDecisionTaskStarted" for this struct.
func (v *HistoryService_RecordDecisionTaskStarted_Args) MethodName() string {
	return "RecordDecisionTaskStarted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RecordDecisionTaskStarted_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RecordDecisionTaskStarted_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RecordDecisionTaskStarted
// function.
var HistoryService_RecordDecisionTaskStarted_Helper = struct {
	// Args accepts the parameters of RecordDecisionTaskStarted in-order and returns
	// the arguments struct for the function.
	Args func(
		addRequest *RecordDecisionTaskStartedRequest,
	) *HistoryService_RecordDecisionTaskStarted_Args

	// IsException returns true if the given error can be thrown
	// by RecordDecisionTaskStarted.
	//
	// An error can be thrown by RecordDecisionTaskStarted only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RecordDecisionTaskStarted
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// RecordDecisionTaskStarted into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by RecordDecisionTaskStarted
	//
	//   value, err := RecordDecisionTaskStarted(args)
	//   result, err := HistoryService_RecordDecisionTaskStarted_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RecordDecisionTaskStarted: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*RecordDecisionTaskStartedResponse, error) (*HistoryService_RecordDecisionTaskStarted_Result, error)

	// UnwrapResponse takes the result struct for RecordDecisionTaskStarted
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if RecordDecisionTaskStarted threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_RecordDecisionTaskStarted_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RecordDecisionTaskStarted_Result) (*RecordDecisionTaskStartedResponse, error)
}{}

func init() {
	HistoryService_RecordDecisionTaskStarted_Helper.Args = func(
		addRequest *RecordDecisionTaskStartedRequest,
	) *HistoryService_RecordDecisionTaskStarted_Args {
		return &HistoryService_RecordDecisionTaskStarted_Args{
			AddRequest: addRequest,
		}
	}

	HistoryService_RecordDecisionTaskStarted_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *EventAlreadyStartedError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RecordDecisionTaskStarted_Helper.WrapResponse = func(success *RecordDecisionTaskStartedResponse, err error) (*HistoryService_RecordDecisionTaskStarted_Result, error) {
		if err == nil {
			return &HistoryService_RecordDecisionTaskStarted_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.BadRequestError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.InternalServiceError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{InternalServiceError: e}, nil
		case *EventAlreadyStartedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.EventAlreadyStartedError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{EventAlreadyStartedError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.EntityNotExistError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.DomainNotActiveError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.LimitExceededError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.ServiceBusyError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RecordDecisionTaskStarted_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RecordDecisionTaskStarted_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RecordDecisionTaskStarted_Helper.UnwrapResponse = func(result *HistoryService_RecordDecisionTaskStarted_Result) (success *RecordDecisionTaskStartedResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EventAlreadyStartedError != nil {
			err = result.EventAlreadyStartedError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_RecordDecisionTaskStarted_Result represents the result of a HistoryService.RecordDecisionTaskStarted function call.
//
// The result of a RecordDecisionTaskStarted execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_RecordDecisionTaskStarted_Result struct {
	// Value returned by RecordDecisionTaskStarted after a successful execution.
	Success                                *RecordDecisionTaskStartedResponse             `json:"success,omitempty"`
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EventAlreadyStartedError               *EventAlreadyStartedError                      `json:"eventAlreadyStartedError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RecordDecisionTaskStarted_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RecordDecisionTaskStarted_Result) ToWire() (wire.Value, error) {
	var (
		fields [10]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EventAlreadyStartedError != nil {
		w, err = v.EventAlreadyStartedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 9, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RecordDecisionTaskStarted_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RecordDecisionTaskStarted_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RecordDecisionTaskStarted_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RecordDecisionTaskStarted_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RecordDecisionTaskStarted_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _RecordDecisionTaskStartedResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EventAlreadyStartedError, err = _EventAlreadyStartedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 9:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EventAlreadyStartedError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RecordDecisionTaskStarted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RecordDecisionTaskStarted_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RecordDecisionTaskStarted_Result struct could not be encoded.
func (v *HistoryService_RecordDecisionTaskStarted_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EventAlreadyStartedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EventAlreadyStartedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 9, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EventAlreadyStartedError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_RecordDecisionTaskStarted_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RecordDecisionTaskStarted_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RecordDecisionTaskStarted_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RecordDecisionTaskStarted_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _RecordDecisionTaskStartedResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EventAlreadyStartedError, err = _EventAlreadyStartedError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 9 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EventAlreadyStartedError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RecordDecisionTaskStarted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RecordDecisionTaskStarted_Result
// struct.
func (v *HistoryService_RecordDecisionTaskStarted_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [10]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EventAlreadyStartedError != nil {
		fields[i] = fmt.Sprintf("EventAlreadyStartedError: %v", v.EventAlreadyStartedError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RecordDecisionTaskStarted_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RecordDecisionTaskStarted_Result match the
// provided HistoryService_RecordDecisionTaskStarted_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RecordDecisionTaskStarted_Result) Equals(rhs *HistoryService_RecordDecisionTaskStarted_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EventAlreadyStartedError == nil && rhs.EventAlreadyStartedError == nil) || (v.EventAlreadyStartedError != nil && rhs.EventAlreadyStartedError != nil && v.EventAlreadyStartedError.Equals(rhs.EventAlreadyStartedError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RecordDecisionTaskStarted_Result.
func (v *HistoryService_RecordDecisionTaskStarted_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EventAlreadyStartedError != nil {
		err = multierr.Append(err, enc.AddObject("eventAlreadyStartedError", v.EventAlreadyStartedError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetSuccess() (o *RecordDecisionTaskStartedResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEventAlreadyStartedError returns the value of EventAlreadyStartedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetEventAlreadyStartedError() (o *EventAlreadyStartedError) {
	if v != nil && v.EventAlreadyStartedError != nil {
		return v.EventAlreadyStartedError
	}

	return
}

// IsSetEventAlreadyStartedError returns true if EventAlreadyStartedError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetEventAlreadyStartedError() bool {
	return v != nil && v.EventAlreadyStartedError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RecordDecisionTaskStarted_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RecordDecisionTaskStarted_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RecordDecisionTaskStarted" for this struct.
func (v *HistoryService_RecordDecisionTaskStarted_Result) MethodName() string {
	return "RecordDecisionTaskStarted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RecordDecisionTaskStarted_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RefreshWorkflowTasks_Args represents the arguments for the HistoryService.RefreshWorkflowTasks function.
//
// The arguments for RefreshWorkflowTasks are sent and received over the wire as this struct.
type HistoryService_RefreshWorkflowTasks_Args struct {
	Request *RefreshWorkflowTasksRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_RefreshWorkflowTasks_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RefreshWorkflowTasks_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RefreshWorkflowTasksRequest_1_Read(w wire.Value) (*RefreshWorkflowTasksRequest, error) {
	var v RefreshWorkflowTasksRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RefreshWorkflowTasks_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RefreshWorkflowTasks_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RefreshWorkflowTasks_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RefreshWorkflowTasks_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _RefreshWorkflowTasksRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RefreshWorkflowTasks_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RefreshWorkflowTasks_Args struct could not be encoded.
func (v *HistoryService_RefreshWorkflowTasks_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RefreshWorkflowTasksRequest_1_Decode(sr stream.Reader) (*RefreshWorkflowTasksRequest, error) {
	var v RefreshWorkflowTasksRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RefreshWorkflowTasks_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RefreshWorkflowTasks_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RefreshWorkflowTasks_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _RefreshWorkflowTasksRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RefreshWorkflowTasks_Args
// struct.
func (v *HistoryService_RefreshWorkflowTasks_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_RefreshWorkflowTasks_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RefreshWorkflowTasks_Args match the
// provided HistoryService_RefreshWorkflowTasks_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RefreshWorkflowTasks_Args) Equals(rhs *HistoryService_RefreshWorkflowTasks_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RefreshWorkflowTasks_Args.
func (v *HistoryService_RefreshWorkflowTasks_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Args) GetRequest() (o *RefreshWorkflowTasksRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RefreshWorkflowTasks" for this struct.
func (v *HistoryService_RefreshWorkflowTasks_Args) MethodName() string {
	return "RefreshWorkflowTasks"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RefreshWorkflowTasks_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RefreshWorkflowTasks_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RefreshWorkflowTasks
// function.
var HistoryService_RefreshWorkflowTasks_Helper = struct {
	// Args accepts the parameters of RefreshWorkflowTasks in-order and returns
	// the arguments struct for the function.
	Args func(
		request *RefreshWorkflowTasksRequest,
	) *HistoryService_RefreshWorkflowTasks_Args

	// IsException returns true if the given error can be thrown
	// by RefreshWorkflowTasks.
	//
	// An error can be thrown by RefreshWorkflowTasks only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RefreshWorkflowTasks
	// given the error returned by it. The provided error may
	// be nil if RefreshWorkflowTasks did not fail.
	//
	// This allows mapping errors returned by RefreshWorkflowTasks into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RefreshWorkflowTasks
	//
	//   err := RefreshWorkflowTasks(args)
	//   result, err := HistoryService_RefreshWorkflowTasks_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RefreshWorkflowTasks: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RefreshWorkflowTasks_Result, error)

	// UnwrapResponse takes the result struct for RefreshWorkflowTasks
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RefreshWorkflowTasks threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RefreshWorkflowTasks_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RefreshWorkflowTasks_Result) error
}{}

func init() {
	HistoryService_RefreshWorkflowTasks_Helper.Args = func(
		request *RefreshWorkflowTasksRequest,
	) *HistoryService_RefreshWorkflowTasks_Args {
		return &HistoryService_RefreshWorkflowTasks_Args{
			Request: request,
		}
	}

	HistoryService_RefreshWorkflowTasks_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.EntityNotExistsError:
			return true
		default:
			return false
		}
	}

	HistoryService_RefreshWorkflowTasks_Helper.WrapResponse = func(err error) (*HistoryService_RefreshWorkflowTasks_Result, error) {
		if err == nil {
			return &HistoryService_RefreshWorkflowTasks_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RefreshWorkflowTasks_Result.BadRequestError")
			}
			return &HistoryService_RefreshWorkflowTasks_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RefreshWorkflowTasks_Result.InternalServiceError")
			}
			return &HistoryService_RefreshWorkflowTasks_Result{InternalServiceError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RefreshWorkflowTasks_Result.DomainNotActiveError")
			}
			return &HistoryService_RefreshWorkflowTasks_Result{DomainNotActiveError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RefreshWorkflowTasks_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RefreshWorkflowTasks_Result{ShardOwnershipLostError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RefreshWorkflowTasks_Result.ServiceBusyError")
			}
			return &HistoryService_RefreshWorkflowTasks_Result{ServiceBusyError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RefreshWorkflowTasks_Result.EntityNotExistError")
			}
			return &HistoryService_RefreshWorkflowTasks_Result{EntityNotExistError: e}, nil
		}

		return nil, err
	}
	HistoryService_RefreshWorkflowTasks_Helper.UnwrapResponse = func(result *HistoryService_RefreshWorkflowTasks_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		return
	}

}

// HistoryService_RefreshWorkflowTasks_Result represents the result of a HistoryService.RefreshWorkflowTasks function call.
//
// The result of a RefreshWorkflowTasks execution is sent and received over the wire as this struct.
type HistoryService_RefreshWorkflowTasks_Result struct {
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	DomainNotActiveError    *shared.DomainNotActiveError `json:"domainNotActiveError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"`
}

// ToWire translates a HistoryService_RefreshWorkflowTasks_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RefreshWorkflowTasks_Result) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RefreshWorkflowTasks_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RefreshWorkflowTasks_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RefreshWorkflowTasks_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RefreshWorkflowTasks_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RefreshWorkflowTasks_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RefreshWorkflowTasks_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RefreshWorkflowTasks_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RefreshWorkflowTasks_Result struct could not be encoded.
func (v *HistoryService_RefreshWorkflowTasks_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RefreshWorkflowTasks_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RefreshWorkflowTasks_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RefreshWorkflowTasks_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RefreshWorkflowTasks_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RefreshWorkflowTasks_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RefreshWorkflowTasks_Result
// struct.
func (v *HistoryService_RefreshWorkflowTasks_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}

	return fmt.Sprintf("HistoryService_RefreshWorkflowTasks_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RefreshWorkflowTasks_Result match the
// provided HistoryService_RefreshWorkflowTasks_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RefreshWorkflowTasks_Result) Equals(rhs *HistoryService_RefreshWorkflowTasks_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RefreshWorkflowTasks_Result.
func (v *HistoryService_RefreshWorkflowTasks_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RefreshWorkflowTasks_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RefreshWorkflowTasks_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RefreshWorkflowTasks" for this struct.
func (v *HistoryService_RefreshWorkflowTasks_Result) MethodName() string {
	return "RefreshWorkflowTasks"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RefreshWorkflowTasks_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RemoveSignalMutableState_Args represents the arguments for the HistoryService.RemoveSignalMutableState function.
//
// The arguments for RemoveSignalMutableState are sent and received over the wire as this struct.
type HistoryService_RemoveSignalMutableState_Args struct {
	RemoveRequest *RemoveSignalMutableStateRequest `json:"removeRequest,omitempty"`
}

// ToWire translates a HistoryService_RemoveSignalMutableState_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RemoveSignalMutableState_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.RemoveRequest != nil {
		w, err = v.RemoveRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RemoveSignalMutableStateRequest_Read(w wire.Value) (*RemoveSignalMutableStateRequest, error) {
	var v RemoveSignalMutableStateRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RemoveSignalMutableState_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RemoveSignalMutableState_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RemoveSignalMutableState_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RemoveSignalMutableState_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.RemoveRequest, err = _RemoveSignalMutableStateRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RemoveSignalMutableState_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RemoveSignalMutableState_Args struct could not be encoded.
func (v *HistoryService_RemoveSignalMutableState_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.RemoveRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.RemoveRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RemoveSignalMutableStateRequest_Decode(sr stream.Reader) (*RemoveSignalMutableStateRequest, error) {
	var v RemoveSignalMutableStateRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RemoveSignalMutableState_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RemoveSignalMutableState_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RemoveSignalMutableState_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.RemoveRequest, err = _RemoveSignalMutableStateRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RemoveSignalMutableState_Args
// struct.
func (v *HistoryService_RemoveSignalMutableState_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.RemoveRequest != nil {
		fields[i] = fmt.Sprintf("RemoveRequest: %v", v.RemoveRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RemoveSignalMutableState_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RemoveSignalMutableState_Args match the
// provided HistoryService_RemoveSignalMutableState_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RemoveSignalMutableState_Args) Equals(rhs *HistoryService_RemoveSignalMutableState_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.RemoveRequest == nil && rhs.RemoveRequest == nil) || (v.RemoveRequest != nil && rhs.RemoveRequest != nil && v.RemoveRequest.Equals(rhs.RemoveRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RemoveSignalMutableState_Args.
func (v *HistoryService_RemoveSignalMutableState_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.RemoveRequest != nil {
		err = multierr.Append(err, enc.AddObject("removeRequest", v.RemoveRequest))
	}
	return err
}

// GetRemoveRequest returns the value of RemoveRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Args) GetRemoveRequest() (o *RemoveSignalMutableStateRequest) {
	if v != nil && v.RemoveRequest != nil {
		return v.RemoveRequest
	}

	return
}

// IsSetRemoveRequest returns true if RemoveRequest is not nil.
func (v *HistoryService_RemoveSignalMutableState_Args) IsSetRemoveRequest() bool {
	return v != nil && v.RemoveRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RemoveSignalMutableState" for this struct.
func (v *HistoryService_RemoveSignalMutableState_Args) MethodName() string {
	return "RemoveSignalMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RemoveSignalMutableState_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RemoveSignalMutableState_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RemoveSignalMutableState
// function.
var HistoryService_RemoveSignalMutableState_Helper = struct {
	// Args accepts the parameters of RemoveSignalMutableState in-order and returns
	// the arguments struct for the function.
	Args func(
		removeRequest *RemoveSignalMutableStateRequest,
	) *HistoryService_RemoveSignalMutableState_Args

	// IsException returns true if the given error can be thrown
	// by RemoveSignalMutableState.
	//
	// An error can be thrown by RemoveSignalMutableState only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RemoveSignalMutableState
	// given the error returned by it. The provided error may
	// be nil if RemoveSignalMutableState did not fail.
	//
	// This allows mapping errors returned by RemoveSignalMutableState into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RemoveSignalMutableState
	//
	//   err := RemoveSignalMutableState(args)
	//   result, err := HistoryService_RemoveSignalMutableState_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RemoveSignalMutableState: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RemoveSignalMutableState_Result, error)

	// UnwrapResponse takes the result struct for RemoveSignalMutableState
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RemoveSignalMutableState threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RemoveSignalMutableState_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RemoveSignalMutableState_Result) error
}{}

func init() {
	HistoryService_RemoveSignalMutableState_Helper.Args = func(
		removeRequest *RemoveSignalMutableStateRequest,
	) *HistoryService_RemoveSignalMutableState_Args {
		return &HistoryService_RemoveSignalMutableState_Args{
			RemoveRequest: removeRequest,
		}
	}

	HistoryService_RemoveSignalMutableState_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RemoveSignalMutableState_Helper.WrapResponse = func(err error) (*HistoryService_RemoveSignalMutableState_Result, error) {
		if err == nil {
			return &HistoryService_RemoveSignalMutableState_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.BadRequestError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.InternalServiceError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.EntityNotExistError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.DomainNotActiveError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.LimitExceededError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.ServiceBusyError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveSignalMutableState_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RemoveSignalMutableState_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RemoveSignalMutableState_Helper.UnwrapResponse = func(result *HistoryService_RemoveSignalMutableState_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RemoveSignalMutableState_Result represents the result of a HistoryService.RemoveSignalMutableState function call.
//
// The result of a RemoveSignalMutableState execution is sent and received over the wire as this struct.
type HistoryService_RemoveSignalMutableState_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RemoveSignalMutableState_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RemoveSignalMutableState_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RemoveSignalMutableState_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RemoveSignalMutableState_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RemoveSignalMutableState_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RemoveSignalMutableState_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RemoveSignalMutableState_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RemoveSignalMutableState_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RemoveSignalMutableState_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RemoveSignalMutableState_Result struct could not be encoded.
func (v *HistoryService_RemoveSignalMutableState_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RemoveSignalMutableState_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RemoveSignalMutableState_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RemoveSignalMutableState_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RemoveSignalMutableState_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RemoveSignalMutableState_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RemoveSignalMutableState_Result
// struct.
func (v *HistoryService_RemoveSignalMutableState_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RemoveSignalMutableState_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RemoveSignalMutableState_Result match the
// provided HistoryService_RemoveSignalMutableState_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RemoveSignalMutableState_Result) Equals(rhs *HistoryService_RemoveSignalMutableState_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RemoveSignalMutableState_Result.
func (v *HistoryService_RemoveSignalMutableState_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveSignalMutableState_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RemoveSignalMutableState_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RemoveSignalMutableState" for this struct.
func (v *HistoryService_RemoveSignalMutableState_Result) MethodName() string {
	return "RemoveSignalMutableState"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RemoveSignalMutableState_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RemoveTask_Args represents the arguments for the HistoryService.RemoveTask function.
//
// The arguments for RemoveTask are sent and received over the wire as this struct.
type HistoryService_RemoveTask_Args struct {
	Request *shared.RemoveTaskRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_RemoveTask_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RemoveTask_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RemoveTaskRequest_Read(w wire.Value) (*shared.RemoveTaskRequest, error) {
	var v shared.RemoveTaskRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RemoveTask_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RemoveTask_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RemoveTask_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RemoveTask_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _RemoveTaskRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RemoveTask_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RemoveTask_Args struct could not be encoded.
func (v *HistoryService_RemoveTask_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RemoveTaskRequest_Decode(sr stream.Reader) (*shared.RemoveTaskRequest, error) {
	var v shared.RemoveTaskRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RemoveTask_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RemoveTask_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RemoveTask_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _RemoveTaskRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RemoveTask_Args
// struct.
func (v *HistoryService_RemoveTask_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_RemoveTask_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RemoveTask_Args match the
// provided HistoryService_RemoveTask_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RemoveTask_Args) Equals(rhs *HistoryService_RemoveTask_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RemoveTask_Args.
func (v *HistoryService_RemoveTask_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveTask_Args) GetRequest() (o *shared.RemoveTaskRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_RemoveTask_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RemoveTask" for this struct.
func (v *HistoryService_RemoveTask_Args) MethodName() string {
	return "RemoveTask"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RemoveTask_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RemoveTask_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RemoveTask
// function.
var HistoryService_RemoveTask_Helper = struct {
	// Args accepts the parameters of RemoveTask in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.RemoveTaskRequest,
	) *HistoryService_RemoveTask_Args

	// IsException returns true if the given error can be thrown
	// by RemoveTask.
	//
	// An error can be thrown by RemoveTask only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RemoveTask
	// given the error returned by it. The provided error may
	// be nil if RemoveTask did not fail.
	//
	// This allows mapping errors returned by RemoveTask into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RemoveTask
	//
	//   err := RemoveTask(args)
	//   result, err := HistoryService_RemoveTask_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RemoveTask: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RemoveTask_Result, error)

	// UnwrapResponse takes the result struct for RemoveTask
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RemoveTask threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RemoveTask_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RemoveTask_Result) error
}{}

func init() {
	HistoryService_RemoveTask_Helper.Args = func(
		request *shared.RemoveTaskRequest,
	) *HistoryService_RemoveTask_Args {
		return &HistoryService_RemoveTask_Args{
			Request: request,
		}
	}

	HistoryService_RemoveTask_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.AccessDeniedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RemoveTask_Helper.WrapResponse = func(err error) (*HistoryService_RemoveTask_Result, error) {
		if err == nil {
			return &HistoryService_RemoveTask_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveTask_Result.BadRequestError")
			}
			return &HistoryService_RemoveTask_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveTask_Result.InternalServiceError")
			}
			return &HistoryService_RemoveTask_Result{InternalServiceError: e}, nil
		case *shared.AccessDeniedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RemoveTask_Result.AccessDeniedError")
			}
			return &HistoryService_RemoveTask_Result{AccessDeniedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RemoveTask_Helper.UnwrapResponse = func(result *HistoryService_RemoveTask_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.AccessDeniedError != nil {
			err = result.AccessDeniedError
			return
		}
		return
	}

}

// HistoryService_RemoveTask_Result represents the result of a HistoryService.RemoveTask function call.
//
// The result of a RemoveTask execution is sent and received over the wire as this struct.
type HistoryService_RemoveTask_Result struct {
	BadRequestError      *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	AccessDeniedError    *shared.AccessDeniedError    `json:"accessDeniedError,omitempty"`
}

// ToWire translates a HistoryService_RemoveTask_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RemoveTask_Result) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.AccessDeniedError != nil {
		w, err = v.AccessDeniedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RemoveTask_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RemoveTask_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RemoveTask_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RemoveTask_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RemoveTask_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.AccessDeniedError, err = _AccessDeniedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RemoveTask_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RemoveTask_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RemoveTask_Result struct could not be encoded.
func (v *HistoryService_RemoveTask_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AccessDeniedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AccessDeniedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RemoveTask_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RemoveTask_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RemoveTask_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RemoveTask_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.AccessDeniedError, err = _AccessDeniedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RemoveTask_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RemoveTask_Result
// struct.
func (v *HistoryService_RemoveTask_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.AccessDeniedError != nil {
		fields[i] = fmt.Sprintf("AccessDeniedError: %v", v.AccessDeniedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RemoveTask_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RemoveTask_Result match the
// provided HistoryService_RemoveTask_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RemoveTask_Result) Equals(rhs *HistoryService_RemoveTask_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.AccessDeniedError == nil && rhs.AccessDeniedError == nil) || (v.AccessDeniedError != nil && rhs.AccessDeniedError != nil && v.AccessDeniedError.Equals(rhs.AccessDeniedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RemoveTask_Result.
func (v *HistoryService_RemoveTask_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.AccessDeniedError != nil {
		err = multierr.Append(err, enc.AddObject("accessDeniedError", v.AccessDeniedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveTask_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RemoveTask_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveTask_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RemoveTask_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetAccessDeniedError returns the value of AccessDeniedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RemoveTask_Result) GetAccessDeniedError() (o *shared.AccessDeniedError) {
	if v != nil && v.AccessDeniedError != nil {
		return v.AccessDeniedError
	}

	return
}

// IsSetAccessDeniedError returns true if AccessDeniedError is not nil.
func (v *HistoryService_RemoveTask_Result) IsSetAccessDeniedError() bool {
	return v != nil && v.AccessDeniedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RemoveTask" for this struct.
func (v *HistoryService_RemoveTask_Result) MethodName() string {
	return "RemoveTask"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RemoveTask_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ReplicateEventsV2_Args represents the arguments for the HistoryService.ReplicateEventsV2 function.
//
// The arguments for ReplicateEventsV2 are sent and received over the wire as this struct.
type HistoryService_ReplicateEventsV2_Args struct {
	ReplicateV2Request *ReplicateEventsV2Request `json:"replicateV2Request,omitempty"`
}

// ToWire translates a HistoryService_ReplicateEventsV2_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ReplicateEventsV2_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ReplicateV2Request != nil {
		w, err = v.ReplicateV2Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ReplicateEventsV2Request_Read(w wire.Value) (*ReplicateEventsV2Request, error) {
	var v ReplicateEventsV2Request
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ReplicateEventsV2_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ReplicateEventsV2_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ReplicateEventsV2_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ReplicateEventsV2_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.ReplicateV2Request, err = _ReplicateEventsV2Request_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ReplicateEventsV2_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ReplicateEventsV2_Args struct could not be encoded.
func (v *HistoryService_ReplicateEventsV2_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ReplicateV2Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ReplicateV2Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ReplicateEventsV2Request_Decode(sr stream.Reader) (*ReplicateEventsV2Request, error) {
	var v ReplicateEventsV2Request
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ReplicateEventsV2_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ReplicateEventsV2_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ReplicateEventsV2_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.ReplicateV2Request, err = _ReplicateEventsV2Request_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ReplicateEventsV2_Args
// struct.
func (v *HistoryService_ReplicateEventsV2_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.ReplicateV2Request != nil {
		fields[i] = fmt.Sprintf("ReplicateV2Request: %v", v.ReplicateV2Request)
		i++
	}

	return fmt.Sprintf("HistoryService_ReplicateEventsV2_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ReplicateEventsV2_Args match the
// provided HistoryService_ReplicateEventsV2_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ReplicateEventsV2_Args) Equals(rhs *HistoryService_ReplicateEventsV2_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ReplicateV2Request == nil && rhs.ReplicateV2Request == nil) || (v.ReplicateV2Request != nil && rhs.ReplicateV2Request != nil && v.ReplicateV2Request.Equals(rhs.ReplicateV2Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ReplicateEventsV2_Args.
func (v *HistoryService_ReplicateEventsV2_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ReplicateV2Request != nil {
		err = multierr.Append(err, enc.AddObject("replicateV2Request", v.ReplicateV2Request))
	}
	return err
}

// GetReplicateV2Request returns the value of ReplicateV2Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Args) GetReplicateV2Request() (o *ReplicateEventsV2Request) {
	if v != nil && v.ReplicateV2Request != nil {
		return v.ReplicateV2Request
	}

	return
}

// IsSetReplicateV2Request returns true if ReplicateV2Request is not nil.
func (v *HistoryService_ReplicateEventsV2_Args) IsSetReplicateV2Request() bool {
	return v != nil && v.ReplicateV2Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ReplicateEventsV2" for this struct.
func (v *HistoryService_ReplicateEventsV2_Args) MethodName() string {
	return "ReplicateEventsV2"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ReplicateEventsV2_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ReplicateEventsV2_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ReplicateEventsV2
// function.
var HistoryService_ReplicateEventsV2_Helper = struct {
	// Args accepts the parameters of ReplicateEventsV2 in-order and returns
	// the arguments struct for the function.
	Args func(
		replicateV2Request *ReplicateEventsV2Request,
	) *HistoryService_ReplicateEventsV2_Args

	// IsException returns true if the given error can be thrown
	// by ReplicateEventsV2.
	//
	// An error can be thrown by ReplicateEventsV2 only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ReplicateEventsV2
	// given the error returned by it. The provided error may
	// be nil if ReplicateEventsV2 did not fail.
	//
	// This allows mapping errors returned by ReplicateEventsV2 into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// ReplicateEventsV2
	//
	//   err := ReplicateEventsV2(args)
	//   result, err := HistoryService_ReplicateEventsV2_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ReplicateEventsV2: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_ReplicateEventsV2_Result, error)

	// UnwrapResponse takes the result struct for ReplicateEventsV2
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if ReplicateEventsV2 threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_ReplicateEventsV2_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ReplicateEventsV2_Result) error
}{}

func init() {
	HistoryService_ReplicateEventsV2_Helper.Args = func(
		replicateV2Request *ReplicateEventsV2Request,
	) *HistoryService_ReplicateEventsV2_Args {
		return &HistoryService_ReplicateEventsV2_Args{
			ReplicateV2Request: replicateV2Request,
		}
	}

	HistoryService_ReplicateEventsV2_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.RetryTaskV2Error:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_ReplicateEventsV2_Helper.WrapResponse = func(err error) (*HistoryService_ReplicateEventsV2_Result, error) {
		if err == nil {
			return &HistoryService_ReplicateEventsV2_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.BadRequestError")
			}
			return &HistoryService_ReplicateEventsV2_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.InternalServiceError")
			}
			return &HistoryService_ReplicateEventsV2_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.EntityNotExistError")
			}
			return &HistoryService_ReplicateEventsV2_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.ShardOwnershipLostError")
			}
			return &HistoryService_ReplicateEventsV2_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.LimitExceededError")
			}
			return &HistoryService_ReplicateEventsV2_Result{LimitExceededError: e}, nil
		case *shared.RetryTaskV2Error:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.RetryTaskError")
			}
			return &HistoryService_ReplicateEventsV2_Result{RetryTaskError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ReplicateEventsV2_Result.ServiceBusyError")
			}
			return &HistoryService_ReplicateEventsV2_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_ReplicateEventsV2_Helper.UnwrapResponse = func(result *HistoryService_ReplicateEventsV2_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.RetryTaskError != nil {
			err = result.RetryTaskError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		return
	}

}

// HistoryService_ReplicateEventsV2_Result represents the result of a HistoryService.ReplicateEventsV2 function call.
//
// The result of a ReplicateEventsV2 execution is sent and received over the wire as this struct.
type HistoryService_ReplicateEventsV2_Result struct {
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError      *shared.LimitExceededError   `json:"limitExceededError,omitempty"`
	RetryTaskError          *shared.RetryTaskV2Error     `json:"retryTaskError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_ReplicateEventsV2_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ReplicateEventsV2_Result) ToWire() (wire.Value, error) {
	var (
		fields [7]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.RetryTaskError != nil {
		w, err = v.RetryTaskError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ReplicateEventsV2_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RetryTaskV2Error_Read(w wire.Value) (*shared.RetryTaskV2Error, error) {
	var v shared.RetryTaskV2Error
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ReplicateEventsV2_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ReplicateEventsV2_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ReplicateEventsV2_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ReplicateEventsV2_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.RetryTaskError, err = _RetryTaskV2Error_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.RetryTaskError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ReplicateEventsV2_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ReplicateEventsV2_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ReplicateEventsV2_Result struct could not be encoded.
func (v *HistoryService_ReplicateEventsV2_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.RetryTaskError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.RetryTaskError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.RetryTaskError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_ReplicateEventsV2_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _RetryTaskV2Error_Decode(sr stream.Reader) (*shared.RetryTaskV2Error, error) {
	var v shared.RetryTaskV2Error
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ReplicateEventsV2_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ReplicateEventsV2_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ReplicateEventsV2_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.RetryTaskError, err = _RetryTaskV2Error_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.RetryTaskError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ReplicateEventsV2_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ReplicateEventsV2_Result
// struct.
func (v *HistoryService_ReplicateEventsV2_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [7]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.RetryTaskError != nil {
		fields[i] = fmt.Sprintf("RetryTaskError: %v", v.RetryTaskError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_ReplicateEventsV2_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ReplicateEventsV2_Result match the
// provided HistoryService_ReplicateEventsV2_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ReplicateEventsV2_Result) Equals(rhs *HistoryService_ReplicateEventsV2_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.RetryTaskError == nil && rhs.RetryTaskError == nil) || (v.RetryTaskError != nil && rhs.RetryTaskError != nil && v.RetryTaskError.Equals(rhs.RetryTaskError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ReplicateEventsV2_Result.
func (v *HistoryService_ReplicateEventsV2_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.RetryTaskError != nil {
		err = multierr.Append(err, enc.AddObject("retryTaskError", v.RetryTaskError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetRetryTaskError returns the value of RetryTaskError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetRetryTaskError() (o *shared.RetryTaskV2Error) {
	if v != nil && v.RetryTaskError != nil {
		return v.RetryTaskError
	}

	return
}

// IsSetRetryTaskError returns true if RetryTaskError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetRetryTaskError() bool {
	return v != nil && v.RetryTaskError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ReplicateEventsV2_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_ReplicateEventsV2_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ReplicateEventsV2" for this struct.
func (v *HistoryService_ReplicateEventsV2_Result) MethodName() string {
	return "ReplicateEventsV2"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ReplicateEventsV2_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RequestCancelWorkflowExecution_Args represents the arguments for the HistoryService.RequestCancelWorkflowExecution function.
//
// The arguments for RequestCancelWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_RequestCancelWorkflowExecution_Args struct {
	CancelRequest *RequestCancelWorkflowExecutionRequest `json:"cancelRequest,omitempty"`
}

// ToWire translates a HistoryService_RequestCancelWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RequestCancelWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.CancelRequest != nil {
		w, err = v.CancelRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RequestCancelWorkflowExecutionRequest_1_Read(w wire.Value) (*RequestCancelWorkflowExecutionRequest, error) {
	var v RequestCancelWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RequestCancelWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RequestCancelWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RequestCancelWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RequestCancelWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.CancelRequest, err = _RequestCancelWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RequestCancelWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RequestCancelWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.CancelRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CancelRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RequestCancelWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*RequestCancelWorkflowExecutionRequest, error) {
	var v RequestCancelWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RequestCancelWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RequestCancelWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.CancelRequest, err = _RequestCancelWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RequestCancelWorkflowExecution_Args
// struct.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.CancelRequest != nil {
		fields[i] = fmt.Sprintf("CancelRequest: %v", v.CancelRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RequestCancelWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RequestCancelWorkflowExecution_Args match the
// provided HistoryService_RequestCancelWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) Equals(rhs *HistoryService_RequestCancelWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.CancelRequest == nil && rhs.CancelRequest == nil) || (v.CancelRequest != nil && rhs.CancelRequest != nil && v.CancelRequest.Equals(rhs.CancelRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RequestCancelWorkflowExecution_Args.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.CancelRequest != nil {
		err = multierr.Append(err, enc.AddObject("cancelRequest", v.CancelRequest))
	}
	return err
}

// GetCancelRequest returns the value of CancelRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) GetCancelRequest() (o *RequestCancelWorkflowExecutionRequest) {
	if v != nil && v.CancelRequest != nil {
		return v.CancelRequest
	}

	return
}

// IsSetCancelRequest returns true if CancelRequest is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) IsSetCancelRequest() bool {
	return v != nil && v.CancelRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RequestCancelWorkflowExecution" for this struct.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) MethodName() string {
	return "RequestCancelWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RequestCancelWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RequestCancelWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RequestCancelWorkflowExecution
// function.
var HistoryService_RequestCancelWorkflowExecution_Helper = struct {
	// Args accepts the parameters of RequestCancelWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		cancelRequest *RequestCancelWorkflowExecutionRequest,
	) *HistoryService_RequestCancelWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by RequestCancelWorkflowExecution.
	//
	// An error can be thrown by RequestCancelWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RequestCancelWorkflowExecution
	// given the error returned by it. The provided error may
	// be nil if RequestCancelWorkflowExecution did not fail.
	//
	// This allows mapping errors returned by RequestCancelWorkflowExecution into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RequestCancelWorkflowExecution
	//
	//   err := RequestCancelWorkflowExecution(args)
	//   result, err := HistoryService_RequestCancelWorkflowExecution_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RequestCancelWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RequestCancelWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for RequestCancelWorkflowExecution
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RequestCancelWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RequestCancelWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RequestCancelWorkflowExecution_Result) error
}{}

func init() {
	HistoryService_RequestCancelWorkflowExecution_Helper.Args = func(
		cancelRequest *RequestCancelWorkflowExecutionRequest,
	) *HistoryService_RequestCancelWorkflowExecution_Args {
		return &HistoryService_RequestCancelWorkflowExecution_Args{
			CancelRequest: cancelRequest,
		}
	}

	HistoryService_RequestCancelWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.CancellationAlreadyRequestedError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RequestCancelWorkflowExecution_Helper.WrapResponse = func(err error) (*HistoryService_RequestCancelWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_RequestCancelWorkflowExecution_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.EntityNotExistError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.CancellationAlreadyRequestedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.CancellationAlreadyRequestedError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{CancellationAlreadyRequestedError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.DomainNotActiveError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RequestCancelWorkflowExecution_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RequestCancelWorkflowExecution_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RequestCancelWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_RequestCancelWorkflowExecution_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.CancellationAlreadyRequestedError != nil {
			err = result.CancellationAlreadyRequestedError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RequestCancelWorkflowExecution_Result represents the result of a HistoryService.RequestCancelWorkflowExecution function call.
//
// The result of a RequestCancelWorkflowExecution execution is sent and received over the wire as this struct.
type HistoryService_RequestCancelWorkflowExecution_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	CancellationAlreadyRequestedError      *shared.CancellationAlreadyRequestedError      `json:"cancellationAlreadyRequestedError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RequestCancelWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RequestCancelWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [9]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.CancellationAlreadyRequestedError != nil {
		w, err = v.CancellationAlreadyRequestedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RequestCancelWorkflowExecution_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _CancellationAlreadyRequestedError_Read(w wire.Value) (*shared.CancellationAlreadyRequestedError, error) {
	var v shared.CancellationAlreadyRequestedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RequestCancelWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RequestCancelWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RequestCancelWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RequestCancelWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.CancellationAlreadyRequestedError, err = _CancellationAlreadyRequestedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 10:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.CancellationAlreadyRequestedError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RequestCancelWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RequestCancelWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RequestCancelWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.CancellationAlreadyRequestedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CancellationAlreadyRequestedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.CancellationAlreadyRequestedError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RequestCancelWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _CancellationAlreadyRequestedError_Decode(sr stream.Reader) (*shared.CancellationAlreadyRequestedError, error) {
	var v shared.CancellationAlreadyRequestedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RequestCancelWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RequestCancelWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.CancellationAlreadyRequestedError, err = _CancellationAlreadyRequestedError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 10 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.CancellationAlreadyRequestedError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RequestCancelWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RequestCancelWorkflowExecution_Result
// struct.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [9]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.CancellationAlreadyRequestedError != nil {
		fields[i] = fmt.Sprintf("CancellationAlreadyRequestedError: %v", v.CancellationAlreadyRequestedError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RequestCancelWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RequestCancelWorkflowExecution_Result match the
// provided HistoryService_RequestCancelWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) Equals(rhs *HistoryService_RequestCancelWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.CancellationAlreadyRequestedError == nil && rhs.CancellationAlreadyRequestedError == nil) || (v.CancellationAlreadyRequestedError != nil && rhs.CancellationAlreadyRequestedError != nil && v.CancellationAlreadyRequestedError.Equals(rhs.CancellationAlreadyRequestedError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RequestCancelWorkflowExecution_Result.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.CancellationAlreadyRequestedError != nil {
		err = multierr.Append(err, enc.AddObject("cancellationAlreadyRequestedError", v.CancellationAlreadyRequestedError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetCancellationAlreadyRequestedError returns the value of CancellationAlreadyRequestedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetCancellationAlreadyRequestedError() (o *shared.CancellationAlreadyRequestedError) {
	if v != nil && v.CancellationAlreadyRequestedError != nil {
		return v.CancellationAlreadyRequestedError
	}

	return
}

// IsSetCancellationAlreadyRequestedError returns true if CancellationAlreadyRequestedError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetCancellationAlreadyRequestedError() bool {
	return v != nil && v.CancellationAlreadyRequestedError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RequestCancelWorkflowExecution" for this struct.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) MethodName() string {
	return "RequestCancelWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RequestCancelWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ResetQueue_Args represents the arguments for the HistoryService.ResetQueue function.
//
// The arguments for ResetQueue are sent and received over the wire as this struct.
type HistoryService_ResetQueue_Args struct {
	Request *shared.ResetQueueRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_ResetQueue_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ResetQueue_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ResetQueueRequest_Read(w wire.Value) (*shared.ResetQueueRequest, error) {
	var v shared.ResetQueueRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ResetQueue_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ResetQueue_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ResetQueue_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ResetQueue_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _ResetQueueRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ResetQueue_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ResetQueue_Args struct could not be encoded.
func (v *HistoryService_ResetQueue_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ResetQueueRequest_Decode(sr stream.Reader) (*shared.ResetQueueRequest, error) {
	var v shared.ResetQueueRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ResetQueue_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ResetQueue_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ResetQueue_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _ResetQueueRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ResetQueue_Args
// struct.
func (v *HistoryService_ResetQueue_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_ResetQueue_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ResetQueue_Args match the
// provided HistoryService_ResetQueue_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ResetQueue_Args) Equals(rhs *HistoryService_ResetQueue_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ResetQueue_Args.
func (v *HistoryService_ResetQueue_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetQueue_Args) GetRequest() (o *shared.ResetQueueRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_ResetQueue_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ResetQueue" for this struct.
func (v *HistoryService_ResetQueue_Args) MethodName() string {
	return "ResetQueue"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ResetQueue_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ResetQueue_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ResetQueue
// function.
var HistoryService_ResetQueue_Helper = struct {
	// Args accepts the parameters of ResetQueue in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.ResetQueueRequest,
	) *HistoryService_ResetQueue_Args

	// IsException returns true if the given error can be thrown
	// by ResetQueue.
	//
	// An error can be thrown by ResetQueue only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ResetQueue
	// given the error returned by it. The provided error may
	// be nil if ResetQueue did not fail.
	//
	// This allows mapping errors returned by ResetQueue into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// ResetQueue
	//
	//   err := ResetQueue(args)
	//   result, err := HistoryService_ResetQueue_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ResetQueue: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_ResetQueue_Result, error)

	// UnwrapResponse takes the result struct for ResetQueue
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if ResetQueue threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_ResetQueue_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ResetQueue_Result) error
}{}

func init() {
	HistoryService_ResetQueue_Helper.Args = func(
		request *shared.ResetQueueRequest,
	) *HistoryService_ResetQueue_Args {
		return &HistoryService_ResetQueue_Args{
			Request: request,
		}
	}

	HistoryService_ResetQueue_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.AccessDeniedError:
			return true
		default:
			return false
		}
	}

	HistoryService_ResetQueue_Helper.WrapResponse = func(err error) (*HistoryService_ResetQueue_Result, error) {
		if err == nil {
			return &HistoryService_ResetQueue_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetQueue_Result.BadRequestError")
			}
			return &HistoryService_ResetQueue_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetQueue_Result.InternalServiceError")
			}
			return &HistoryService_ResetQueue_Result{InternalServiceError: e}, nil
		case *shared.AccessDeniedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetQueue_Result.AccessDeniedError")
			}
			return &HistoryService_ResetQueue_Result{AccessDeniedError: e}, nil
		}

		return nil, err
	}
	HistoryService_ResetQueue_Helper.UnwrapResponse = func(result *HistoryService_ResetQueue_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.AccessDeniedError != nil {
			err = result.AccessDeniedError
			return
		}
		return
	}

}

// HistoryService_ResetQueue_Result represents the result of a HistoryService.ResetQueue function call.
//
// The result of a ResetQueue execution is sent and received over the wire as this struct.
type HistoryService_ResetQueue_Result struct {
	BadRequestError      *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	AccessDeniedError    *shared.AccessDeniedError    `json:"accessDeniedError,omitempty"`
}

// ToWire translates a HistoryService_ResetQueue_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ResetQueue_Result) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.AccessDeniedError != nil {
		w, err = v.AccessDeniedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ResetQueue_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_ResetQueue_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ResetQueue_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ResetQueue_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ResetQueue_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.AccessDeniedError, err = _AccessDeniedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ResetQueue_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ResetQueue_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ResetQueue_Result struct could not be encoded.
func (v *HistoryService_ResetQueue_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.AccessDeniedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.AccessDeniedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_ResetQueue_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_ResetQueue_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ResetQueue_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ResetQueue_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.AccessDeniedError, err = _AccessDeniedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.AccessDeniedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ResetQueue_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ResetQueue_Result
// struct.
func (v *HistoryService_ResetQueue_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [3]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.AccessDeniedError != nil {
		fields[i] = fmt.Sprintf("AccessDeniedError: %v", v.AccessDeniedError)
		i++
	}

	return fmt.Sprintf("HistoryService_ResetQueue_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ResetQueue_Result match the
// provided HistoryService_ResetQueue_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ResetQueue_Result) Equals(rhs *HistoryService_ResetQueue_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.AccessDeniedError == nil && rhs.AccessDeniedError == nil) || (v.AccessDeniedError != nil && rhs.AccessDeniedError != nil && v.AccessDeniedError.Equals(rhs.AccessDeniedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ResetQueue_Result.
func (v *HistoryService_ResetQueue_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.AccessDeniedError != nil {
		err = multierr.Append(err, enc.AddObject("accessDeniedError", v.AccessDeniedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetQueue_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ResetQueue_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetQueue_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ResetQueue_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetAccessDeniedError returns the value of AccessDeniedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetQueue_Result) GetAccessDeniedError() (o *shared.AccessDeniedError) {
	if v != nil && v.AccessDeniedError != nil {
		return v.AccessDeniedError
	}

	return
}

// IsSetAccessDeniedError returns true if AccessDeniedError is not nil.
func (v *HistoryService_ResetQueue_Result) IsSetAccessDeniedError() bool {
	return v != nil && v.AccessDeniedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ResetQueue" for this struct.
func (v *HistoryService_ResetQueue_Result) MethodName() string {
	return "ResetQueue"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ResetQueue_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ResetStickyTaskList_Args represents the arguments for the HistoryService.ResetStickyTaskList function.
//
// The arguments for ResetStickyTaskList are sent and received over the wire as this struct.
type HistoryService_ResetStickyTaskList_Args struct {
	ResetRequest *ResetStickyTaskListRequest `json:"resetRequest,omitempty"`
}

// ToWire translates a HistoryService_ResetStickyTaskList_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ResetStickyTaskList_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ResetRequest != nil {
		w, err = v.ResetRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ResetStickyTaskListRequest_Read(w wire.Value) (*ResetStickyTaskListRequest, error) {
	var v ResetStickyTaskListRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ResetStickyTaskList_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ResetStickyTaskList_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ResetStickyTaskList_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ResetStickyTaskList_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.ResetRequest, err = _ResetStickyTaskListRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ResetStickyTaskList_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ResetStickyTaskList_Args struct could not be encoded.
func (v *HistoryService_ResetStickyTaskList_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ResetRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ResetRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ResetStickyTaskListRequest_Decode(sr stream.Reader) (*ResetStickyTaskListRequest, error) {
	var v ResetStickyTaskListRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ResetStickyTaskList_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ResetStickyTaskList_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ResetStickyTaskList_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.ResetRequest, err = _ResetStickyTaskListRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ResetStickyTaskList_Args
// struct.
func (v *HistoryService_ResetStickyTaskList_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.ResetRequest != nil {
		fields[i] = fmt.Sprintf("ResetRequest: %v", v.ResetRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_ResetStickyTaskList_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ResetStickyTaskList_Args match the
// provided HistoryService_ResetStickyTaskList_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ResetStickyTaskList_Args) Equals(rhs *HistoryService_ResetStickyTaskList_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ResetRequest == nil && rhs.ResetRequest == nil) || (v.ResetRequest != nil && rhs.ResetRequest != nil && v.ResetRequest.Equals(rhs.ResetRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ResetStickyTaskList_Args.
func (v *HistoryService_ResetStickyTaskList_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ResetRequest != nil {
		err = multierr.Append(err, enc.AddObject("resetRequest", v.ResetRequest))
	}
	return err
}

// GetResetRequest returns the value of ResetRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Args) GetResetRequest() (o *ResetStickyTaskListRequest) {
	if v != nil && v.ResetRequest != nil {
		return v.ResetRequest
	}

	return
}

// IsSetResetRequest returns true if ResetRequest is not nil.
func (v *HistoryService_ResetStickyTaskList_Args) IsSetResetRequest() bool {
	return v != nil && v.ResetRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ResetStickyTaskList" for this struct.
func (v *HistoryService_ResetStickyTaskList_Args) MethodName() string {
	return "ResetStickyTaskList"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ResetStickyTaskList_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ResetStickyTaskList_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ResetStickyTaskList
// function.
var HistoryService_ResetStickyTaskList_Helper = struct {
	// Args accepts the parameters of ResetStickyTaskList in-order and returns
	// the arguments struct for the function.
	Args func(
		resetRequest *ResetStickyTaskListRequest,
	) *HistoryService_ResetStickyTaskList_Args

	// IsException returns true if the given error can be thrown
	// by ResetStickyTaskList.
	//
	// An error can be thrown by ResetStickyTaskList only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ResetStickyTaskList
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// ResetStickyTaskList into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by ResetStickyTaskList
	//
	//   value, err := ResetStickyTaskList(args)
	//   result, err := HistoryService_ResetStickyTaskList_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ResetStickyTaskList: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*ResetStickyTaskListResponse, error) (*HistoryService_ResetStickyTaskList_Result, error)

	// UnwrapResponse takes the result struct for ResetStickyTaskList
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if ResetStickyTaskList threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_ResetStickyTaskList_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ResetStickyTaskList_Result) (*ResetStickyTaskListResponse, error)
}{}

func init() {
	HistoryService_ResetStickyTaskList_Helper.Args = func(
		resetRequest *ResetStickyTaskListRequest,
	) *HistoryService_ResetStickyTaskList_Args {
		return &HistoryService_ResetStickyTaskList_Args{
			ResetRequest: resetRequest,
		}
	}

	HistoryService_ResetStickyTaskList_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_ResetStickyTaskList_Helper.WrapResponse = func(success *ResetStickyTaskListResponse, err error) (*HistoryService_ResetStickyTaskList_Result, error) {
		if err == nil {
			return &HistoryService_ResetStickyTaskList_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.BadRequestError")
			}
			return &HistoryService_ResetStickyTaskList_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.InternalServiceError")
			}
			return &HistoryService_ResetStickyTaskList_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.EntityNotExistError")
			}
			return &HistoryService_ResetStickyTaskList_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.ShardOwnershipLostError")
			}
			return &HistoryService_ResetStickyTaskList_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.LimitExceededError")
			}
			return &HistoryService_ResetStickyTaskList_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.ServiceBusyError")
			}
			return &HistoryService_ResetStickyTaskList_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetStickyTaskList_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_ResetStickyTaskList_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_ResetStickyTaskList_Helper.UnwrapResponse = func(result *HistoryService_ResetStickyTaskList_Result) (success *ResetStickyTaskListResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_ResetStickyTaskList_Result represents the result of a HistoryService.ResetStickyTaskList function call.
//
// The result of a ResetStickyTaskList execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_ResetStickyTaskList_Result struct {
	// Value returned by ResetStickyTaskList after a successful execution.
	Success                                *ResetStickyTaskListResponse                   `json:"success,omitempty"`
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_ResetStickyTaskList_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ResetStickyTaskList_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ResetStickyTaskList_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ResetStickyTaskListResponse_Read(w wire.Value) (*ResetStickyTaskListResponse, error) {
	var v ResetStickyTaskListResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ResetStickyTaskList_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ResetStickyTaskList_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ResetStickyTaskList_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ResetStickyTaskList_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _ResetStickyTaskListResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_ResetStickyTaskList_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ResetStickyTaskList_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ResetStickyTaskList_Result struct could not be encoded.
func (v *HistoryService_ResetStickyTaskList_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_ResetStickyTaskList_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _ResetStickyTaskListResponse_Decode(sr stream.Reader) (*ResetStickyTaskListResponse, error) {
	var v ResetStickyTaskListResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ResetStickyTaskList_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ResetStickyTaskList_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ResetStickyTaskList_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _ResetStickyTaskListResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_ResetStickyTaskList_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ResetStickyTaskList_Result
// struct.
func (v *HistoryService_ResetStickyTaskList_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_ResetStickyTaskList_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ResetStickyTaskList_Result match the
// provided HistoryService_ResetStickyTaskList_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ResetStickyTaskList_Result) Equals(rhs *HistoryService_ResetStickyTaskList_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ResetStickyTaskList_Result.
func (v *HistoryService_ResetStickyTaskList_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetSuccess() (o *ResetStickyTaskListResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetStickyTaskList_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_ResetStickyTaskList_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ResetStickyTaskList" for this struct.
func (v *HistoryService_ResetStickyTaskList_Result) MethodName() string {
	return "ResetStickyTaskList"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ResetStickyTaskList_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ResetWorkflowExecution_Args represents the arguments for the HistoryService.ResetWorkflowExecution function.
//
// The arguments for ResetWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_ResetWorkflowExecution_Args struct {
	ResetRequest *ResetWorkflowExecutionRequest `json:"resetRequest,omitempty"`
}

// ToWire translates a HistoryService_ResetWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ResetWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ResetRequest != nil {
		w, err = v.ResetRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ResetWorkflowExecutionRequest_1_Read(w wire.Value) (*ResetWorkflowExecutionRequest, error) {
	var v ResetWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ResetWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ResetWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ResetWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ResetWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.ResetRequest, err = _ResetWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ResetWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ResetWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_ResetWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ResetRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ResetRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ResetWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*ResetWorkflowExecutionRequest, error) {
	var v ResetWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ResetWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ResetWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ResetWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.ResetRequest, err = _ResetWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ResetWorkflowExecution_Args
// struct.
func (v *HistoryService_ResetWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.ResetRequest != nil {
		fields[i] = fmt.Sprintf("ResetRequest: %v", v.ResetRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_ResetWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ResetWorkflowExecution_Args match the
// provided HistoryService_ResetWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ResetWorkflowExecution_Args) Equals(rhs *HistoryService_ResetWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ResetRequest == nil && rhs.ResetRequest == nil) || (v.ResetRequest != nil && rhs.ResetRequest != nil && v.ResetRequest.Equals(rhs.ResetRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ResetWorkflowExecution_Args.
func (v *HistoryService_ResetWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ResetRequest != nil {
		err = multierr.Append(err, enc.AddObject("resetRequest", v.ResetRequest))
	}
	return err
}

// GetResetRequest returns the value of ResetRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Args) GetResetRequest() (o *ResetWorkflowExecutionRequest) {
	if v != nil && v.ResetRequest != nil {
		return v.ResetRequest
	}

	return
}

// IsSetResetRequest returns true if ResetRequest is not nil.
func (v *HistoryService_ResetWorkflowExecution_Args) IsSetResetRequest() bool {
	return v != nil && v.ResetRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ResetWorkflowExecution" for this struct.
func (v *HistoryService_ResetWorkflowExecution_Args) MethodName() string {
	return "ResetWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ResetWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ResetWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ResetWorkflowExecution
// function.
var HistoryService_ResetWorkflowExecution_Helper = struct {
	// Args accepts the parameters of ResetWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		resetRequest *ResetWorkflowExecutionRequest,
	) *HistoryService_ResetWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by ResetWorkflowExecution.
	//
	// An error can be thrown by ResetWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ResetWorkflowExecution
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// ResetWorkflowExecution into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by ResetWorkflowExecution
	//
	//   value, err := ResetWorkflowExecution(args)
	//   result, err := HistoryService_ResetWorkflowExecution_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ResetWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.ResetWorkflowExecutionResponse, error) (*HistoryService_ResetWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for ResetWorkflowExecution
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if ResetWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_ResetWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ResetWorkflowExecution_Result) (*shared.ResetWorkflowExecutionResponse, error)
}{}

func init() {
	HistoryService_ResetWorkflowExecution_Helper.Args = func(
		resetRequest *ResetWorkflowExecutionRequest,
	) *HistoryService_ResetWorkflowExecution_Args {
		return &HistoryService_ResetWorkflowExecution_Args{
			ResetRequest: resetRequest,
		}
	}

	HistoryService_ResetWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_ResetWorkflowExecution_Helper.WrapResponse = func(success *shared.ResetWorkflowExecutionResponse, err error) (*HistoryService_ResetWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_ResetWorkflowExecution_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.EntityNotExistError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.DomainNotActiveError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ResetWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_ResetWorkflowExecution_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_ResetWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_ResetWorkflowExecution_Result) (success *shared.ResetWorkflowExecutionResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_ResetWorkflowExecution_Result represents the result of a HistoryService.ResetWorkflowExecution function call.
//
// The result of a ResetWorkflowExecution execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_ResetWorkflowExecution_Result struct {
	// Value returned by ResetWorkflowExecution after a successful execution.
	Success                 *shared.ResetWorkflowExecutionResponse `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError                `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError           `json:"internalServiceError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError           `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError               `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError    *shared.DomainNotActiveError           `json:"domainNotActiveError,omitempty"`
	LimitExceededError      *shared.LimitExceededError             `json:"limitExceededError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError               `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_ResetWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ResetWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ResetWorkflowExecution_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ResetWorkflowExecutionResponse_Read(w wire.Value) (*shared.ResetWorkflowExecutionResponse, error) {
	var v shared.ResetWorkflowExecutionResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ResetWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ResetWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ResetWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ResetWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _ResetWorkflowExecutionResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_ResetWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ResetWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ResetWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_ResetWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_ResetWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _ResetWorkflowExecutionResponse_Decode(sr stream.Reader) (*shared.ResetWorkflowExecutionResponse, error) {
	var v shared.ResetWorkflowExecutionResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ResetWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ResetWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ResetWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _ResetWorkflowExecutionResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_ResetWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ResetWorkflowExecution_Result
// struct.
func (v *HistoryService_ResetWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_ResetWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ResetWorkflowExecution_Result match the
// provided HistoryService_ResetWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ResetWorkflowExecution_Result) Equals(rhs *HistoryService_ResetWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ResetWorkflowExecution_Result.
func (v *HistoryService_ResetWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetSuccess() (o *shared.ResetWorkflowExecutionResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ResetWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_ResetWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ResetWorkflowExecution" for this struct.
func (v *HistoryService_ResetWorkflowExecution_Result) MethodName() string {
	return "ResetWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ResetWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RespondActivityTaskCanceled_Args represents the arguments for the HistoryService.RespondActivityTaskCanceled function.
//
// The arguments for RespondActivityTaskCanceled are sent and received over the wire as this struct.
type HistoryService_RespondActivityTaskCanceled_Args struct {
	CanceledRequest *RespondActivityTaskCanceledRequest `json:"canceledRequest,omitempty"`
}

// ToWire translates a HistoryService_RespondActivityTaskCanceled_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondActivityTaskCanceled_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.CanceledRequest != nil {
		w, err = v.CanceledRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondActivityTaskCanceledRequest_1_Read(w wire.Value) (*RespondActivityTaskCanceledRequest, error) {
	var v RespondActivityTaskCanceledRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondActivityTaskCanceled_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondActivityTaskCanceled_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondActivityTaskCanceled_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondActivityTaskCanceled_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.CanceledRequest, err = _RespondActivityTaskCanceledRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RespondActivityTaskCanceled_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCanceled_Args struct could not be encoded.
func (v *HistoryService_RespondActivityTaskCanceled_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.CanceledRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CanceledRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondActivityTaskCanceledRequest_1_Decode(sr stream.Reader) (*RespondActivityTaskCanceledRequest, error) {
	var v RespondActivityTaskCanceledRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondActivityTaskCanceled_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCanceled_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondActivityTaskCanceled_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.CanceledRequest, err = _RespondActivityTaskCanceledRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondActivityTaskCanceled_Args
// struct.
func (v *HistoryService_RespondActivityTaskCanceled_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.CanceledRequest != nil {
		fields[i] = fmt.Sprintf("CanceledRequest: %v", v.CanceledRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondActivityTaskCanceled_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondActivityTaskCanceled_Args match the
// provided HistoryService_RespondActivityTaskCanceled_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondActivityTaskCanceled_Args) Equals(rhs *HistoryService_RespondActivityTaskCanceled_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.CanceledRequest == nil && rhs.CanceledRequest == nil) || (v.CanceledRequest != nil && rhs.CanceledRequest != nil && v.CanceledRequest.Equals(rhs.CanceledRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondActivityTaskCanceled_Args.
func (v *HistoryService_RespondActivityTaskCanceled_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.CanceledRequest != nil {
		err = multierr.Append(err, enc.AddObject("canceledRequest", v.CanceledRequest))
	}
	return err
}

// GetCanceledRequest returns the value of CanceledRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Args) GetCanceledRequest() (o *RespondActivityTaskCanceledRequest) {
	if v != nil && v.CanceledRequest != nil {
		return v.CanceledRequest
	}

	return
}

// IsSetCanceledRequest returns true if CanceledRequest is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Args) IsSetCanceledRequest() bool {
	return v != nil && v.CanceledRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RespondActivityTaskCanceled" for this struct.
func (v *HistoryService_RespondActivityTaskCanceled_Args) MethodName() string {
	return "RespondActivityTaskCanceled"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RespondActivityTaskCanceled_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RespondActivityTaskCanceled_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RespondActivityTaskCanceled
// function.
var HistoryService_RespondActivityTaskCanceled_Helper = struct {
	// Args accepts the parameters of RespondActivityTaskCanceled in-order and returns
	// the arguments struct for the function.
	Args func(
		canceledRequest *RespondActivityTaskCanceledRequest,
	) *HistoryService_RespondActivityTaskCanceled_Args

	// IsException returns true if the given error can be thrown
	// by RespondActivityTaskCanceled.
	//
	// An error can be thrown by RespondActivityTaskCanceled only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RespondActivityTaskCanceled
	// given the error returned by it. The provided error may
	// be nil if RespondActivityTaskCanceled did not fail.
	//
	// This allows mapping errors returned by RespondActivityTaskCanceled into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RespondActivityTaskCanceled
	//
	//   err := RespondActivityTaskCanceled(args)
	//   result, err := HistoryService_RespondActivityTaskCanceled_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RespondActivityTaskCanceled: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RespondActivityTaskCanceled_Result, error)

	// UnwrapResponse takes the result struct for RespondActivityTaskCanceled
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RespondActivityTaskCanceled threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RespondActivityTaskCanceled_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RespondActivityTaskCanceled_Result) error
}{}

func init() {
	HistoryService_RespondActivityTaskCanceled_Helper.Args = func(
		canceledRequest *RespondActivityTaskCanceledRequest,
	) *HistoryService_RespondActivityTaskCanceled_Args {
		return &HistoryService_RespondActivityTaskCanceled_Args{
			CanceledRequest: canceledRequest,
		}
	}

	HistoryService_RespondActivityTaskCanceled_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RespondActivityTaskCanceled_Helper.WrapResponse = func(err error) (*HistoryService_RespondActivityTaskCanceled_Result, error) {
		if err == nil {
			return &HistoryService_RespondActivityTaskCanceled_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.BadRequestError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.InternalServiceError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.EntityNotExistError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.DomainNotActiveError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.LimitExceededError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.ServiceBusyError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCanceled_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RespondActivityTaskCanceled_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RespondActivityTaskCanceled_Helper.UnwrapResponse = func(result *HistoryService_RespondActivityTaskCanceled_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RespondActivityTaskCanceled_Result represents the result of a HistoryService.RespondActivityTaskCanceled function call.
//
// The result of a RespondActivityTaskCanceled execution is sent and received over the wire as this struct.
type HistoryService_RespondActivityTaskCanceled_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RespondActivityTaskCanceled_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondActivityTaskCanceled_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RespondActivityTaskCanceled_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RespondActivityTaskCanceled_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondActivityTaskCanceled_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondActivityTaskCanceled_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondActivityTaskCanceled_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskCanceled_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RespondActivityTaskCanceled_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCanceled_Result struct could not be encoded.
func (v *HistoryService_RespondActivityTaskCanceled_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskCanceled_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RespondActivityTaskCanceled_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCanceled_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondActivityTaskCanceled_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskCanceled_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondActivityTaskCanceled_Result
// struct.
func (v *HistoryService_RespondActivityTaskCanceled_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondActivityTaskCanceled_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondActivityTaskCanceled_Result match the
// provided HistoryService_RespondActivityTaskCanceled_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondActivityTaskCanceled_Result) Equals(rhs *HistoryService_RespondActivityTaskCanceled_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondActivityTaskCanceled_Result.
func (v *HistoryService_RespondActivityTaskCanceled_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCanceled_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RespondActivityTaskCanceled_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RespondActivityTaskCanceled" for this struct.
func (v *HistoryService_RespondActivityTaskCanceled_Result) MethodName() string {
	return "RespondActivityTaskCanceled"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RespondActivityTaskCanceled_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RespondActivityTaskCompleted_Args represents the arguments for the HistoryService.RespondActivityTaskCompleted function.
//
// The arguments for RespondActivityTaskCompleted are sent and received over the wire as this struct.
type HistoryService_RespondActivityTaskCompleted_Args struct {
	CompleteRequest *RespondActivityTaskCompletedRequest `json:"completeRequest,omitempty"`
}

// ToWire translates a HistoryService_RespondActivityTaskCompleted_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondActivityTaskCompleted_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.CompleteRequest != nil {
		w, err = v.CompleteRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondActivityTaskCompletedRequest_1_Read(w wire.Value) (*RespondActivityTaskCompletedRequest, error) {
	var v RespondActivityTaskCompletedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondActivityTaskCompleted_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondActivityTaskCompleted_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondActivityTaskCompleted_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondActivityTaskCompleted_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.CompleteRequest, err = _RespondActivityTaskCompletedRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RespondActivityTaskCompleted_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCompleted_Args struct could not be encoded.
func (v *HistoryService_RespondActivityTaskCompleted_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.CompleteRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompleteRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondActivityTaskCompletedRequest_1_Decode(sr stream.Reader) (*RespondActivityTaskCompletedRequest, error) {
	var v RespondActivityTaskCompletedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondActivityTaskCompleted_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCompleted_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondActivityTaskCompleted_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.CompleteRequest, err = _RespondActivityTaskCompletedRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondActivityTaskCompleted_Args
// struct.
func (v *HistoryService_RespondActivityTaskCompleted_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.CompleteRequest != nil {
		fields[i] = fmt.Sprintf("CompleteRequest: %v", v.CompleteRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondActivityTaskCompleted_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondActivityTaskCompleted_Args match the
// provided HistoryService_RespondActivityTaskCompleted_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondActivityTaskCompleted_Args) Equals(rhs *HistoryService_RespondActivityTaskCompleted_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.CompleteRequest == nil && rhs.CompleteRequest == nil) || (v.CompleteRequest != nil && rhs.CompleteRequest != nil && v.CompleteRequest.Equals(rhs.CompleteRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondActivityTaskCompleted_Args.
func (v *HistoryService_RespondActivityTaskCompleted_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.CompleteRequest != nil {
		err = multierr.Append(err, enc.AddObject("completeRequest", v.CompleteRequest))
	}
	return err
}

// GetCompleteRequest returns the value of CompleteRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Args) GetCompleteRequest() (o *RespondActivityTaskCompletedRequest) {
	if v != nil && v.CompleteRequest != nil {
		return v.CompleteRequest
	}

	return
}

// IsSetCompleteRequest returns true if CompleteRequest is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Args) IsSetCompleteRequest() bool {
	return v != nil && v.CompleteRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RespondActivityTaskCompleted" for this struct.
func (v *HistoryService_RespondActivityTaskCompleted_Args) MethodName() string {
	return "RespondActivityTaskCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RespondActivityTaskCompleted_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RespondActivityTaskCompleted_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RespondActivityTaskCompleted
// function.
var HistoryService_RespondActivityTaskCompleted_Helper = struct {
	// Args accepts the parameters of RespondActivityTaskCompleted in-order and returns
	// the arguments struct for the function.
	Args func(
		completeRequest *RespondActivityTaskCompletedRequest,
	) *HistoryService_RespondActivityTaskCompleted_Args

	// IsException returns true if the given error can be thrown
	// by RespondActivityTaskCompleted.
	//
	// An error can be thrown by RespondActivityTaskCompleted only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RespondActivityTaskCompleted
	// given the error returned by it. The provided error may
	// be nil if RespondActivityTaskCompleted did not fail.
	//
	// This allows mapping errors returned by RespondActivityTaskCompleted into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RespondActivityTaskCompleted
	//
	//   err := RespondActivityTaskCompleted(args)
	//   result, err := HistoryService_RespondActivityTaskCompleted_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RespondActivityTaskCompleted: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RespondActivityTaskCompleted_Result, error)

	// UnwrapResponse takes the result struct for RespondActivityTaskCompleted
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RespondActivityTaskCompleted threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RespondActivityTaskCompleted_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RespondActivityTaskCompleted_Result) error
}{}

func init() {
	HistoryService_RespondActivityTaskCompleted_Helper.Args = func(
		completeRequest *RespondActivityTaskCompletedRequest,
	) *HistoryService_RespondActivityTaskCompleted_Args {
		return &HistoryService_RespondActivityTaskCompleted_Args{
			CompleteRequest: completeRequest,
		}
	}

	HistoryService_RespondActivityTaskCompleted_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RespondActivityTaskCompleted_Helper.WrapResponse = func(err error) (*HistoryService_RespondActivityTaskCompleted_Result, error) {
		if err == nil {
			return &HistoryService_RespondActivityTaskCompleted_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.BadRequestError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.InternalServiceError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.EntityNotExistError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.DomainNotActiveError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.LimitExceededError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.ServiceBusyError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskCompleted_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RespondActivityTaskCompleted_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RespondActivityTaskCompleted_Helper.UnwrapResponse = func(result *HistoryService_RespondActivityTaskCompleted_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RespondActivityTaskCompleted_Result represents the result of a HistoryService.RespondActivityTaskCompleted function call.
//
// The result of a RespondActivityTaskCompleted execution is sent and received over the wire as this struct.
type HistoryService_RespondActivityTaskCompleted_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RespondActivityTaskCompleted_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondActivityTaskCompleted_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RespondActivityTaskCompleted_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RespondActivityTaskCompleted_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondActivityTaskCompleted_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondActivityTaskCompleted_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondActivityTaskCompleted_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskCompleted_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RespondActivityTaskCompleted_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCompleted_Result struct could not be encoded.
func (v *HistoryService_RespondActivityTaskCompleted_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskCompleted_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RespondActivityTaskCompleted_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskCompleted_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondActivityTaskCompleted_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskCompleted_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondActivityTaskCompleted_Result
// struct.
func (v *HistoryService_RespondActivityTaskCompleted_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondActivityTaskCompleted_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondActivityTaskCompleted_Result match the
// provided HistoryService_RespondActivityTaskCompleted_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondActivityTaskCompleted_Result) Equals(rhs *HistoryService_RespondActivityTaskCompleted_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondActivityTaskCompleted_Result.
func (v *HistoryService_RespondActivityTaskCompleted_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskCompleted_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RespondActivityTaskCompleted_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RespondActivityTaskCompleted" for this struct.
func (v *HistoryService_RespondActivityTaskCompleted_Result) MethodName() string {
	return "RespondActivityTaskCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RespondActivityTaskCompleted_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RespondActivityTaskFailed_Args represents the arguments for the HistoryService.RespondActivityTaskFailed function.
//
// The arguments for RespondActivityTaskFailed are sent and received over the wire as this struct.
type HistoryService_RespondActivityTaskFailed_Args struct {
	FailRequest *RespondActivityTaskFailedRequest `json:"failRequest,omitempty"`
}

// ToWire translates a HistoryService_RespondActivityTaskFailed_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondActivityTaskFailed_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.FailRequest != nil {
		w, err = v.FailRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondActivityTaskFailedRequest_1_Read(w wire.Value) (*RespondActivityTaskFailedRequest, error) {
	var v RespondActivityTaskFailedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondActivityTaskFailed_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondActivityTaskFailed_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondActivityTaskFailed_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondActivityTaskFailed_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.FailRequest, err = _RespondActivityTaskFailedRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RespondActivityTaskFailed_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskFailed_Args struct could not be encoded.
func (v *HistoryService_RespondActivityTaskFailed_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.FailRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.FailRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondActivityTaskFailedRequest_1_Decode(sr stream.Reader) (*RespondActivityTaskFailedRequest, error) {
	var v RespondActivityTaskFailedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondActivityTaskFailed_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskFailed_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondActivityTaskFailed_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.FailRequest, err = _RespondActivityTaskFailedRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondActivityTaskFailed_Args
// struct.
func (v *HistoryService_RespondActivityTaskFailed_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.FailRequest != nil {
		fields[i] = fmt.Sprintf("FailRequest: %v", v.FailRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondActivityTaskFailed_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondActivityTaskFailed_Args match the
// provided HistoryService_RespondActivityTaskFailed_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondActivityTaskFailed_Args) Equals(rhs *HistoryService_RespondActivityTaskFailed_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.FailRequest == nil && rhs.FailRequest == nil) || (v.FailRequest != nil && rhs.FailRequest != nil && v.FailRequest.Equals(rhs.FailRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondActivityTaskFailed_Args.
func (v *HistoryService_RespondActivityTaskFailed_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.FailRequest != nil {
		err = multierr.Append(err, enc.AddObject("failRequest", v.FailRequest))
	}
	return err
}

// GetFailRequest returns the value of FailRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Args) GetFailRequest() (o *RespondActivityTaskFailedRequest) {
	if v != nil && v.FailRequest != nil {
		return v.FailRequest
	}

	return
}

// IsSetFailRequest returns true if FailRequest is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Args) IsSetFailRequest() bool {
	return v != nil && v.FailRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RespondActivityTaskFailed" for this struct.
func (v *HistoryService_RespondActivityTaskFailed_Args) MethodName() string {
	return "RespondActivityTaskFailed"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RespondActivityTaskFailed_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RespondActivityTaskFailed_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RespondActivityTaskFailed
// function.
var HistoryService_RespondActivityTaskFailed_Helper = struct {
	// Args accepts the parameters of RespondActivityTaskFailed in-order and returns
	// the arguments struct for the function.
	Args func(
		failRequest *RespondActivityTaskFailedRequest,
	) *HistoryService_RespondActivityTaskFailed_Args

	// IsException returns true if the given error can be thrown
	// by RespondActivityTaskFailed.
	//
	// An error can be thrown by RespondActivityTaskFailed only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RespondActivityTaskFailed
	// given the error returned by it. The provided error may
	// be nil if RespondActivityTaskFailed did not fail.
	//
	// This allows mapping errors returned by RespondActivityTaskFailed into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RespondActivityTaskFailed
	//
	//   err := RespondActivityTaskFailed(args)
	//   result, err := HistoryService_RespondActivityTaskFailed_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RespondActivityTaskFailed: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RespondActivityTaskFailed_Result, error)

	// UnwrapResponse takes the result struct for RespondActivityTaskFailed
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RespondActivityTaskFailed threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RespondActivityTaskFailed_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RespondActivityTaskFailed_Result) error
}{}

func init() {
	HistoryService_RespondActivityTaskFailed_Helper.Args = func(
		failRequest *RespondActivityTaskFailedRequest,
	) *HistoryService_RespondActivityTaskFailed_Args {
		return &HistoryService_RespondActivityTaskFailed_Args{
			FailRequest: failRequest,
		}
	}

	HistoryService_RespondActivityTaskFailed_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RespondActivityTaskFailed_Helper.WrapResponse = func(err error) (*HistoryService_RespondActivityTaskFailed_Result, error) {
		if err == nil {
			return &HistoryService_RespondActivityTaskFailed_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.BadRequestError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.InternalServiceError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.EntityNotExistError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.DomainNotActiveError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.LimitExceededError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.ServiceBusyError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondActivityTaskFailed_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RespondActivityTaskFailed_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RespondActivityTaskFailed_Helper.UnwrapResponse = func(result *HistoryService_RespondActivityTaskFailed_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RespondActivityTaskFailed_Result represents the result of a HistoryService.RespondActivityTaskFailed function call.
//
// The result of a RespondActivityTaskFailed execution is sent and received over the wire as this struct.
type HistoryService_RespondActivityTaskFailed_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RespondActivityTaskFailed_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondActivityTaskFailed_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RespondActivityTaskFailed_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RespondActivityTaskFailed_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondActivityTaskFailed_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondActivityTaskFailed_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondActivityTaskFailed_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskFailed_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RespondActivityTaskFailed_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskFailed_Result struct could not be encoded.
func (v *HistoryService_RespondActivityTaskFailed_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskFailed_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RespondActivityTaskFailed_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondActivityTaskFailed_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondActivityTaskFailed_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondActivityTaskFailed_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondActivityTaskFailed_Result
// struct.
func (v *HistoryService_RespondActivityTaskFailed_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondActivityTaskFailed_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondActivityTaskFailed_Result match the
// provided HistoryService_RespondActivityTaskFailed_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondActivityTaskFailed_Result) Equals(rhs *HistoryService_RespondActivityTaskFailed_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondActivityTaskFailed_Result.
func (v *HistoryService_RespondActivityTaskFailed_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondActivityTaskFailed_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RespondActivityTaskFailed_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RespondActivityTaskFailed" for this struct.
func (v *HistoryService_RespondActivityTaskFailed_Result) MethodName() string {
	return "RespondActivityTaskFailed"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RespondActivityTaskFailed_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RespondCrossClusterTasksCompleted_Args represents the arguments for the HistoryService.RespondCrossClusterTasksCompleted function.
//
// The arguments for RespondCrossClusterTasksCompleted are sent and received over the wire as this struct.
type HistoryService_RespondCrossClusterTasksCompleted_Args struct {
	Request *shared.RespondCrossClusterTasksCompletedRequest `json:"request,omitempty"`
}

// ToWire translates a HistoryService_RespondCrossClusterTasksCompleted_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Request != nil {
		w, err = v.Request.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondCrossClusterTasksCompletedRequest_Read(w wire.Value) (*shared.RespondCrossClusterTasksCompletedRequest, error) {
	var v shared.RespondCrossClusterTasksCompletedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondCrossClusterTasksCompleted_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondCrossClusterTasksCompleted_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondCrossClusterTasksCompleted_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.Request, err = _RespondCrossClusterTasksCompletedRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RespondCrossClusterTasksCompleted_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondCrossClusterTasksCompleted_Args struct could not be encoded.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Request != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Request.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondCrossClusterTasksCompletedRequest_Decode(sr stream.Reader) (*shared.RespondCrossClusterTasksCompletedRequest, error) {
	var v shared.RespondCrossClusterTasksCompletedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondCrossClusterTasksCompleted_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondCrossClusterTasksCompleted_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.Request, err = _RespondCrossClusterTasksCompletedRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondCrossClusterTasksCompleted_Args
// struct.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.Request != nil {
		fields[i] = fmt.Sprintf("Request: %v", v.Request)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondCrossClusterTasksCompleted_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondCrossClusterTasksCompleted_Args match the
// provided HistoryService_RespondCrossClusterTasksCompleted_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) Equals(rhs *HistoryService_RespondCrossClusterTasksCompleted_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Request == nil && rhs.Request == nil) || (v.Request != nil && rhs.Request != nil && v.Request.Equals(rhs.Request))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondCrossClusterTasksCompleted_Args.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Request != nil {
		err = multierr.Append(err, enc.AddObject("request", v.Request))
	}
	return err
}

// GetRequest returns the value of Request if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) GetRequest() (o *shared.RespondCrossClusterTasksCompletedRequest) {
	if v != nil && v.Request != nil {
		return v.Request
	}

	return
}

// IsSetRequest returns true if Request is not nil.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) IsSetRequest() bool {
	return v != nil && v.Request != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RespondCrossClusterTasksCompleted" for this struct.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) MethodName() string {
	return "RespondCrossClusterTasksCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RespondCrossClusterTasksCompleted_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RespondCrossClusterTasksCompleted
// function.
var HistoryService_RespondCrossClusterTasksCompleted_Helper = struct {
	// Args accepts the parameters of RespondCrossClusterTasksCompleted in-order and returns
	// the arguments struct for the function.
	Args func(
		request *shared.RespondCrossClusterTasksCompletedRequest,
	) *HistoryService_RespondCrossClusterTasksCompleted_Args

	// IsException returns true if the given error can be thrown
	// by RespondCrossClusterTasksCompleted.
	//
	// An error can be thrown by RespondCrossClusterTasksCompleted only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RespondCrossClusterTasksCompleted
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// RespondCrossClusterTasksCompleted into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by RespondCrossClusterTasksCompleted
	//
	//   value, err := RespondCrossClusterTasksCompleted(args)
	//   result, err := HistoryService_RespondCrossClusterTasksCompleted_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RespondCrossClusterTasksCompleted: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.RespondCrossClusterTasksCompletedResponse, error) (*HistoryService_RespondCrossClusterTasksCompleted_Result, error)

	// UnwrapResponse takes the result struct for RespondCrossClusterTasksCompleted
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if RespondCrossClusterTasksCompleted threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_RespondCrossClusterTasksCompleted_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RespondCrossClusterTasksCompleted_Result) (*shared.RespondCrossClusterTasksCompletedResponse, error)
}{}

func init() {
	HistoryService_RespondCrossClusterTasksCompleted_Helper.Args = func(
		request *shared.RespondCrossClusterTasksCompletedRequest,
	) *HistoryService_RespondCrossClusterTasksCompleted_Args {
		return &HistoryService_RespondCrossClusterTasksCompleted_Args{
			Request: request,
		}
	}

	HistoryService_RespondCrossClusterTasksCompleted_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *ShardOwnershipLostError:
			return true
		default:
			return false
		}
	}

	HistoryService_RespondCrossClusterTasksCompleted_Helper.WrapResponse = func(success *shared.RespondCrossClusterTasksCompletedResponse, err error) (*HistoryService_RespondCrossClusterTasksCompleted_Result, error) {
		if err == nil {
			return &HistoryService_RespondCrossClusterTasksCompleted_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondCrossClusterTasksCompleted_Result.BadRequestError")
			}
			return &HistoryService_RespondCrossClusterTasksCompleted_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondCrossClusterTasksCompleted_Result.InternalServiceError")
			}
			return &HistoryService_RespondCrossClusterTasksCompleted_Result{InternalServiceError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondCrossClusterTasksCompleted_Result.ServiceBusyError")
			}
			return &HistoryService_RespondCrossClusterTasksCompleted_Result{ServiceBusyError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondCrossClusterTasksCompleted_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RespondCrossClusterTasksCompleted_Result{ShardOwnershipLostError: e}, nil
		}

		return nil, err
	}
	HistoryService_RespondCrossClusterTasksCompleted_Helper.UnwrapResponse = func(result *HistoryService_RespondCrossClusterTasksCompleted_Result) (success *shared.RespondCrossClusterTasksCompletedResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_RespondCrossClusterTasksCompleted_Result represents the result of a HistoryService.RespondCrossClusterTasksCompleted function call.
//
// The result of a RespondCrossClusterTasksCompleted execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_RespondCrossClusterTasksCompleted_Result struct {
	// Value returned by RespondCrossClusterTasksCompleted after a successful execution.
	Success                 *shared.RespondCrossClusterTasksCompletedResponse `json:"success,omitempty"`
	BadRequestError         *shared.BadRequestError                           `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError                      `json:"internalServiceError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError                          `json:"serviceBusyError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError                          `json:"shardOwnershipLostError,omitempty"`
}

// ToWire translates a HistoryService_RespondCrossClusterTasksCompleted_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RespondCrossClusterTasksCompleted_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondCrossClusterTasksCompletedResponse_Read(w wire.Value) (*shared.RespondCrossClusterTasksCompletedResponse, error) {
	var v shared.RespondCrossClusterTasksCompletedResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondCrossClusterTasksCompleted_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondCrossClusterTasksCompleted_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondCrossClusterTasksCompleted_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _RespondCrossClusterTasksCompletedResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RespondCrossClusterTasksCompleted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RespondCrossClusterTasksCompleted_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondCrossClusterTasksCompleted_Result struct could not be encoded.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_RespondCrossClusterTasksCompleted_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _RespondCrossClusterTasksCompletedResponse_Decode(sr stream.Reader) (*shared.RespondCrossClusterTasksCompletedResponse, error) {
	var v shared.RespondCrossClusterTasksCompletedResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondCrossClusterTasksCompleted_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondCrossClusterTasksCompleted_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _RespondCrossClusterTasksCompletedResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RespondCrossClusterTasksCompleted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondCrossClusterTasksCompleted_Result
// struct.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondCrossClusterTasksCompleted_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondCrossClusterTasksCompleted_Result match the
// provided HistoryService_RespondCrossClusterTasksCompleted_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) Equals(rhs *HistoryService_RespondCrossClusterTasksCompleted_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondCrossClusterTasksCompleted_Result.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) GetSuccess() (o *shared.RespondCrossClusterTasksCompletedResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RespondCrossClusterTasksCompleted" for this struct.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) MethodName() string {
	return "RespondCrossClusterTasksCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RespondCrossClusterTasksCompleted_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RespondDecisionTaskCompleted_Args represents the arguments for the HistoryService.RespondDecisionTaskCompleted function.
//
// The arguments for RespondDecisionTaskCompleted are sent and received over the wire as this struct.
type HistoryService_RespondDecisionTaskCompleted_Args struct {
	CompleteRequest *RespondDecisionTaskCompletedRequest `json:"completeRequest,omitempty"`
}

// ToWire translates a HistoryService_RespondDecisionTaskCompleted_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondDecisionTaskCompleted_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.CompleteRequest != nil {
		w, err = v.CompleteRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondDecisionTaskCompletedRequest_1_Read(w wire.Value) (*RespondDecisionTaskCompletedRequest, error) {
	var v RespondDecisionTaskCompletedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondDecisionTaskCompleted_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondDecisionTaskCompleted_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondDecisionTaskCompleted_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondDecisionTaskCompleted_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.CompleteRequest, err = _RespondDecisionTaskCompletedRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RespondDecisionTaskCompleted_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskCompleted_Args struct could not be encoded.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.CompleteRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.CompleteRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondDecisionTaskCompletedRequest_1_Decode(sr stream.Reader) (*RespondDecisionTaskCompletedRequest, error) {
	var v RespondDecisionTaskCompletedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondDecisionTaskCompleted_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskCompleted_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.CompleteRequest, err = _RespondDecisionTaskCompletedRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondDecisionTaskCompleted_Args
// struct.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.CompleteRequest != nil {
		fields[i] = fmt.Sprintf("CompleteRequest: %v", v.CompleteRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondDecisionTaskCompleted_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondDecisionTaskCompleted_Args match the
// provided HistoryService_RespondDecisionTaskCompleted_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) Equals(rhs *HistoryService_RespondDecisionTaskCompleted_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.CompleteRequest == nil && rhs.CompleteRequest == nil) || (v.CompleteRequest != nil && rhs.CompleteRequest != nil && v.CompleteRequest.Equals(rhs.CompleteRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondDecisionTaskCompleted_Args.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.CompleteRequest != nil {
		err = multierr.Append(err, enc.AddObject("completeRequest", v.CompleteRequest))
	}
	return err
}

// GetCompleteRequest returns the value of CompleteRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) GetCompleteRequest() (o *RespondDecisionTaskCompletedRequest) {
	if v != nil && v.CompleteRequest != nil {
		return v.CompleteRequest
	}

	return
}

// IsSetCompleteRequest returns true if CompleteRequest is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) IsSetCompleteRequest() bool {
	return v != nil && v.CompleteRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RespondDecisionTaskCompleted" for this struct.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) MethodName() string {
	return "RespondDecisionTaskCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RespondDecisionTaskCompleted_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RespondDecisionTaskCompleted_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RespondDecisionTaskCompleted
// function.
var HistoryService_RespondDecisionTaskCompleted_Helper = struct {
	// Args accepts the parameters of RespondDecisionTaskCompleted in-order and returns
	// the arguments struct for the function.
	Args func(
		completeRequest *RespondDecisionTaskCompletedRequest,
	) *HistoryService_RespondDecisionTaskCompleted_Args

	// IsException returns true if the given error can be thrown
	// by RespondDecisionTaskCompleted.
	//
	// An error can be thrown by RespondDecisionTaskCompleted only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RespondDecisionTaskCompleted
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// RespondDecisionTaskCompleted into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by RespondDecisionTaskCompleted
	//
	//   value, err := RespondDecisionTaskCompleted(args)
	//   result, err := HistoryService_RespondDecisionTaskCompleted_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RespondDecisionTaskCompleted: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*RespondDecisionTaskCompletedResponse, error) (*HistoryService_RespondDecisionTaskCompleted_Result, error)

	// UnwrapResponse takes the result struct for RespondDecisionTaskCompleted
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if RespondDecisionTaskCompleted threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_RespondDecisionTaskCompleted_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RespondDecisionTaskCompleted_Result) (*RespondDecisionTaskCompletedResponse, error)
}{}

func init() {
	HistoryService_RespondDecisionTaskCompleted_Helper.Args = func(
		completeRequest *RespondDecisionTaskCompletedRequest,
	) *HistoryService_RespondDecisionTaskCompleted_Args {
		return &HistoryService_RespondDecisionTaskCompleted_Args{
			CompleteRequest: completeRequest,
		}
	}

	HistoryService_RespondDecisionTaskCompleted_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RespondDecisionTaskCompleted_Helper.WrapResponse = func(success *RespondDecisionTaskCompletedResponse, err error) (*HistoryService_RespondDecisionTaskCompleted_Result, error) {
		if err == nil {
			return &HistoryService_RespondDecisionTaskCompleted_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.BadRequestError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.InternalServiceError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.EntityNotExistError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.DomainNotActiveError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.LimitExceededError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.ServiceBusyError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskCompleted_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RespondDecisionTaskCompleted_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RespondDecisionTaskCompleted_Helper.UnwrapResponse = func(result *HistoryService_RespondDecisionTaskCompleted_Result) (success *RespondDecisionTaskCompletedResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_RespondDecisionTaskCompleted_Result represents the result of a HistoryService.RespondDecisionTaskCompleted function call.
//
// The result of a RespondDecisionTaskCompleted execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_RespondDecisionTaskCompleted_Result struct {
	// Value returned by RespondDecisionTaskCompleted after a successful execution.
	Success                                *RespondDecisionTaskCompletedResponse          `json:"success,omitempty"`
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RespondDecisionTaskCompleted_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondDecisionTaskCompleted_Result) ToWire() (wire.Value, error) {
	var (
		fields [9]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RespondDecisionTaskCompleted_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondDecisionTaskCompletedResponse_Read(w wire.Value) (*RespondDecisionTaskCompletedResponse, error) {
	var v RespondDecisionTaskCompletedResponse
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondDecisionTaskCompleted_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondDecisionTaskCompleted_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondDecisionTaskCompleted_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondDecisionTaskCompleted_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _RespondDecisionTaskCompletedResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RespondDecisionTaskCompleted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RespondDecisionTaskCompleted_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskCompleted_Result struct could not be encoded.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_RespondDecisionTaskCompleted_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _RespondDecisionTaskCompletedResponse_Decode(sr stream.Reader) (*RespondDecisionTaskCompletedResponse, error) {
	var v RespondDecisionTaskCompletedResponse
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondDecisionTaskCompleted_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskCompleted_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _RespondDecisionTaskCompletedResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_RespondDecisionTaskCompleted_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondDecisionTaskCompleted_Result
// struct.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [9]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondDecisionTaskCompleted_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondDecisionTaskCompleted_Result match the
// provided HistoryService_RespondDecisionTaskCompleted_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) Equals(rhs *HistoryService_RespondDecisionTaskCompleted_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondDecisionTaskCompleted_Result.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetSuccess() (o *RespondDecisionTaskCompletedResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RespondDecisionTaskCompleted" for this struct.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) MethodName() string {
	return "RespondDecisionTaskCompleted"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RespondDecisionTaskCompleted_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_RespondDecisionTaskFailed_Args represents the arguments for the HistoryService.RespondDecisionTaskFailed function.
//
// The arguments for RespondDecisionTaskFailed are sent and received over the wire as this struct.
type HistoryService_RespondDecisionTaskFailed_Args struct {
	FailedRequest *RespondDecisionTaskFailedRequest `json:"failedRequest,omitempty"`
}

// ToWire translates a HistoryService_RespondDecisionTaskFailed_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondDecisionTaskFailed_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.FailedRequest != nil {
		w, err = v.FailedRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _RespondDecisionTaskFailedRequest_1_Read(w wire.Value) (*RespondDecisionTaskFailedRequest, error) {
	var v RespondDecisionTaskFailedRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_RespondDecisionTaskFailed_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondDecisionTaskFailed_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondDecisionTaskFailed_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondDecisionTaskFailed_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.FailedRequest, err = _RespondDecisionTaskFailedRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_RespondDecisionTaskFailed_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskFailed_Args struct could not be encoded.
func (v *HistoryService_RespondDecisionTaskFailed_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.FailedRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.FailedRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _RespondDecisionTaskFailedRequest_1_Decode(sr stream.Reader) (*RespondDecisionTaskFailedRequest, error) {
	var v RespondDecisionTaskFailedRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_RespondDecisionTaskFailed_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskFailed_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondDecisionTaskFailed_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.FailedRequest, err = _RespondDecisionTaskFailedRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondDecisionTaskFailed_Args
// struct.
func (v *HistoryService_RespondDecisionTaskFailed_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.FailedRequest != nil {
		fields[i] = fmt.Sprintf("FailedRequest: %v", v.FailedRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondDecisionTaskFailed_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondDecisionTaskFailed_Args match the
// provided HistoryService_RespondDecisionTaskFailed_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondDecisionTaskFailed_Args) Equals(rhs *HistoryService_RespondDecisionTaskFailed_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.FailedRequest == nil && rhs.FailedRequest == nil) || (v.FailedRequest != nil && rhs.FailedRequest != nil && v.FailedRequest.Equals(rhs.FailedRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondDecisionTaskFailed_Args.
func (v *HistoryService_RespondDecisionTaskFailed_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.FailedRequest != nil {
		err = multierr.Append(err, enc.AddObject("failedRequest", v.FailedRequest))
	}
	return err
}

// GetFailedRequest returns the value of FailedRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Args) GetFailedRequest() (o *RespondDecisionTaskFailedRequest) {
	if v != nil && v.FailedRequest != nil {
		return v.FailedRequest
	}

	return
}

// IsSetFailedRequest returns true if FailedRequest is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Args) IsSetFailedRequest() bool {
	return v != nil && v.FailedRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "RespondDecisionTaskFailed" for this struct.
func (v *HistoryService_RespondDecisionTaskFailed_Args) MethodName() string {
	return "RespondDecisionTaskFailed"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_RespondDecisionTaskFailed_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_RespondDecisionTaskFailed_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.RespondDecisionTaskFailed
// function.
var HistoryService_RespondDecisionTaskFailed_Helper = struct {
	// Args accepts the parameters of RespondDecisionTaskFailed in-order and returns
	// the arguments struct for the function.
	Args func(
		failedRequest *RespondDecisionTaskFailedRequest,
	) *HistoryService_RespondDecisionTaskFailed_Args

	// IsException returns true if the given error can be thrown
	// by RespondDecisionTaskFailed.
	//
	// An error can be thrown by RespondDecisionTaskFailed only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for RespondDecisionTaskFailed
	// given the error returned by it. The provided error may
	// be nil if RespondDecisionTaskFailed did not fail.
	//
	// This allows mapping errors returned by RespondDecisionTaskFailed into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// RespondDecisionTaskFailed
	//
	//   err := RespondDecisionTaskFailed(args)
	//   result, err := HistoryService_RespondDecisionTaskFailed_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from RespondDecisionTaskFailed: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_RespondDecisionTaskFailed_Result, error)

	// UnwrapResponse takes the result struct for RespondDecisionTaskFailed
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if RespondDecisionTaskFailed threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_RespondDecisionTaskFailed_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_RespondDecisionTaskFailed_Result) error
}{}

func init() {
	HistoryService_RespondDecisionTaskFailed_Helper.Args = func(
		failedRequest *RespondDecisionTaskFailedRequest,
	) *HistoryService_RespondDecisionTaskFailed_Args {
		return &HistoryService_RespondDecisionTaskFailed_Args{
			FailedRequest: failedRequest,
		}
	}

	HistoryService_RespondDecisionTaskFailed_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_RespondDecisionTaskFailed_Helper.WrapResponse = func(err error) (*HistoryService_RespondDecisionTaskFailed_Result, error) {
		if err == nil {
			return &HistoryService_RespondDecisionTaskFailed_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.BadRequestError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.InternalServiceError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.EntityNotExistError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.ShardOwnershipLostError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.DomainNotActiveError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.LimitExceededError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.ServiceBusyError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_RespondDecisionTaskFailed_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_RespondDecisionTaskFailed_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_RespondDecisionTaskFailed_Helper.UnwrapResponse = func(result *HistoryService_RespondDecisionTaskFailed_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_RespondDecisionTaskFailed_Result represents the result of a HistoryService.RespondDecisionTaskFailed function call.
//
// The result of a RespondDecisionTaskFailed execution is sent and received over the wire as this struct.
type HistoryService_RespondDecisionTaskFailed_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_RespondDecisionTaskFailed_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_RespondDecisionTaskFailed_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_RespondDecisionTaskFailed_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_RespondDecisionTaskFailed_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_RespondDecisionTaskFailed_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_RespondDecisionTaskFailed_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_RespondDecisionTaskFailed_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondDecisionTaskFailed_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_RespondDecisionTaskFailed_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskFailed_Result struct could not be encoded.
func (v *HistoryService_RespondDecisionTaskFailed_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_RespondDecisionTaskFailed_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_RespondDecisionTaskFailed_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_RespondDecisionTaskFailed_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_RespondDecisionTaskFailed_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_RespondDecisionTaskFailed_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_RespondDecisionTaskFailed_Result
// struct.
func (v *HistoryService_RespondDecisionTaskFailed_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_RespondDecisionTaskFailed_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_RespondDecisionTaskFailed_Result match the
// provided HistoryService_RespondDecisionTaskFailed_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_RespondDecisionTaskFailed_Result) Equals(rhs *HistoryService_RespondDecisionTaskFailed_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_RespondDecisionTaskFailed_Result.
func (v *HistoryService_RespondDecisionTaskFailed_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_RespondDecisionTaskFailed_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_RespondDecisionTaskFailed_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "RespondDecisionTaskFailed" for this struct.
func (v *HistoryService_RespondDecisionTaskFailed_Result) MethodName() string {
	return "RespondDecisionTaskFailed"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_RespondDecisionTaskFailed_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_ScheduleDecisionTask_Args represents the arguments for the HistoryService.ScheduleDecisionTask function.
//
// The arguments for ScheduleDecisionTask are sent and received over the wire as this struct.
type HistoryService_ScheduleDecisionTask_Args struct {
	ScheduleRequest *ScheduleDecisionTaskRequest `json:"scheduleRequest,omitempty"`
}

// ToWire translates a HistoryService_ScheduleDecisionTask_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ScheduleDecisionTask_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ScheduleRequest != nil {
		w, err = v.ScheduleRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _ScheduleDecisionTaskRequest_Read(w wire.Value) (*ScheduleDecisionTaskRequest, error) {
	var v ScheduleDecisionTaskRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_ScheduleDecisionTask_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ScheduleDecisionTask_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ScheduleDecisionTask_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ScheduleDecisionTask_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.ScheduleRequest, err = _ScheduleDecisionTaskRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_ScheduleDecisionTask_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ScheduleDecisionTask_Args struct could not be encoded.
func (v *HistoryService_ScheduleDecisionTask_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.ScheduleRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ScheduleRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _ScheduleDecisionTaskRequest_Decode(sr stream.Reader) (*ScheduleDecisionTaskRequest, error) {
	var v ScheduleDecisionTaskRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_ScheduleDecisionTask_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ScheduleDecisionTask_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_ScheduleDecisionTask_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.ScheduleRequest, err = _ScheduleDecisionTaskRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ScheduleDecisionTask_Args
// struct.
func (v *HistoryService_ScheduleDecisionTask_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.ScheduleRequest != nil {
		fields[i] = fmt.Sprintf("ScheduleRequest: %v", v.ScheduleRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_ScheduleDecisionTask_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ScheduleDecisionTask_Args match the
// provided HistoryService_ScheduleDecisionTask_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_ScheduleDecisionTask_Args) Equals(rhs *HistoryService_ScheduleDecisionTask_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ScheduleRequest == nil && rhs.ScheduleRequest == nil) || (v.ScheduleRequest != nil && rhs.ScheduleRequest != nil && v.ScheduleRequest.Equals(rhs.ScheduleRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ScheduleDecisionTask_Args.
func (v *HistoryService_ScheduleDecisionTask_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ScheduleRequest != nil {
		err = multierr.Append(err, enc.AddObject("scheduleRequest", v.ScheduleRequest))
	}
	return err
}

// GetScheduleRequest returns the value of ScheduleRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Args) GetScheduleRequest() (o *ScheduleDecisionTaskRequest) {
	if v != nil && v.ScheduleRequest != nil {
		return v.ScheduleRequest
	}

	return
}

// IsSetScheduleRequest returns true if ScheduleRequest is not nil.
func (v *HistoryService_ScheduleDecisionTask_Args) IsSetScheduleRequest() bool {
	return v != nil && v.ScheduleRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "ScheduleDecisionTask" for this struct.
func (v *HistoryService_ScheduleDecisionTask_Args) MethodName() string {
	return "ScheduleDecisionTask"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_ScheduleDecisionTask_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_ScheduleDecisionTask_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.ScheduleDecisionTask
// function.
var HistoryService_ScheduleDecisionTask_Helper = struct {
	// Args accepts the parameters of ScheduleDecisionTask in-order and returns
	// the arguments struct for the function.
	Args func(
		scheduleRequest *ScheduleDecisionTaskRequest,
	) *HistoryService_ScheduleDecisionTask_Args

	// IsException returns true if the given error can be thrown
	// by ScheduleDecisionTask.
	//
	// An error can be thrown by ScheduleDecisionTask only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for ScheduleDecisionTask
	// given the error returned by it. The provided error may
	// be nil if ScheduleDecisionTask did not fail.
	//
	// This allows mapping errors returned by ScheduleDecisionTask into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// ScheduleDecisionTask
	//
	//   err := ScheduleDecisionTask(args)
	//   result, err := HistoryService_ScheduleDecisionTask_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from ScheduleDecisionTask: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_ScheduleDecisionTask_Result, error)

	// UnwrapResponse takes the result struct for ScheduleDecisionTask
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if ScheduleDecisionTask threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_ScheduleDecisionTask_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_ScheduleDecisionTask_Result) error
}{}

func init() {
	HistoryService_ScheduleDecisionTask_Helper.Args = func(
		scheduleRequest *ScheduleDecisionTaskRequest,
	) *HistoryService_ScheduleDecisionTask_Args {
		return &HistoryService_ScheduleDecisionTask_Args{
			ScheduleRequest: scheduleRequest,
		}
	}

	HistoryService_ScheduleDecisionTask_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_ScheduleDecisionTask_Helper.WrapResponse = func(err error) (*HistoryService_ScheduleDecisionTask_Result, error) {
		if err == nil {
			return &HistoryService_ScheduleDecisionTask_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.BadRequestError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.InternalServiceError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.EntityNotExistError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.ShardOwnershipLostError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.DomainNotActiveError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.LimitExceededError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.ServiceBusyError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_ScheduleDecisionTask_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_ScheduleDecisionTask_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_ScheduleDecisionTask_Helper.UnwrapResponse = func(result *HistoryService_ScheduleDecisionTask_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_ScheduleDecisionTask_Result represents the result of a HistoryService.ScheduleDecisionTask function call.
//
// The result of a ScheduleDecisionTask execution is sent and received over the wire as this struct.
type HistoryService_ScheduleDecisionTask_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_ScheduleDecisionTask_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_ScheduleDecisionTask_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_ScheduleDecisionTask_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_ScheduleDecisionTask_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_ScheduleDecisionTask_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_ScheduleDecisionTask_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_ScheduleDecisionTask_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ScheduleDecisionTask_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_ScheduleDecisionTask_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_ScheduleDecisionTask_Result struct could not be encoded.
func (v *HistoryService_ScheduleDecisionTask_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_ScheduleDecisionTask_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_ScheduleDecisionTask_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_ScheduleDecisionTask_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_ScheduleDecisionTask_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_ScheduleDecisionTask_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_ScheduleDecisionTask_Result
// struct.
func (v *HistoryService_ScheduleDecisionTask_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_ScheduleDecisionTask_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_ScheduleDecisionTask_Result match the
// provided HistoryService_ScheduleDecisionTask_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_ScheduleDecisionTask_Result) Equals(rhs *HistoryService_ScheduleDecisionTask_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_ScheduleDecisionTask_Result.
func (v *HistoryService_ScheduleDecisionTask_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_ScheduleDecisionTask_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_ScheduleDecisionTask_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "ScheduleDecisionTask" for this struct.
func (v *HistoryService_ScheduleDecisionTask_Result) MethodName() string {
	return "ScheduleDecisionTask"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_ScheduleDecisionTask_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_SignalWithStartWorkflowExecution_Args represents the arguments for the HistoryService.SignalWithStartWorkflowExecution function.
//
// The arguments for SignalWithStartWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_SignalWithStartWorkflowExecution_Args struct {
	SignalWithStartRequest *SignalWithStartWorkflowExecutionRequest `json:"signalWithStartRequest,omitempty"`
}

// ToWire translates a HistoryService_SignalWithStartWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.SignalWithStartRequest != nil {
		w, err = v.SignalWithStartRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _SignalWithStartWorkflowExecutionRequest_1_Read(w wire.Value) (*SignalWithStartWorkflowExecutionRequest, error) {
	var v SignalWithStartWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_SignalWithStartWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SignalWithStartWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SignalWithStartWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.SignalWithStartRequest, err = _SignalWithStartWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_SignalWithStartWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SignalWithStartWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.SignalWithStartRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SignalWithStartRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _SignalWithStartWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*SignalWithStartWorkflowExecutionRequest, error) {
	var v SignalWithStartWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_SignalWithStartWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SignalWithStartWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.SignalWithStartRequest, err = _SignalWithStartWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SignalWithStartWorkflowExecution_Args
// struct.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.SignalWithStartRequest != nil {
		fields[i] = fmt.Sprintf("SignalWithStartRequest: %v", v.SignalWithStartRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_SignalWithStartWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SignalWithStartWorkflowExecution_Args match the
// provided HistoryService_SignalWithStartWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) Equals(rhs *HistoryService_SignalWithStartWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.SignalWithStartRequest == nil && rhs.SignalWithStartRequest == nil) || (v.SignalWithStartRequest != nil && rhs.SignalWithStartRequest != nil && v.SignalWithStartRequest.Equals(rhs.SignalWithStartRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SignalWithStartWorkflowExecution_Args.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.SignalWithStartRequest != nil {
		err = multierr.Append(err, enc.AddObject("signalWithStartRequest", v.SignalWithStartRequest))
	}
	return err
}

// GetSignalWithStartRequest returns the value of SignalWithStartRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) GetSignalWithStartRequest() (o *SignalWithStartWorkflowExecutionRequest) {
	if v != nil && v.SignalWithStartRequest != nil {
		return v.SignalWithStartRequest
	}

	return
}

// IsSetSignalWithStartRequest returns true if SignalWithStartRequest is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) IsSetSignalWithStartRequest() bool {
	return v != nil && v.SignalWithStartRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "SignalWithStartWorkflowExecution" for this struct.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) MethodName() string {
	return "SignalWithStartWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_SignalWithStartWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_SignalWithStartWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.SignalWithStartWorkflowExecution
// function.
var HistoryService_SignalWithStartWorkflowExecution_Helper = struct {
	// Args accepts the parameters of SignalWithStartWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		signalWithStartRequest *SignalWithStartWorkflowExecutionRequest,
	) *HistoryService_SignalWithStartWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by SignalWithStartWorkflowExecution.
	//
	// An error can be thrown by SignalWithStartWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for SignalWithStartWorkflowExecution
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// SignalWithStartWorkflowExecution into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by SignalWithStartWorkflowExecution
	//
	//   value, err := SignalWithStartWorkflowExecution(args)
	//   result, err := HistoryService_SignalWithStartWorkflowExecution_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from SignalWithStartWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.StartWorkflowExecutionResponse, error) (*HistoryService_SignalWithStartWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for SignalWithStartWorkflowExecution
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if SignalWithStartWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_SignalWithStartWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_SignalWithStartWorkflowExecution_Result) (*shared.StartWorkflowExecutionResponse, error)
}{}

func init() {
	HistoryService_SignalWithStartWorkflowExecution_Helper.Args = func(
		signalWithStartRequest *SignalWithStartWorkflowExecutionRequest,
	) *HistoryService_SignalWithStartWorkflowExecution_Args {
		return &HistoryService_SignalWithStartWorkflowExecution_Args{
			SignalWithStartRequest: signalWithStartRequest,
		}
	}

	HistoryService_SignalWithStartWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyStartedError:
			return true
		default:
			return false
		}
	}

	HistoryService_SignalWithStartWorkflowExecution_Helper.WrapResponse = func(success *shared.StartWorkflowExecutionResponse, err error) (*HistoryService_SignalWithStartWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_SignalWithStartWorkflowExecution_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{InternalServiceError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.DomainNotActiveError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyStartedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWithStartWorkflowExecution_Result.WorkflowAlreadyStartedError")
			}
			return &HistoryService_SignalWithStartWorkflowExecution_Result{WorkflowAlreadyStartedError: e}, nil
		}

		return nil, err
	}
	HistoryService_SignalWithStartWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_SignalWithStartWorkflowExecution_Result) (success *shared.StartWorkflowExecutionResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowAlreadyStartedError != nil {
			err = result.WorkflowAlreadyStartedError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_SignalWithStartWorkflowExecution_Result represents the result of a HistoryService.SignalWithStartWorkflowExecution function call.
//
// The result of a SignalWithStartWorkflowExecution execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_SignalWithStartWorkflowExecution_Result struct {
	// Value returned by SignalWithStartWorkflowExecution after a successful execution.
	Success                     *shared.StartWorkflowExecutionResponse       `json:"success,omitempty"`
	BadRequestError             *shared.BadRequestError                      `json:"badRequestError,omitempty"`
	InternalServiceError        *shared.InternalServiceError                 `json:"internalServiceError,omitempty"`
	ShardOwnershipLostError     *ShardOwnershipLostError                     `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError        *shared.DomainNotActiveError                 `json:"domainNotActiveError,omitempty"`
	LimitExceededError          *shared.LimitExceededError                   `json:"limitExceededError,omitempty"`
	ServiceBusyError            *shared.ServiceBusyError                     `json:"serviceBusyError,omitempty"`
	WorkflowAlreadyStartedError *shared.WorkflowExecutionAlreadyStartedError `json:"workflowAlreadyStartedError,omitempty"`
}

// ToWire translates a HistoryService_SignalWithStartWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.WorkflowAlreadyStartedError != nil {
		w, err = v.WorkflowAlreadyStartedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_SignalWithStartWorkflowExecution_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _StartWorkflowExecutionResponse_Read(w wire.Value) (*shared.StartWorkflowExecutionResponse, error) {
	var v shared.StartWorkflowExecutionResponse
	err := v.FromWire(w)
	return &v, err
}

func _WorkflowExecutionAlreadyStartedError_Read(w wire.Value) (*shared.WorkflowExecutionAlreadyStartedError, error) {
	var v shared.WorkflowExecutionAlreadyStartedError
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_SignalWithStartWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SignalWithStartWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SignalWithStartWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _StartWorkflowExecutionResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowAlreadyStartedError, err = _WorkflowExecutionAlreadyStartedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowAlreadyStartedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_SignalWithStartWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_SignalWithStartWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SignalWithStartWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowAlreadyStartedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowAlreadyStartedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowAlreadyStartedError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_SignalWithStartWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

func _StartWorkflowExecutionResponse_Decode(sr stream.Reader) (*shared.StartWorkflowExecutionResponse, error) {
	var v shared.StartWorkflowExecutionResponse
	err := v.Decode(sr)
	return &v, err
}

func _WorkflowExecutionAlreadyStartedError_Decode(sr stream.Reader) (*shared.WorkflowExecutionAlreadyStartedError, error) {
	var v shared.WorkflowExecutionAlreadyStartedError
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_SignalWithStartWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SignalWithStartWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _StartWorkflowExecutionResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.WorkflowAlreadyStartedError, err = _WorkflowExecutionAlreadyStartedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowAlreadyStartedError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_SignalWithStartWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SignalWithStartWorkflowExecution_Result
// struct.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowAlreadyStartedError != nil {
		fields[i] = fmt.Sprintf("WorkflowAlreadyStartedError: %v", v.WorkflowAlreadyStartedError)
		i++
	}

	return fmt.Sprintf("HistoryService_SignalWithStartWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SignalWithStartWorkflowExecution_Result match the
// provided HistoryService_SignalWithStartWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) Equals(rhs *HistoryService_SignalWithStartWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowAlreadyStartedError == nil && rhs.WorkflowAlreadyStartedError == nil) || (v.WorkflowAlreadyStartedError != nil && rhs.WorkflowAlreadyStartedError != nil && v.WorkflowAlreadyStartedError.Equals(rhs.WorkflowAlreadyStartedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SignalWithStartWorkflowExecution_Result.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowAlreadyStartedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowAlreadyStartedError", v.WorkflowAlreadyStartedError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetSuccess() (o *shared.StartWorkflowExecutionResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowAlreadyStartedError returns the value of WorkflowAlreadyStartedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) GetWorkflowAlreadyStartedError() (o *shared.WorkflowExecutionAlreadyStartedError) {
	if v != nil && v.WorkflowAlreadyStartedError != nil {
		return v.WorkflowAlreadyStartedError
	}

	return
}

// IsSetWorkflowAlreadyStartedError returns true if WorkflowAlreadyStartedError is not nil.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) IsSetWorkflowAlreadyStartedError() bool {
	return v != nil && v.WorkflowAlreadyStartedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "SignalWithStartWorkflowExecution" for this struct.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) MethodName() string {
	return "SignalWithStartWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_SignalWithStartWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_SignalWorkflowExecution_Args represents the arguments for the HistoryService.SignalWorkflowExecution function.
//
// The arguments for SignalWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_SignalWorkflowExecution_Args struct {
	SignalRequest *SignalWorkflowExecutionRequest `json:"signalRequest,omitempty"`
}

// ToWire translates a HistoryService_SignalWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SignalWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.SignalRequest != nil {
		w, err = v.SignalRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _SignalWorkflowExecutionRequest_1_Read(w wire.Value) (*SignalWorkflowExecutionRequest, error) {
	var v SignalWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_SignalWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SignalWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SignalWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SignalWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.SignalRequest, err = _SignalWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_SignalWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SignalWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_SignalWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.SignalRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SignalRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _SignalWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*SignalWorkflowExecutionRequest, error) {
	var v SignalWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_SignalWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SignalWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_SignalWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.SignalRequest, err = _SignalWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SignalWorkflowExecution_Args
// struct.
func (v *HistoryService_SignalWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.SignalRequest != nil {
		fields[i] = fmt.Sprintf("SignalRequest: %v", v.SignalRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_SignalWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SignalWorkflowExecution_Args match the
// provided HistoryService_SignalWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_SignalWorkflowExecution_Args) Equals(rhs *HistoryService_SignalWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.SignalRequest == nil && rhs.SignalRequest == nil) || (v.SignalRequest != nil && rhs.SignalRequest != nil && v.SignalRequest.Equals(rhs.SignalRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SignalWorkflowExecution_Args.
func (v *HistoryService_SignalWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.SignalRequest != nil {
		err = multierr.Append(err, enc.AddObject("signalRequest", v.SignalRequest))
	}
	return err
}

// GetSignalRequest returns the value of SignalRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Args) GetSignalRequest() (o *SignalWorkflowExecutionRequest) {
	if v != nil && v.SignalRequest != nil {
		return v.SignalRequest
	}

	return
}

// IsSetSignalRequest returns true if SignalRequest is not nil.
func (v *HistoryService_SignalWorkflowExecution_Args) IsSetSignalRequest() bool {
	return v != nil && v.SignalRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "SignalWorkflowExecution" for this struct.
func (v *HistoryService_SignalWorkflowExecution_Args) MethodName() string {
	return "SignalWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_SignalWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_SignalWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.SignalWorkflowExecution
// function.
var HistoryService_SignalWorkflowExecution_Helper = struct {
	// Args accepts the parameters of SignalWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		signalRequest *SignalWorkflowExecutionRequest,
	) *HistoryService_SignalWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by SignalWorkflowExecution.
	//
	// An error can be thrown by SignalWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for SignalWorkflowExecution
	// given the error returned by it. The provided error may
	// be nil if SignalWorkflowExecution did not fail.
	//
	// This allows mapping errors returned by SignalWorkflowExecution into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// SignalWorkflowExecution
	//
	//   err := SignalWorkflowExecution(args)
	//   result, err := HistoryService_SignalWorkflowExecution_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from SignalWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_SignalWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for SignalWorkflowExecution
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if SignalWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_SignalWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_SignalWorkflowExecution_Result) error
}{}

func init() {
	HistoryService_SignalWorkflowExecution_Helper.Args = func(
		signalRequest *SignalWorkflowExecutionRequest,
	) *HistoryService_SignalWorkflowExecution_Args {
		return &HistoryService_SignalWorkflowExecution_Args{
			SignalRequest: signalRequest,
		}
	}

	HistoryService_SignalWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_SignalWorkflowExecution_Helper.WrapResponse = func(err error) (*HistoryService_SignalWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_SignalWorkflowExecution_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.EntityNotExistError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.DomainNotActiveError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{DomainNotActiveError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{ServiceBusyError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SignalWorkflowExecution_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_SignalWorkflowExecution_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_SignalWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_SignalWorkflowExecution_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_SignalWorkflowExecution_Result represents the result of a HistoryService.SignalWorkflowExecution function call.
//
// The result of a SignalWorkflowExecution execution is sent and received over the wire as this struct.
type HistoryService_SignalWorkflowExecution_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_SignalWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SignalWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_SignalWorkflowExecution_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_SignalWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SignalWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SignalWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SignalWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_SignalWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_SignalWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SignalWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_SignalWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_SignalWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_SignalWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SignalWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_SignalWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_SignalWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SignalWorkflowExecution_Result
// struct.
func (v *HistoryService_SignalWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_SignalWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SignalWorkflowExecution_Result match the
// provided HistoryService_SignalWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_SignalWorkflowExecution_Result) Equals(rhs *HistoryService_SignalWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SignalWorkflowExecution_Result.
func (v *HistoryService_SignalWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SignalWorkflowExecution_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_SignalWorkflowExecution_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "SignalWorkflowExecution" for this struct.
func (v *HistoryService_SignalWorkflowExecution_Result) MethodName() string {
	return "SignalWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_SignalWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_StartWorkflowExecution_Args represents the arguments for the HistoryService.StartWorkflowExecution function.
//
// The arguments for StartWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_StartWorkflowExecution_Args struct {
	StartRequest *StartWorkflowExecutionRequest `json:"startRequest,omitempty"`
}

// ToWire translates a HistoryService_StartWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_StartWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.StartRequest != nil {
		w, err = v.StartRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _StartWorkflowExecutionRequest_1_Read(w wire.Value) (*StartWorkflowExecutionRequest, error) {
	var v StartWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_StartWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_StartWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_StartWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_StartWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.StartRequest, err = _StartWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_StartWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_StartWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_StartWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.StartRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.StartRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _StartWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*StartWorkflowExecutionRequest, error) {
	var v StartWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_StartWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_StartWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_StartWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.StartRequest, err = _StartWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_StartWorkflowExecution_Args
// struct.
func (v *HistoryService_StartWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.StartRequest != nil {
		fields[i] = fmt.Sprintf("StartRequest: %v", v.StartRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_StartWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_StartWorkflowExecution_Args match the
// provided HistoryService_StartWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_StartWorkflowExecution_Args) Equals(rhs *HistoryService_StartWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.StartRequest == nil && rhs.StartRequest == nil) || (v.StartRequest != nil && rhs.StartRequest != nil && v.StartRequest.Equals(rhs.StartRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_StartWorkflowExecution_Args.
func (v *HistoryService_StartWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.StartRequest != nil {
		err = multierr.Append(err, enc.AddObject("startRequest", v.StartRequest))
	}
	return err
}

// GetStartRequest returns the value of StartRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Args) GetStartRequest() (o *StartWorkflowExecutionRequest) {
	if v != nil && v.StartRequest != nil {
		return v.StartRequest
	}

	return
}

// IsSetStartRequest returns true if StartRequest is not nil.
func (v *HistoryService_StartWorkflowExecution_Args) IsSetStartRequest() bool {
	return v != nil && v.StartRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "StartWorkflowExecution" for this struct.
func (v *HistoryService_StartWorkflowExecution_Args) MethodName() string {
	return "StartWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_StartWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_StartWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.StartWorkflowExecution
// function.
var HistoryService_StartWorkflowExecution_Helper = struct {
	// Args accepts the parameters of StartWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		startRequest *StartWorkflowExecutionRequest,
	) *HistoryService_StartWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by StartWorkflowExecution.
	//
	// An error can be thrown by StartWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for StartWorkflowExecution
	// given its return value and error.
	//
	// This allows mapping values and errors returned by
	// StartWorkflowExecution into a serializable result struct.
	// WrapResponse returns a non-nil error if the provided
	// error cannot be thrown by StartWorkflowExecution
	//
	//   value, err := StartWorkflowExecution(args)
	//   result, err := HistoryService_StartWorkflowExecution_Helper.WrapResponse(value, err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from StartWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(*shared.StartWorkflowExecutionResponse, error) (*HistoryService_StartWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for StartWorkflowExecution
	// and returns the value or error returned by it.
	//
	// The error is non-nil only if StartWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   value, err := HistoryService_StartWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_StartWorkflowExecution_Result) (*shared.StartWorkflowExecutionResponse, error)
}{}

func init() {
	HistoryService_StartWorkflowExecution_Helper.Args = func(
		startRequest *StartWorkflowExecutionRequest,
	) *HistoryService_StartWorkflowExecution_Args {
		return &HistoryService_StartWorkflowExecution_Args{
			StartRequest: startRequest,
		}
	}

	HistoryService_StartWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.WorkflowExecutionAlreadyStartedError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_StartWorkflowExecution_Helper.WrapResponse = func(success *shared.StartWorkflowExecutionResponse, err error) (*HistoryService_StartWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_StartWorkflowExecution_Result{Success: success}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_StartWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_StartWorkflowExecution_Result{InternalServiceError: e}, nil
		case *shared.WorkflowExecutionAlreadyStartedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.SessionAlreadyExistError")
			}
			return &HistoryService_StartWorkflowExecution_Result{SessionAlreadyExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_StartWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.DomainNotActiveError")
			}
			return &HistoryService_StartWorkflowExecution_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_StartWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_StartWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_StartWorkflowExecution_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_StartWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_StartWorkflowExecution_Result) (success *shared.StartWorkflowExecutionResponse, err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.SessionAlreadyExistError != nil {
			err = result.SessionAlreadyExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}

		if result.Success != nil {
			success = result.Success
			return
		}

		err = errors.New("expected a non-void result")
		return
	}

}

// HistoryService_StartWorkflowExecution_Result represents the result of a HistoryService.StartWorkflowExecution function call.
//
// The result of a StartWorkflowExecution execution is sent and received over the wire as this struct.
//
// Success is set only if the function did not throw an exception.
type HistoryService_StartWorkflowExecution_Result struct {
	// Value returned by StartWorkflowExecution after a successful execution.
	Success                  *shared.StartWorkflowExecutionResponse       `json:"success,omitempty"`
	BadRequestError          *shared.BadRequestError                      `json:"badRequestError,omitempty"`
	InternalServiceError     *shared.InternalServiceError                 `json:"internalServiceError,omitempty"`
	SessionAlreadyExistError *shared.WorkflowExecutionAlreadyStartedError `json:"sessionAlreadyExistError,omitempty"`
	ShardOwnershipLostError  *ShardOwnershipLostError                     `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError     *shared.DomainNotActiveError                 `json:"domainNotActiveError,omitempty"`
	LimitExceededError       *shared.LimitExceededError                   `json:"limitExceededError,omitempty"`
	ServiceBusyError         *shared.ServiceBusyError                     `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_StartWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_StartWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Success != nil {
		w, err = v.Success.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 0, Value: w}
		i++
	}
	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.SessionAlreadyExistError != nil {
		w, err = v.SessionAlreadyExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i != 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_StartWorkflowExecution_Result should have exactly one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_StartWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_StartWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_StartWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_StartWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 0:
			if field.Value.Type() == wire.TStruct {
				v.Success, err = _StartWorkflowExecutionResponse_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.SessionAlreadyExistError, err = _WorkflowExecutionAlreadyStartedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.SessionAlreadyExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_StartWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_StartWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_StartWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_StartWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Success != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 0, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.Success.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.SessionAlreadyExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SessionAlreadyExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.SessionAlreadyExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count != 1 {
		return fmt.Errorf("HistoryService_StartWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_StartWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_StartWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_StartWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 0 && fh.Type == wire.TStruct:
			v.Success, err = _StartWorkflowExecutionResponse_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.SessionAlreadyExistError, err = _WorkflowExecutionAlreadyStartedError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.Success != nil {
		count++
	}
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.SessionAlreadyExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count != 1 {
		return fmt.Errorf("HistoryService_StartWorkflowExecution_Result should have exactly one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_StartWorkflowExecution_Result
// struct.
func (v *HistoryService_StartWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.Success != nil {
		fields[i] = fmt.Sprintf("Success: %v", v.Success)
		i++
	}
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.SessionAlreadyExistError != nil {
		fields[i] = fmt.Sprintf("SessionAlreadyExistError: %v", v.SessionAlreadyExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_StartWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_StartWorkflowExecution_Result match the
// provided HistoryService_StartWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_StartWorkflowExecution_Result) Equals(rhs *HistoryService_StartWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Success == nil && rhs.Success == nil) || (v.Success != nil && rhs.Success != nil && v.Success.Equals(rhs.Success))) {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.SessionAlreadyExistError == nil && rhs.SessionAlreadyExistError == nil) || (v.SessionAlreadyExistError != nil && rhs.SessionAlreadyExistError != nil && v.SessionAlreadyExistError.Equals(rhs.SessionAlreadyExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_StartWorkflowExecution_Result.
func (v *HistoryService_StartWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Success != nil {
		err = multierr.Append(err, enc.AddObject("success", v.Success))
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.SessionAlreadyExistError != nil {
		err = multierr.Append(err, enc.AddObject("sessionAlreadyExistError", v.SessionAlreadyExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetSuccess returns the value of Success if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetSuccess() (o *shared.StartWorkflowExecutionResponse) {
	if v != nil && v.Success != nil {
		return v.Success
	}

	return
}

// IsSetSuccess returns true if Success is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetSuccess() bool {
	return v != nil && v.Success != nil
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetSessionAlreadyExistError returns the value of SessionAlreadyExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetSessionAlreadyExistError() (o *shared.WorkflowExecutionAlreadyStartedError) {
	if v != nil && v.SessionAlreadyExistError != nil {
		return v.SessionAlreadyExistError
	}

	return
}

// IsSetSessionAlreadyExistError returns true if SessionAlreadyExistError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetSessionAlreadyExistError() bool {
	return v != nil && v.SessionAlreadyExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_StartWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_StartWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "StartWorkflowExecution" for this struct.
func (v *HistoryService_StartWorkflowExecution_Result) MethodName() string {
	return "StartWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_StartWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_SyncActivity_Args represents the arguments for the HistoryService.SyncActivity function.
//
// The arguments for SyncActivity are sent and received over the wire as this struct.
type HistoryService_SyncActivity_Args struct {
	SyncActivityRequest *SyncActivityRequest `json:"syncActivityRequest,omitempty"`
}

// ToWire translates a HistoryService_SyncActivity_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SyncActivity_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.SyncActivityRequest != nil {
		w, err = v.SyncActivityRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _SyncActivityRequest_Read(w wire.Value) (*SyncActivityRequest, error) {
	var v SyncActivityRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_SyncActivity_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SyncActivity_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SyncActivity_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SyncActivity_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.SyncActivityRequest, err = _SyncActivityRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_SyncActivity_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SyncActivity_Args struct could not be encoded.
func (v *HistoryService_SyncActivity_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.SyncActivityRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SyncActivityRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _SyncActivityRequest_Decode(sr stream.Reader) (*SyncActivityRequest, error) {
	var v SyncActivityRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_SyncActivity_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SyncActivity_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_SyncActivity_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.SyncActivityRequest, err = _SyncActivityRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SyncActivity_Args
// struct.
func (v *HistoryService_SyncActivity_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.SyncActivityRequest != nil {
		fields[i] = fmt.Sprintf("SyncActivityRequest: %v", v.SyncActivityRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_SyncActivity_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SyncActivity_Args match the
// provided HistoryService_SyncActivity_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_SyncActivity_Args) Equals(rhs *HistoryService_SyncActivity_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.SyncActivityRequest == nil && rhs.SyncActivityRequest == nil) || (v.SyncActivityRequest != nil && rhs.SyncActivityRequest != nil && v.SyncActivityRequest.Equals(rhs.SyncActivityRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SyncActivity_Args.
func (v *HistoryService_SyncActivity_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.SyncActivityRequest != nil {
		err = multierr.Append(err, enc.AddObject("syncActivityRequest", v.SyncActivityRequest))
	}
	return err
}

// GetSyncActivityRequest returns the value of SyncActivityRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Args) GetSyncActivityRequest() (o *SyncActivityRequest) {
	if v != nil && v.SyncActivityRequest != nil {
		return v.SyncActivityRequest
	}

	return
}

// IsSetSyncActivityRequest returns true if SyncActivityRequest is not nil.
func (v *HistoryService_SyncActivity_Args) IsSetSyncActivityRequest() bool {
	return v != nil && v.SyncActivityRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "SyncActivity" for this struct.
func (v *HistoryService_SyncActivity_Args) MethodName() string {
	return "SyncActivity"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_SyncActivity_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_SyncActivity_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.SyncActivity
// function.
var HistoryService_SyncActivity_Helper = struct {
	// Args accepts the parameters of SyncActivity in-order and returns
	// the arguments struct for the function.
	Args func(
		syncActivityRequest *SyncActivityRequest,
	) *HistoryService_SyncActivity_Args

	// IsException returns true if the given error can be thrown
	// by SyncActivity.
	//
	// An error can be thrown by SyncActivity only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for SyncActivity
	// given the error returned by it. The provided error may
	// be nil if SyncActivity did not fail.
	//
	// This allows mapping errors returned by SyncActivity into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// SyncActivity
	//
	//   err := SyncActivity(args)
	//   result, err := HistoryService_SyncActivity_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from SyncActivity: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_SyncActivity_Result, error)

	// UnwrapResponse takes the result struct for SyncActivity
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if SyncActivity threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_SyncActivity_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_SyncActivity_Result) error
}{}

func init() {
	HistoryService_SyncActivity_Helper.Args = func(
		syncActivityRequest *SyncActivityRequest,
	) *HistoryService_SyncActivity_Args {
		return &HistoryService_SyncActivity_Args{
			SyncActivityRequest: syncActivityRequest,
		}
	}

	HistoryService_SyncActivity_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.RetryTaskV2Error:
			return true
		default:
			return false
		}
	}

	HistoryService_SyncActivity_Helper.WrapResponse = func(err error) (*HistoryService_SyncActivity_Result, error) {
		if err == nil {
			return &HistoryService_SyncActivity_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncActivity_Result.BadRequestError")
			}
			return &HistoryService_SyncActivity_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncActivity_Result.InternalServiceError")
			}
			return &HistoryService_SyncActivity_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncActivity_Result.EntityNotExistError")
			}
			return &HistoryService_SyncActivity_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncActivity_Result.ShardOwnershipLostError")
			}
			return &HistoryService_SyncActivity_Result{ShardOwnershipLostError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncActivity_Result.ServiceBusyError")
			}
			return &HistoryService_SyncActivity_Result{ServiceBusyError: e}, nil
		case *shared.RetryTaskV2Error:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncActivity_Result.RetryTaskV2Error")
			}
			return &HistoryService_SyncActivity_Result{RetryTaskV2Error: e}, nil
		}

		return nil, err
	}
	HistoryService_SyncActivity_Helper.UnwrapResponse = func(result *HistoryService_SyncActivity_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.RetryTaskV2Error != nil {
			err = result.RetryTaskV2Error
			return
		}
		return
	}

}

// HistoryService_SyncActivity_Result represents the result of a HistoryService.SyncActivity function call.
//
// The result of a SyncActivity execution is sent and received over the wire as this struct.
type HistoryService_SyncActivity_Result struct {
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	EntityNotExistError     *shared.EntityNotExistsError `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
	RetryTaskV2Error        *shared.RetryTaskV2Error     `json:"retryTaskV2Error,omitempty"`
}

// ToWire translates a HistoryService_SyncActivity_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SyncActivity_Result) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.RetryTaskV2Error != nil {
		w, err = v.RetryTaskV2Error.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_SyncActivity_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_SyncActivity_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SyncActivity_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SyncActivity_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SyncActivity_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.RetryTaskV2Error, err = _RetryTaskV2Error_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.RetryTaskV2Error != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_SyncActivity_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_SyncActivity_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SyncActivity_Result struct could not be encoded.
func (v *HistoryService_SyncActivity_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.RetryTaskV2Error != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.RetryTaskV2Error.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.RetryTaskV2Error != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_SyncActivity_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_SyncActivity_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SyncActivity_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_SyncActivity_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.RetryTaskV2Error, err = _RetryTaskV2Error_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.RetryTaskV2Error != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_SyncActivity_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SyncActivity_Result
// struct.
func (v *HistoryService_SyncActivity_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.RetryTaskV2Error != nil {
		fields[i] = fmt.Sprintf("RetryTaskV2Error: %v", v.RetryTaskV2Error)
		i++
	}

	return fmt.Sprintf("HistoryService_SyncActivity_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SyncActivity_Result match the
// provided HistoryService_SyncActivity_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_SyncActivity_Result) Equals(rhs *HistoryService_SyncActivity_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.RetryTaskV2Error == nil && rhs.RetryTaskV2Error == nil) || (v.RetryTaskV2Error != nil && rhs.RetryTaskV2Error != nil && v.RetryTaskV2Error.Equals(rhs.RetryTaskV2Error))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SyncActivity_Result.
func (v *HistoryService_SyncActivity_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.RetryTaskV2Error != nil {
		err = multierr.Append(err, enc.AddObject("retryTaskV2Error", v.RetryTaskV2Error))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_SyncActivity_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_SyncActivity_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_SyncActivity_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_SyncActivity_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_SyncActivity_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetRetryTaskV2Error returns the value of RetryTaskV2Error if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncActivity_Result) GetRetryTaskV2Error() (o *shared.RetryTaskV2Error) {
	if v != nil && v.RetryTaskV2Error != nil {
		return v.RetryTaskV2Error
	}

	return
}

// IsSetRetryTaskV2Error returns true if RetryTaskV2Error is not nil.
func (v *HistoryService_SyncActivity_Result) IsSetRetryTaskV2Error() bool {
	return v != nil && v.RetryTaskV2Error != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "SyncActivity" for this struct.
func (v *HistoryService_SyncActivity_Result) MethodName() string {
	return "SyncActivity"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_SyncActivity_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_SyncShardStatus_Args represents the arguments for the HistoryService.SyncShardStatus function.
//
// The arguments for SyncShardStatus are sent and received over the wire as this struct.
type HistoryService_SyncShardStatus_Args struct {
	SyncShardStatusRequest *SyncShardStatusRequest `json:"syncShardStatusRequest,omitempty"`
}

// ToWire translates a HistoryService_SyncShardStatus_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SyncShardStatus_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.SyncShardStatusRequest != nil {
		w, err = v.SyncShardStatusRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _SyncShardStatusRequest_Read(w wire.Value) (*SyncShardStatusRequest, error) {
	var v SyncShardStatusRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_SyncShardStatus_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SyncShardStatus_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SyncShardStatus_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SyncShardStatus_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.SyncShardStatusRequest, err = _SyncShardStatusRequest_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_SyncShardStatus_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SyncShardStatus_Args struct could not be encoded.
func (v *HistoryService_SyncShardStatus_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.SyncShardStatusRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.SyncShardStatusRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _SyncShardStatusRequest_Decode(sr stream.Reader) (*SyncShardStatusRequest, error) {
	var v SyncShardStatusRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_SyncShardStatus_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SyncShardStatus_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_SyncShardStatus_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.SyncShardStatusRequest, err = _SyncShardStatusRequest_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SyncShardStatus_Args
// struct.
func (v *HistoryService_SyncShardStatus_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.SyncShardStatusRequest != nil {
		fields[i] = fmt.Sprintf("SyncShardStatusRequest: %v", v.SyncShardStatusRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_SyncShardStatus_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SyncShardStatus_Args match the
// provided HistoryService_SyncShardStatus_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_SyncShardStatus_Args) Equals(rhs *HistoryService_SyncShardStatus_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.SyncShardStatusRequest == nil && rhs.SyncShardStatusRequest == nil) || (v.SyncShardStatusRequest != nil && rhs.SyncShardStatusRequest != nil && v.SyncShardStatusRequest.Equals(rhs.SyncShardStatusRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SyncShardStatus_Args.
func (v *HistoryService_SyncShardStatus_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.SyncShardStatusRequest != nil {
		err = multierr.Append(err, enc.AddObject("syncShardStatusRequest", v.SyncShardStatusRequest))
	}
	return err
}

// GetSyncShardStatusRequest returns the value of SyncShardStatusRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncShardStatus_Args) GetSyncShardStatusRequest() (o *SyncShardStatusRequest) {
	if v != nil && v.SyncShardStatusRequest != nil {
		return v.SyncShardStatusRequest
	}

	return
}

// IsSetSyncShardStatusRequest returns true if SyncShardStatusRequest is not nil.
func (v *HistoryService_SyncShardStatus_Args) IsSetSyncShardStatusRequest() bool {
	return v != nil && v.SyncShardStatusRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "SyncShardStatus" for this struct.
func (v *HistoryService_SyncShardStatus_Args) MethodName() string {
	return "SyncShardStatus"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_SyncShardStatus_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_SyncShardStatus_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.SyncShardStatus
// function.
var HistoryService_SyncShardStatus_Helper = struct {
	// Args accepts the parameters of SyncShardStatus in-order and returns
	// the arguments struct for the function.
	Args func(
		syncShardStatusRequest *SyncShardStatusRequest,
	) *HistoryService_SyncShardStatus_Args

	// IsException returns true if the given error can be thrown
	// by SyncShardStatus.
	//
	// An error can be thrown by SyncShardStatus only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for SyncShardStatus
	// given the error returned by it. The provided error may
	// be nil if SyncShardStatus did not fail.
	//
	// This allows mapping errors returned by SyncShardStatus into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// SyncShardStatus
	//
	//   err := SyncShardStatus(args)
	//   result, err := HistoryService_SyncShardStatus_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from SyncShardStatus: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_SyncShardStatus_Result, error)

	// UnwrapResponse takes the result struct for SyncShardStatus
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if SyncShardStatus threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_SyncShardStatus_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_SyncShardStatus_Result) error
}{}

func init() {
	HistoryService_SyncShardStatus_Helper.Args = func(
		syncShardStatusRequest *SyncShardStatusRequest,
	) *HistoryService_SyncShardStatus_Args {
		return &HistoryService_SyncShardStatus_Args{
			SyncShardStatusRequest: syncShardStatusRequest,
		}
	}

	HistoryService_SyncShardStatus_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		default:
			return false
		}
	}

	HistoryService_SyncShardStatus_Helper.WrapResponse = func(err error) (*HistoryService_SyncShardStatus_Result, error) {
		if err == nil {
			return &HistoryService_SyncShardStatus_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncShardStatus_Result.BadRequestError")
			}
			return &HistoryService_SyncShardStatus_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncShardStatus_Result.InternalServiceError")
			}
			return &HistoryService_SyncShardStatus_Result{InternalServiceError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncShardStatus_Result.ShardOwnershipLostError")
			}
			return &HistoryService_SyncShardStatus_Result{ShardOwnershipLostError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncShardStatus_Result.LimitExceededError")
			}
			return &HistoryService_SyncShardStatus_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_SyncShardStatus_Result.ServiceBusyError")
			}
			return &HistoryService_SyncShardStatus_Result{ServiceBusyError: e}, nil
		}

		return nil, err
	}
	HistoryService_SyncShardStatus_Helper.UnwrapResponse = func(result *HistoryService_SyncShardStatus_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		return
	}

}

// HistoryService_SyncShardStatus_Result represents the result of a HistoryService.SyncShardStatus function call.
//
// The result of a SyncShardStatus execution is sent and received over the wire as this struct.
type HistoryService_SyncShardStatus_Result struct {
	BadRequestError         *shared.BadRequestError      `json:"badRequestError,omitempty"`
	InternalServiceError    *shared.InternalServiceError `json:"internalServiceError,omitempty"`
	ShardOwnershipLostError *ShardOwnershipLostError     `json:"shardOwnershipLostError,omitempty"`
	LimitExceededError      *shared.LimitExceededError   `json:"limitExceededError,omitempty"`
	ServiceBusyError        *shared.ServiceBusyError     `json:"serviceBusyError,omitempty"`
}

// ToWire translates a HistoryService_SyncShardStatus_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_SyncShardStatus_Result) ToWire() (wire.Value, error) {
	var (
		fields [5]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_SyncShardStatus_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_SyncShardStatus_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_SyncShardStatus_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_SyncShardStatus_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_SyncShardStatus_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_SyncShardStatus_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_SyncShardStatus_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_SyncShardStatus_Result struct could not be encoded.
func (v *HistoryService_SyncShardStatus_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_SyncShardStatus_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_SyncShardStatus_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_SyncShardStatus_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_SyncShardStatus_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_SyncShardStatus_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_SyncShardStatus_Result
// struct.
func (v *HistoryService_SyncShardStatus_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [5]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}

	return fmt.Sprintf("HistoryService_SyncShardStatus_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_SyncShardStatus_Result match the
// provided HistoryService_SyncShardStatus_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_SyncShardStatus_Result) Equals(rhs *HistoryService_SyncShardStatus_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_SyncShardStatus_Result.
func (v *HistoryService_SyncShardStatus_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncShardStatus_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_SyncShardStatus_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncShardStatus_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_SyncShardStatus_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncShardStatus_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_SyncShardStatus_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncShardStatus_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_SyncShardStatus_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_SyncShardStatus_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_SyncShardStatus_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "SyncShardStatus" for this struct.
func (v *HistoryService_SyncShardStatus_Result) MethodName() string {
	return "SyncShardStatus"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_SyncShardStatus_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}

// HistoryService_TerminateWorkflowExecution_Args represents the arguments for the HistoryService.TerminateWorkflowExecution function.
//
// The arguments for TerminateWorkflowExecution are sent and received over the wire as this struct.
type HistoryService_TerminateWorkflowExecution_Args struct {
	TerminateRequest *TerminateWorkflowExecutionRequest `json:"terminateRequest,omitempty"`
}

// ToWire translates a HistoryService_TerminateWorkflowExecution_Args struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_TerminateWorkflowExecution_Args) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.TerminateRequest != nil {
		w, err = v.TerminateRequest.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

func _TerminateWorkflowExecutionRequest_1_Read(w wire.Value) (*TerminateWorkflowExecutionRequest, error) {
	var v TerminateWorkflowExecutionRequest
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a HistoryService_TerminateWorkflowExecution_Args struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_TerminateWorkflowExecution_Args struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_TerminateWorkflowExecution_Args
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_TerminateWorkflowExecution_Args) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.TerminateRequest, err = _TerminateWorkflowExecutionRequest_1_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a HistoryService_TerminateWorkflowExecution_Args struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_TerminateWorkflowExecution_Args struct could not be encoded.
func (v *HistoryService_TerminateWorkflowExecution_Args) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.TerminateRequest != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.TerminateRequest.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

func _TerminateWorkflowExecutionRequest_1_Decode(sr stream.Reader) (*TerminateWorkflowExecutionRequest, error) {
	var v TerminateWorkflowExecutionRequest
	err := v.Decode(sr)
	return &v, err
}

// Decode deserializes a HistoryService_TerminateWorkflowExecution_Args struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_TerminateWorkflowExecution_Args struct could not be generated from the wire
// representation.
func (v *HistoryService_TerminateWorkflowExecution_Args) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.TerminateRequest, err = _TerminateWorkflowExecutionRequest_1_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	return nil
}

// String returns a readable string representation of a HistoryService_TerminateWorkflowExecution_Args
// struct.
func (v *HistoryService_TerminateWorkflowExecution_Args) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [1]string
	i := 0
	if v.TerminateRequest != nil {
		fields[i] = fmt.Sprintf("TerminateRequest: %v", v.TerminateRequest)
		i++
	}

	return fmt.Sprintf("HistoryService_TerminateWorkflowExecution_Args{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_TerminateWorkflowExecution_Args match the
// provided HistoryService_TerminateWorkflowExecution_Args.
//
// This function performs a deep comparison.
func (v *HistoryService_TerminateWorkflowExecution_Args) Equals(rhs *HistoryService_TerminateWorkflowExecution_Args) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.TerminateRequest == nil && rhs.TerminateRequest == nil) || (v.TerminateRequest != nil && rhs.TerminateRequest != nil && v.TerminateRequest.Equals(rhs.TerminateRequest))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_TerminateWorkflowExecution_Args.
func (v *HistoryService_TerminateWorkflowExecution_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.TerminateRequest != nil {
		err = multierr.Append(err, enc.AddObject("terminateRequest", v.TerminateRequest))
	}
	return err
}

// GetTerminateRequest returns the value of TerminateRequest if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Args) GetTerminateRequest() (o *TerminateWorkflowExecutionRequest) {
	if v != nil && v.TerminateRequest != nil {
		return v.TerminateRequest
	}

	return
}

// IsSetTerminateRequest returns true if TerminateRequest is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Args) IsSetTerminateRequest() bool {
	return v != nil && v.TerminateRequest != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the arguments.
//
// This will always be "TerminateWorkflowExecution" for this struct.
func (v *HistoryService_TerminateWorkflowExecution_Args) MethodName() string {
	return "TerminateWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Call for this struct.
func (v *HistoryService_TerminateWorkflowExecution_Args) EnvelopeType() wire.EnvelopeType {
	return wire.Call
}

// HistoryService_TerminateWorkflowExecution_Helper provides functions that aid in handling the
// parameters and return values of the HistoryService.TerminateWorkflowExecution
// function.
var HistoryService_TerminateWorkflowExecution_Helper = struct {
	// Args accepts the parameters of TerminateWorkflowExecution in-order and returns
	// the arguments struct for the function.
	Args func(
		terminateRequest *TerminateWorkflowExecutionRequest,
	) *HistoryService_TerminateWorkflowExecution_Args

	// IsException returns true if the given error can be thrown
	// by TerminateWorkflowExecution.
	//
	// An error can be thrown by TerminateWorkflowExecution only if the
	// corresponding exception type was mentioned in the 'throws'
	// section for it in the Thrift file.
	IsException func(error) bool

	// WrapResponse returns the result struct for TerminateWorkflowExecution
	// given the error returned by it. The provided error may
	// be nil if TerminateWorkflowExecution did not fail.
	//
	// This allows mapping errors returned by TerminateWorkflowExecution into a
	// serializable result struct. WrapResponse returns a
	// non-nil error if the provided error cannot be thrown by
	// TerminateWorkflowExecution
	//
	//   err := TerminateWorkflowExecution(args)
	//   result, err := HistoryService_TerminateWorkflowExecution_Helper.WrapResponse(err)
	//   if err != nil {
	//     return fmt.Errorf("unexpected error from TerminateWorkflowExecution: %v", err)
	//   }
	//   serialize(result)
	WrapResponse func(error) (*HistoryService_TerminateWorkflowExecution_Result, error)

	// UnwrapResponse takes the result struct for TerminateWorkflowExecution
	// and returns the erorr returned by it (if any).
	//
	// The error is non-nil only if TerminateWorkflowExecution threw an
	// exception.
	//
	//   result := deserialize(bytes)
	//   err := HistoryService_TerminateWorkflowExecution_Helper.UnwrapResponse(result)
	UnwrapResponse func(*HistoryService_TerminateWorkflowExecution_Result) error
}{}

func init() {
	HistoryService_TerminateWorkflowExecution_Helper.Args = func(
		terminateRequest *TerminateWorkflowExecutionRequest,
	) *HistoryService_TerminateWorkflowExecution_Args {
		return &HistoryService_TerminateWorkflowExecution_Args{
			TerminateRequest: terminateRequest,
		}
	}

	HistoryService_TerminateWorkflowExecution_Helper.IsException = func(err error) bool {
		switch err.(type) {
		case *shared.BadRequestError:
			return true
		case *shared.InternalServiceError:
			return true
		case *shared.EntityNotExistsError:
			return true
		case *ShardOwnershipLostError:
			return true
		case *shared.DomainNotActiveError:
			return true
		case *shared.LimitExceededError:
			return true
		case *shared.ServiceBusyError:
			return true
		case *shared.WorkflowExecutionAlreadyCompletedError:
			return true
		default:
			return false
		}
	}

	HistoryService_TerminateWorkflowExecution_Helper.WrapResponse = func(err error) (*HistoryService_TerminateWorkflowExecution_Result, error) {
		if err == nil {
			return &HistoryService_TerminateWorkflowExecution_Result{}, nil
		}

		switch e := err.(type) {
		case *shared.BadRequestError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.BadRequestError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{BadRequestError: e}, nil
		case *shared.InternalServiceError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.InternalServiceError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{InternalServiceError: e}, nil
		case *shared.EntityNotExistsError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.EntityNotExistError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{EntityNotExistError: e}, nil
		case *ShardOwnershipLostError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.ShardOwnershipLostError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{ShardOwnershipLostError: e}, nil
		case *shared.DomainNotActiveError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.DomainNotActiveError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{DomainNotActiveError: e}, nil
		case *shared.LimitExceededError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.LimitExceededError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{LimitExceededError: e}, nil
		case *shared.ServiceBusyError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.ServiceBusyError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{ServiceBusyError: e}, nil
		case *shared.WorkflowExecutionAlreadyCompletedError:
			if e == nil {
				return nil, errors.New("WrapResponse received non-nil error type with nil value for HistoryService_TerminateWorkflowExecution_Result.WorkflowExecutionAlreadyCompletedError")
			}
			return &HistoryService_TerminateWorkflowExecution_Result{WorkflowExecutionAlreadyCompletedError: e}, nil
		}

		return nil, err
	}
	HistoryService_TerminateWorkflowExecution_Helper.UnwrapResponse = func(result *HistoryService_TerminateWorkflowExecution_Result) (err error) {
		if result.BadRequestError != nil {
			err = result.BadRequestError
			return
		}
		if result.InternalServiceError != nil {
			err = result.InternalServiceError
			return
		}
		if result.EntityNotExistError != nil {
			err = result.EntityNotExistError
			return
		}
		if result.ShardOwnershipLostError != nil {
			err = result.ShardOwnershipLostError
			return
		}
		if result.DomainNotActiveError != nil {
			err = result.DomainNotActiveError
			return
		}
		if result.LimitExceededError != nil {
			err = result.LimitExceededError
			return
		}
		if result.ServiceBusyError != nil {
			err = result.ServiceBusyError
			return
		}
		if result.WorkflowExecutionAlreadyCompletedError != nil {
			err = result.WorkflowExecutionAlreadyCompletedError
			return
		}
		return
	}

}

// HistoryService_TerminateWorkflowExecution_Result represents the result of a HistoryService.TerminateWorkflowExecution function call.
//
// The result of a TerminateWorkflowExecution execution is sent and received over the wire as this struct.
type HistoryService_TerminateWorkflowExecution_Result struct {
	BadRequestError                        *shared.BadRequestError                        `json:"badRequestError,omitempty"`
	InternalServiceError                   *shared.InternalServiceError                   `json:"internalServiceError,omitempty"`
	EntityNotExistError                    *shared.EntityNotExistsError                   `json:"entityNotExistError,omitempty"`
	ShardOwnershipLostError                *ShardOwnershipLostError                       `json:"shardOwnershipLostError,omitempty"`
	DomainNotActiveError                   *shared.DomainNotActiveError                   `json:"domainNotActiveError,omitempty"`
	LimitExceededError                     *shared.LimitExceededError                     `json:"limitExceededError,omitempty"`
	ServiceBusyError                       *shared.ServiceBusyError                       `json:"serviceBusyError,omitempty"`
	WorkflowExecutionAlreadyCompletedError *shared.WorkflowExecutionAlreadyCompletedError `json:"workflowExecutionAlreadyCompletedError,omitempty"`
}

// ToWire translates a HistoryService_TerminateWorkflowExecution_Result struct into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// An error is returned if the struct or any of its fields failed to
// validate.
//
//	x, err := v.ToWire()
//	if err != nil {
//	  return err
//	}
//
//	if err := binaryProtocol.Encode(x, writer); err != nil {
//	  return err
//	}
func (v *HistoryService_TerminateWorkflowExecution_Result) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.BadRequestError != nil {
		w, err = v.BadRequestError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 1, Value: w}
		i++
	}
	if v.InternalServiceError != nil {
		w, err = v.InternalServiceError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 2, Value: w}
		i++
	}
	if v.EntityNotExistError != nil {
		w, err = v.EntityNotExistError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 3, Value: w}
		i++
	}
	if v.ShardOwnershipLostError != nil {
		w, err = v.ShardOwnershipLostError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 4, Value: w}
		i++
	}
	if v.DomainNotActiveError != nil {
		w, err = v.DomainNotActiveError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.LimitExceededError != nil {
		w, err = v.LimitExceededError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 6, Value: w}
		i++
	}
	if v.ServiceBusyError != nil {
		w, err = v.ServiceBusyError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 7, Value: w}
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		w, err = v.WorkflowExecutionAlreadyCompletedError.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 8, Value: w}
		i++
	}

	if i > 1 {
		return wire.Value{}, fmt.Errorf("HistoryService_TerminateWorkflowExecution_Result should have at most one field: got %v fields", i)
	}

	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}

// FromWire deserializes a HistoryService_TerminateWorkflowExecution_Result struct from its Thrift-level
// representation. The Thrift-level representation may be obtained
// from a ThriftRW protocol implementation.
//
// An error is returned if we were unable to build a HistoryService_TerminateWorkflowExecution_Result struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryService_TerminateWorkflowExecution_Result
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryService_TerminateWorkflowExecution_Result) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 1:
			if field.Value.Type() == wire.TStruct {
				v.BadRequestError, err = _BadRequestError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 2:
			if field.Value.Type() == wire.TStruct {
				v.InternalServiceError, err = _InternalServiceError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 3:
			if field.Value.Type() == wire.TStruct {
				v.EntityNotExistError, err = _EntityNotExistsError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 4:
			if field.Value.Type() == wire.TStruct {
				v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 5:
			if field.Value.Type() == wire.TStruct {
				v.DomainNotActiveError, err = _DomainNotActiveError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 6:
			if field.Value.Type() == wire.TStruct {
				v.LimitExceededError, err = _LimitExceededError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 7:
			if field.Value.Type() == wire.TStruct {
				v.ServiceBusyError, err = _ServiceBusyError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		case 8:
			if field.Value.Type() == wire.TStruct {
				v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_TerminateWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// Encode serializes a HistoryService_TerminateWorkflowExecution_Result struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryService_TerminateWorkflowExecution_Result struct could not be encoded.
func (v *HistoryService_TerminateWorkflowExecution_Result) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.BadRequestError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.BadRequestError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.InternalServiceError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 2, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.InternalServiceError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.EntityNotExistError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 3, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.EntityNotExistError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ShardOwnershipLostError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 4, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ShardOwnershipLostError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.DomainNotActiveError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.DomainNotActiveError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.LimitExceededError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 6, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.LimitExceededError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.ServiceBusyError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 7, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.ServiceBusyError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.WorkflowExecutionAlreadyCompletedError != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 8, Type: wire.TStruct}); err != nil {
			return err
		}
		if err := v.WorkflowExecutionAlreadyCompletedError.Encode(sw); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}

	if count > 1 {
		return fmt.Errorf("HistoryService_TerminateWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a HistoryService_TerminateWorkflowExecution_Result struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryService_TerminateWorkflowExecution_Result struct could not be generated from the wire
// representation.
func (v *HistoryService_TerminateWorkflowExecution_Result) Decode(sr stream.Reader) error {

	if err := sr.ReadStructBegin(); err != nil {
		return err
	}

	fh, ok, err := sr.ReadFieldBegin()
	if err != nil {
		return err
	}

	for ok {
		switch {
		case fh.ID == 1 && fh.Type == wire.TStruct:
			v.BadRequestError, err = _BadRequestError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 2 && fh.Type == wire.TStruct:
			v.InternalServiceError, err = _InternalServiceError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 3 && fh.Type == wire.TStruct:
			v.EntityNotExistError, err = _EntityNotExistsError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 4 && fh.Type == wire.TStruct:
			v.ShardOwnershipLostError, err = _ShardOwnershipLostError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 5 && fh.Type == wire.TStruct:
			v.DomainNotActiveError, err = _DomainNotActiveError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 6 && fh.Type == wire.TStruct:
			v.LimitExceededError, err = _LimitExceededError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 7 && fh.Type == wire.TStruct:
			v.ServiceBusyError, err = _ServiceBusyError_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 8 && fh.Type == wire.TStruct:
			v.WorkflowExecutionAlreadyCompletedError, err = _WorkflowExecutionAlreadyCompletedError_Decode(sr)
			if err != nil {
				return err
			}

		default:
			if err := sr.Skip(fh.Type); err != nil {
				return err
			}
		}

		if err := sr.ReadFieldEnd(); err != nil {
			return err
		}

		if fh, ok, err = sr.ReadFieldBegin(); err != nil {
			return err
		}
	}

	if err := sr.ReadStructEnd(); err != nil {
		return err
	}

	count := 0
	if v.BadRequestError != nil {
		count++
	}
	if v.InternalServiceError != nil {
		count++
	}
	if v.EntityNotExistError != nil {
		count++
	}
	if v.ShardOwnershipLostError != nil {
		count++
	}
	if v.DomainNotActiveError != nil {
		count++
	}
	if v.LimitExceededError != nil {
		count++
	}
	if v.ServiceBusyError != nil {
		count++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		count++
	}
	if count > 1 {
		return fmt.Errorf("HistoryService_TerminateWorkflowExecution_Result should have at most one field: got %v fields", count)
	}

	return nil
}

// String returns a readable string representation of a HistoryService_TerminateWorkflowExecution_Result
// struct.
func (v *HistoryService_TerminateWorkflowExecution_Result) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.BadRequestError != nil {
		fields[i] = fmt.Sprintf("BadRequestError: %v", v.BadRequestError)
		i++
	}
	if v.InternalServiceError != nil {
		fields[i] = fmt.Sprintf("InternalServiceError: %v", v.InternalServiceError)
		i++
	}
	if v.EntityNotExistError != nil {
		fields[i] = fmt.Sprintf("EntityNotExistError: %v", v.EntityNotExistError)
		i++
	}
	if v.ShardOwnershipLostError != nil {
		fields[i] = fmt.Sprintf("ShardOwnershipLostError: %v", v.ShardOwnershipLostError)
		i++
	}
	if v.DomainNotActiveError != nil {
		fields[i] = fmt.Sprintf("DomainNotActiveError: %v", v.DomainNotActiveError)
		i++
	}
	if v.LimitExceededError != nil {
		fields[i] = fmt.Sprintf("LimitExceededError: %v", v.LimitExceededError)
		i++
	}
	if v.ServiceBusyError != nil {
		fields[i] = fmt.Sprintf("ServiceBusyError: %v", v.ServiceBusyError)
		i++
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		fields[i] = fmt.Sprintf("WorkflowExecutionAlreadyCompletedError: %v", v.WorkflowExecutionAlreadyCompletedError)
		i++
	}

	return fmt.Sprintf("HistoryService_TerminateWorkflowExecution_Result{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this HistoryService_TerminateWorkflowExecution_Result match the
// provided HistoryService_TerminateWorkflowExecution_Result.
//
// This function performs a deep comparison.
func (v *HistoryService_TerminateWorkflowExecution_Result) Equals(rhs *HistoryService_TerminateWorkflowExecution_Result) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.BadRequestError == nil && rhs.BadRequestError == nil) || (v.BadRequestError != nil && rhs.BadRequestError != nil && v.BadRequestError.Equals(rhs.BadRequestError))) {
		return false
	}
	if !((v.InternalServiceError == nil && rhs.InternalServiceError == nil) || (v.InternalServiceError != nil && rhs.InternalServiceError != nil && v.InternalServiceError.Equals(rhs.InternalServiceError))) {
		return false
	}
	if !((v.EntityNotExistError == nil && rhs.EntityNotExistError == nil) || (v.EntityNotExistError != nil && rhs.EntityNotExistError != nil && v.EntityNotExistError.Equals(rhs.EntityNotExistError))) {
		return false
	}
	if !((v.ShardOwnershipLostError == nil && rhs.ShardOwnershipLostError == nil) || (v.ShardOwnershipLostError != nil && rhs.ShardOwnershipLostError != nil && v.ShardOwnershipLostError.Equals(rhs.ShardOwnershipLostError))) {
		return false
	}
	if !((v.DomainNotActiveError == nil && rhs.DomainNotActiveError == nil) || (v.DomainNotActiveError != nil && rhs.DomainNotActiveError != nil && v.DomainNotActiveError.Equals(rhs.DomainNotActiveError))) {
		return false
	}
	if !((v.LimitExceededError == nil && rhs.LimitExceededError == nil) || (v.LimitExceededError != nil && rhs.LimitExceededError != nil && v.LimitExceededError.Equals(rhs.LimitExceededError))) {
		return false
	}
	if !((v.ServiceBusyError == nil && rhs.ServiceBusyError == nil) || (v.ServiceBusyError != nil && rhs.ServiceBusyError != nil && v.ServiceBusyError.Equals(rhs.ServiceBusyError))) {
		return false
	}
	if !((v.WorkflowExecutionAlreadyCompletedError == nil && rhs.WorkflowExecutionAlreadyCompletedError == nil) || (v.WorkflowExecutionAlreadyCompletedError != nil && rhs.WorkflowExecutionAlreadyCompletedError != nil && v.WorkflowExecutionAlreadyCompletedError.Equals(rhs.WorkflowExecutionAlreadyCompletedError))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of HistoryService_TerminateWorkflowExecution_Result.
func (v *HistoryService_TerminateWorkflowExecution_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.BadRequestError != nil {
		err = multierr.Append(err, enc.AddObject("badRequestError", v.BadRequestError))
	}
	if v.InternalServiceError != nil {
		err = multierr.Append(err, enc.AddObject("internalServiceError", v.InternalServiceError))
	}
	if v.EntityNotExistError != nil {
		err = multierr.Append(err, enc.AddObject("entityNotExistError", v.EntityNotExistError))
	}
	if v.ShardOwnershipLostError != nil {
		err = multierr.Append(err, enc.AddObject("shardOwnershipLostError", v.ShardOwnershipLostError))
	}
	if v.DomainNotActiveError != nil {
		err = multierr.Append(err, enc.AddObject("domainNotActiveError", v.DomainNotActiveError))
	}
	if v.LimitExceededError != nil {
		err = multierr.Append(err, enc.AddObject("limitExceededError", v.LimitExceededError))
	}
	if v.ServiceBusyError != nil {
		err = multierr.Append(err, enc.AddObject("serviceBusyError", v.ServiceBusyError))
	}
	if v.WorkflowExecutionAlreadyCompletedError != nil {
		err = multierr.Append(err, enc.AddObject("workflowExecutionAlreadyCompletedError", v.WorkflowExecutionAlreadyCompletedError))
	}
	return err
}

// GetBadRequestError returns the value of BadRequestError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetBadRequestError() (o *shared.BadRequestError) {
	if v != nil && v.BadRequestError != nil {
		return v.BadRequestError
	}

	return
}

// IsSetBadRequestError returns true if BadRequestError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetBadRequestError() bool {
	return v != nil && v.BadRequestError != nil
}

// GetInternalServiceError returns the value of InternalServiceError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetInternalServiceError() (o *shared.InternalServiceError) {
	if v != nil && v.InternalServiceError != nil {
		return v.InternalServiceError
	}

	return
}

// IsSetInternalServiceError returns true if InternalServiceError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetInternalServiceError() bool {
	return v != nil && v.InternalServiceError != nil
}

// GetEntityNotExistError returns the value of EntityNotExistError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetEntityNotExistError() (o *shared.EntityNotExistsError) {
	if v != nil && v.EntityNotExistError != nil {
		return v.EntityNotExistError
	}

	return
}

// IsSetEntityNotExistError returns true if EntityNotExistError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetEntityNotExistError() bool {
	return v != nil && v.EntityNotExistError != nil
}

// GetShardOwnershipLostError returns the value of ShardOwnershipLostError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetShardOwnershipLostError() (o *ShardOwnershipLostError) {
	if v != nil && v.ShardOwnershipLostError != nil {
		return v.ShardOwnershipLostError
	}

	return
}

// IsSetShardOwnershipLostError returns true if ShardOwnershipLostError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetShardOwnershipLostError() bool {
	return v != nil && v.ShardOwnershipLostError != nil
}

// GetDomainNotActiveError returns the value of DomainNotActiveError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetDomainNotActiveError() (o *shared.DomainNotActiveError) {
	if v != nil && v.DomainNotActiveError != nil {
		return v.DomainNotActiveError
	}

	return
}

// IsSetDomainNotActiveError returns true if DomainNotActiveError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetDomainNotActiveError() bool {
	return v != nil && v.DomainNotActiveError != nil
}

// GetLimitExceededError returns the value of LimitExceededError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetLimitExceededError() (o *shared.LimitExceededError) {
	if v != nil && v.LimitExceededError != nil {
		return v.LimitExceededError
	}

	return
}

// IsSetLimitExceededError returns true if LimitExceededError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetLimitExceededError() bool {
	return v != nil && v.LimitExceededError != nil
}

// GetServiceBusyError returns the value of ServiceBusyError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetServiceBusyError() (o *shared.ServiceBusyError) {
	if v != nil && v.ServiceBusyError != nil {
		return v.ServiceBusyError
	}

	return
}

// IsSetServiceBusyError returns true if ServiceBusyError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetServiceBusyError() bool {
	return v != nil && v.ServiceBusyError != nil
}

// GetWorkflowExecutionAlreadyCompletedError returns the value of WorkflowExecutionAlreadyCompletedError if it is set or its
// zero value if it is unset.
func (v *HistoryService_TerminateWorkflowExecution_Result) GetWorkflowExecutionAlreadyCompletedError() (o *shared.WorkflowExecutionAlreadyCompletedError) {
	if v != nil && v.WorkflowExecutionAlreadyCompletedError != nil {
		return v.WorkflowExecutionAlreadyCompletedError
	}

	return
}

// IsSetWorkflowExecutionAlreadyCompletedError returns true if WorkflowExecutionAlreadyCompletedError is not nil.
func (v *HistoryService_TerminateWorkflowExecution_Result) IsSetWorkflowExecutionAlreadyCompletedError() bool {
	return v != nil && v.WorkflowExecutionAlreadyCompletedError != nil
}

// MethodName returns the name of the Thrift function as specified in
// the IDL, for which this struct represent the result.
//
// This will always be "TerminateWorkflowExecution" for this struct.
func (v *HistoryService_TerminateWorkflowExecution_Result) MethodName() string {
	return "TerminateWorkflowExecution"
}

// EnvelopeType returns the kind of value inside this struct.
//
// This will always be Reply for this struct.
func (v *HistoryService_TerminateWorkflowExecution_Result) EnvelopeType() wire.EnvelopeType {
	return wire.Reply
}
