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

package replicator

import (
	bytes "bytes"
	base64 "encoding/base64"
	json "encoding/json"
	fmt "fmt"
	math "math"
	strconv "strconv"
	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"

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

type DLQType int32

const (
	DLQTypeReplication DLQType = 0
	DLQTypeDomain      DLQType = 1
)

// DLQType_Values returns all recognized values of DLQType.
func DLQType_Values() []DLQType {
	return []DLQType{
		DLQTypeReplication,
		DLQTypeDomain,
	}
}

// UnmarshalText tries to decode DLQType from a byte slice
// containing its name.
//
//	var v DLQType
//	err := v.UnmarshalText([]byte("Replication"))
func (v *DLQType) UnmarshalText(value []byte) error {
	switch s := string(value); s {
	case "Replication":
		*v = DLQTypeReplication
		return nil
	case "Domain":
		*v = DLQTypeDomain
		return nil
	default:
		val, err := strconv.ParseInt(s, 10, 32)
		if err != nil {
			return fmt.Errorf("unknown enum value %q for %q: %v", s, "DLQType", err)
		}
		*v = DLQType(val)
		return nil
	}
}

// MarshalText encodes DLQType to text.
//
// If the enum value is recognized, its name is returned.
// Otherwise, its integer value is returned.
//
// This implements the TextMarshaler interface.
func (v DLQType) MarshalText() ([]byte, error) {
	switch int32(v) {
	case 0:
		return []byte("Replication"), nil
	case 1:
		return []byte("Domain"), nil
	}
	return []byte(strconv.FormatInt(int64(v), 10)), nil
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DLQType.
// Enums are logged as objects, where the value is logged with key "value", and
// if this value's name is known, the name is logged with key "name".
func (v DLQType) MarshalLogObject(enc zapcore.ObjectEncoder) error {
	enc.AddInt32("value", int32(v))
	switch int32(v) {
	case 0:
		enc.AddString("name", "Replication")
	case 1:
		enc.AddString("name", "Domain")
	}
	return nil
}

// Ptr returns a pointer to this enum value.
func (v DLQType) Ptr() *DLQType {
	return &v
}

// Encode encodes DLQType directly to bytes.
//
//	sWriter := BinaryStreamer.Writer(writer)
//
//	var v DLQType
//	return v.Encode(sWriter)
func (v DLQType) Encode(sw stream.Writer) error {
	return sw.WriteInt32(int32(v))
}

// ToWire translates DLQType into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// Enums are represented as 32-bit integers over the wire.
func (v DLQType) ToWire() (wire.Value, error) {
	return wire.NewValueI32(int32(v)), nil
}

// FromWire deserializes DLQType from its Thrift-level
// representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TI32)
//	if err != nil {
//	  return DLQType(0), err
//	}
//
//	var v DLQType
//	if err := v.FromWire(x); err != nil {
//	  return DLQType(0), err
//	}
//	return v, nil
func (v *DLQType) FromWire(w wire.Value) error {
	*v = (DLQType)(w.GetI32())
	return nil
}

// Decode reads off the encoded DLQType directly off of the wire.
//
//	sReader := BinaryStreamer.Reader(reader)
//
//	var v DLQType
//	if err := v.Decode(sReader); err != nil {
//	  return DLQType(0), err
//	}
//	return v, nil
func (v *DLQType) Decode(sr stream.Reader) error {
	i, err := sr.ReadInt32()
	if err != nil {
		return err
	}
	*v = (DLQType)(i)
	return nil
}

// String returns a readable string representation of DLQType.
func (v DLQType) String() string {
	w := int32(v)
	switch w {
	case 0:
		return "Replication"
	case 1:
		return "Domain"
	}
	return fmt.Sprintf("DLQType(%d)", w)
}

// Equals returns true if this DLQType value matches the provided
// value.
func (v DLQType) Equals(rhs DLQType) bool {
	return v == rhs
}

// MarshalJSON serializes DLQType into JSON.
//
// If the enum value is recognized, its name is returned.
// Otherwise, its integer value is returned.
//
// This implements json.Marshaler.
func (v DLQType) MarshalJSON() ([]byte, error) {
	switch int32(v) {
	case 0:
		return ([]byte)("\"Replication\""), nil
	case 1:
		return ([]byte)("\"Domain\""), nil
	}
	return ([]byte)(strconv.FormatInt(int64(v), 10)), nil
}

// UnmarshalJSON attempts to decode DLQType from its JSON
// representation.
//
// This implementation supports both, numeric and string inputs. If a
// string is provided, it must be a known enum name.
//
// This implements json.Unmarshaler.
func (v *DLQType) UnmarshalJSON(text []byte) error {
	d := json.NewDecoder(bytes.NewReader(text))
	d.UseNumber()
	t, err := d.Token()
	if err != nil {
		return err
	}

	switch w := t.(type) {
	case json.Number:
		x, err := w.Int64()
		if err != nil {
			return err
		}
		if x > math.MaxInt32 {
			return fmt.Errorf("enum overflow from JSON %q for %q", text, "DLQType")
		}
		if x < math.MinInt32 {
			return fmt.Errorf("enum underflow from JSON %q for %q", text, "DLQType")
		}
		*v = (DLQType)(x)
		return nil
	case string:
		return v.UnmarshalText([]byte(w))
	default:
		return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "DLQType")
	}
}

type DomainOperation int32

const (
	DomainOperationCreate DomainOperation = 0
	DomainOperationUpdate DomainOperation = 1
	DomainOperationDelete DomainOperation = 2
)

// DomainOperation_Values returns all recognized values of DomainOperation.
func DomainOperation_Values() []DomainOperation {
	return []DomainOperation{
		DomainOperationCreate,
		DomainOperationUpdate,
		DomainOperationDelete,
	}
}

// UnmarshalText tries to decode DomainOperation from a byte slice
// containing its name.
//
//	var v DomainOperation
//	err := v.UnmarshalText([]byte("Create"))
func (v *DomainOperation) UnmarshalText(value []byte) error {
	switch s := string(value); s {
	case "Create":
		*v = DomainOperationCreate
		return nil
	case "Update":
		*v = DomainOperationUpdate
		return nil
	case "Delete":
		*v = DomainOperationDelete
		return nil
	default:
		val, err := strconv.ParseInt(s, 10, 32)
		if err != nil {
			return fmt.Errorf("unknown enum value %q for %q: %v", s, "DomainOperation", err)
		}
		*v = DomainOperation(val)
		return nil
	}
}

// MarshalText encodes DomainOperation to text.
//
// If the enum value is recognized, its name is returned.
// Otherwise, its integer value is returned.
//
// This implements the TextMarshaler interface.
func (v DomainOperation) MarshalText() ([]byte, error) {
	switch int32(v) {
	case 0:
		return []byte("Create"), nil
	case 1:
		return []byte("Update"), nil
	case 2:
		return []byte("Delete"), nil
	}
	return []byte(strconv.FormatInt(int64(v), 10)), nil
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DomainOperation.
// Enums are logged as objects, where the value is logged with key "value", and
// if this value's name is known, the name is logged with key "name".
func (v DomainOperation) MarshalLogObject(enc zapcore.ObjectEncoder) error {
	enc.AddInt32("value", int32(v))
	switch int32(v) {
	case 0:
		enc.AddString("name", "Create")
	case 1:
		enc.AddString("name", "Update")
	case 2:
		enc.AddString("name", "Delete")
	}
	return nil
}

// Ptr returns a pointer to this enum value.
func (v DomainOperation) Ptr() *DomainOperation {
	return &v
}

// Encode encodes DomainOperation directly to bytes.
//
//	sWriter := BinaryStreamer.Writer(writer)
//
//	var v DomainOperation
//	return v.Encode(sWriter)
func (v DomainOperation) Encode(sw stream.Writer) error {
	return sw.WriteInt32(int32(v))
}

// ToWire translates DomainOperation into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// Enums are represented as 32-bit integers over the wire.
func (v DomainOperation) ToWire() (wire.Value, error) {
	return wire.NewValueI32(int32(v)), nil
}

// FromWire deserializes DomainOperation from its Thrift-level
// representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TI32)
//	if err != nil {
//	  return DomainOperation(0), err
//	}
//
//	var v DomainOperation
//	if err := v.FromWire(x); err != nil {
//	  return DomainOperation(0), err
//	}
//	return v, nil
func (v *DomainOperation) FromWire(w wire.Value) error {
	*v = (DomainOperation)(w.GetI32())
	return nil
}

// Decode reads off the encoded DomainOperation directly off of the wire.
//
//	sReader := BinaryStreamer.Reader(reader)
//
//	var v DomainOperation
//	if err := v.Decode(sReader); err != nil {
//	  return DomainOperation(0), err
//	}
//	return v, nil
func (v *DomainOperation) Decode(sr stream.Reader) error {
	i, err := sr.ReadInt32()
	if err != nil {
		return err
	}
	*v = (DomainOperation)(i)
	return nil
}

// String returns a readable string representation of DomainOperation.
func (v DomainOperation) String() string {
	w := int32(v)
	switch w {
	case 0:
		return "Create"
	case 1:
		return "Update"
	case 2:
		return "Delete"
	}
	return fmt.Sprintf("DomainOperation(%d)", w)
}

// Equals returns true if this DomainOperation value matches the provided
// value.
func (v DomainOperation) Equals(rhs DomainOperation) bool {
	return v == rhs
}

// MarshalJSON serializes DomainOperation into JSON.
//
// If the enum value is recognized, its name is returned.
// Otherwise, its integer value is returned.
//
// This implements json.Marshaler.
func (v DomainOperation) MarshalJSON() ([]byte, error) {
	switch int32(v) {
	case 0:
		return ([]byte)("\"Create\""), nil
	case 1:
		return ([]byte)("\"Update\""), nil
	case 2:
		return ([]byte)("\"Delete\""), nil
	}
	return ([]byte)(strconv.FormatInt(int64(v), 10)), nil
}

// UnmarshalJSON attempts to decode DomainOperation from its JSON
// representation.
//
// This implementation supports both, numeric and string inputs. If a
// string is provided, it must be a known enum name.
//
// This implements json.Unmarshaler.
func (v *DomainOperation) UnmarshalJSON(text []byte) error {
	d := json.NewDecoder(bytes.NewReader(text))
	d.UseNumber()
	t, err := d.Token()
	if err != nil {
		return err
	}

	switch w := t.(type) {
	case json.Number:
		x, err := w.Int64()
		if err != nil {
			return err
		}
		if x > math.MaxInt32 {
			return fmt.Errorf("enum overflow from JSON %q for %q", text, "DomainOperation")
		}
		if x < math.MinInt32 {
			return fmt.Errorf("enum underflow from JSON %q for %q", text, "DomainOperation")
		}
		*v = (DomainOperation)(x)
		return nil
	case string:
		return v.UnmarshalText([]byte(w))
	default:
		return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "DomainOperation")
	}
}

type DomainTaskAttributes struct {
	DomainOperation         *DomainOperation                       `json:"domainOperation,omitempty"`
	ID                      *string                                `json:"id,omitempty"`
	Info                    *shared.DomainInfo                     `json:"info,omitempty"`
	Config                  *shared.DomainConfiguration            `json:"config,omitempty"`
	ReplicationConfig       *shared.DomainReplicationConfiguration `json:"replicationConfig,omitempty"`
	ConfigVersion           *int64                                 `json:"configVersion,omitempty"`
	FailoverVersion         *int64                                 `json:"failoverVersion,omitempty"`
	PreviousFailoverVersion *int64                                 `json:"previousFailoverVersion,omitempty"`
}

// ToWire translates a DomainTaskAttributes 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 *DomainTaskAttributes) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.DomainOperation != nil {
		w, err = v.DomainOperation.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	if v.ID != nil {
		w, err = wire.NewValueString(*(v.ID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Info != nil {
		w, err = v.Info.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.Config != nil {
		w, err = v.Config.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.ReplicationConfig != nil {
		w, err = v.ReplicationConfig.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.ConfigVersion != nil {
		w, err = wire.NewValueI64(*(v.ConfigVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.FailoverVersion != nil {
		w, err = wire.NewValueI64(*(v.FailoverVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 60, Value: w}
		i++
	}
	if v.PreviousFailoverVersion != nil {
		w, err = wire.NewValueI64(*(v.PreviousFailoverVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}

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

func _DomainOperation_Read(w wire.Value) (DomainOperation, error) {
	var v DomainOperation
	err := v.FromWire(w)
	return v, err
}

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

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

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

// FromWire deserializes a DomainTaskAttributes 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 DomainTaskAttributes struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v DomainTaskAttributes
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *DomainTaskAttributes) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 5:
			if field.Value.Type() == wire.TI32 {
				var x DomainOperation
				x, err = _DomainOperation_Read(field.Value)
				v.DomainOperation = &x
				if err != nil {
					return err
				}

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

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

			}
		case 30:
			if field.Value.Type() == wire.TStruct {
				v.Config, err = _DomainConfiguration_Read(field.Value)
				if err != nil {
					return err
				}

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

			}
		case 50:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.ConfigVersion = &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.FailoverVersion = &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.PreviousFailoverVersion = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

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

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

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

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

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

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

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

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

	return sw.WriteStructEnd()
}

func _DomainOperation_Decode(sr stream.Reader) (DomainOperation, error) {
	var v DomainOperation
	err := v.Decode(sr)
	return v, err
}

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

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

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

// Decode deserializes a DomainTaskAttributes struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a DomainTaskAttributes struct could not be generated from the wire
// representation.
func (v *DomainTaskAttributes) 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 == 5 && fh.Type == wire.TI32:
			var x DomainOperation
			x, err = _DomainOperation_Decode(sr)
			v.DomainOperation = &x
			if err != nil {
				return err
			}

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

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

		case fh.ID == 30 && fh.Type == wire.TStruct:
			v.Config, err = _DomainConfiguration_Decode(sr)
			if err != nil {
				return err
			}

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

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

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

		case fh.ID == 70 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.PreviousFailoverVersion = &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 DomainTaskAttributes
// struct.
func (v *DomainTaskAttributes) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.DomainOperation != nil {
		fields[i] = fmt.Sprintf("DomainOperation: %v", *(v.DomainOperation))
		i++
	}
	if v.ID != nil {
		fields[i] = fmt.Sprintf("ID: %v", *(v.ID))
		i++
	}
	if v.Info != nil {
		fields[i] = fmt.Sprintf("Info: %v", v.Info)
		i++
	}
	if v.Config != nil {
		fields[i] = fmt.Sprintf("Config: %v", v.Config)
		i++
	}
	if v.ReplicationConfig != nil {
		fields[i] = fmt.Sprintf("ReplicationConfig: %v", v.ReplicationConfig)
		i++
	}
	if v.ConfigVersion != nil {
		fields[i] = fmt.Sprintf("ConfigVersion: %v", *(v.ConfigVersion))
		i++
	}
	if v.FailoverVersion != nil {
		fields[i] = fmt.Sprintf("FailoverVersion: %v", *(v.FailoverVersion))
		i++
	}
	if v.PreviousFailoverVersion != nil {
		fields[i] = fmt.Sprintf("PreviousFailoverVersion: %v", *(v.PreviousFailoverVersion))
		i++
	}

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

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

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

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

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

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 DomainTaskAttributes match the
// provided DomainTaskAttributes.
//
// This function performs a deep comparison.
func (v *DomainTaskAttributes) Equals(rhs *DomainTaskAttributes) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_DomainOperation_EqualsPtr(v.DomainOperation, rhs.DomainOperation) {
		return false
	}
	if !_String_EqualsPtr(v.ID, rhs.ID) {
		return false
	}
	if !((v.Info == nil && rhs.Info == nil) || (v.Info != nil && rhs.Info != nil && v.Info.Equals(rhs.Info))) {
		return false
	}
	if !((v.Config == nil && rhs.Config == nil) || (v.Config != nil && rhs.Config != nil && v.Config.Equals(rhs.Config))) {
		return false
	}
	if !((v.ReplicationConfig == nil && rhs.ReplicationConfig == nil) || (v.ReplicationConfig != nil && rhs.ReplicationConfig != nil && v.ReplicationConfig.Equals(rhs.ReplicationConfig))) {
		return false
	}
	if !_I64_EqualsPtr(v.ConfigVersion, rhs.ConfigVersion) {
		return false
	}
	if !_I64_EqualsPtr(v.FailoverVersion, rhs.FailoverVersion) {
		return false
	}
	if !_I64_EqualsPtr(v.PreviousFailoverVersion, rhs.PreviousFailoverVersion) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of DomainTaskAttributes.
func (v *DomainTaskAttributes) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.DomainOperation != nil {
		err = multierr.Append(err, enc.AddObject("domainOperation", *v.DomainOperation))
	}
	if v.ID != nil {
		enc.AddString("id", *v.ID)
	}
	if v.Info != nil {
		err = multierr.Append(err, enc.AddObject("info", v.Info))
	}
	if v.Config != nil {
		err = multierr.Append(err, enc.AddObject("config", v.Config))
	}
	if v.ReplicationConfig != nil {
		err = multierr.Append(err, enc.AddObject("replicationConfig", v.ReplicationConfig))
	}
	if v.ConfigVersion != nil {
		enc.AddInt64("configVersion", *v.ConfigVersion)
	}
	if v.FailoverVersion != nil {
		enc.AddInt64("failoverVersion", *v.FailoverVersion)
	}
	if v.PreviousFailoverVersion != nil {
		enc.AddInt64("previousFailoverVersion", *v.PreviousFailoverVersion)
	}
	return err
}

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

	return
}

// IsSetDomainOperation returns true if DomainOperation is not nil.
func (v *DomainTaskAttributes) IsSetDomainOperation() bool {
	return v != nil && v.DomainOperation != nil
}

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

	return
}

// IsSetID returns true if ID is not nil.
func (v *DomainTaskAttributes) IsSetID() bool {
	return v != nil && v.ID != nil
}

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

	return
}

// IsSetInfo returns true if Info is not nil.
func (v *DomainTaskAttributes) IsSetInfo() bool {
	return v != nil && v.Info != nil
}

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

	return
}

// IsSetConfig returns true if Config is not nil.
func (v *DomainTaskAttributes) IsSetConfig() bool {
	return v != nil && v.Config != nil
}

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

	return
}

// IsSetReplicationConfig returns true if ReplicationConfig is not nil.
func (v *DomainTaskAttributes) IsSetReplicationConfig() bool {
	return v != nil && v.ReplicationConfig != nil
}

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

	return
}

// IsSetConfigVersion returns true if ConfigVersion is not nil.
func (v *DomainTaskAttributes) IsSetConfigVersion() bool {
	return v != nil && v.ConfigVersion != nil
}

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

	return
}

// IsSetFailoverVersion returns true if FailoverVersion is not nil.
func (v *DomainTaskAttributes) IsSetFailoverVersion() bool {
	return v != nil && v.FailoverVersion != nil
}

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

	return
}

// IsSetPreviousFailoverVersion returns true if PreviousFailoverVersion is not nil.
func (v *DomainTaskAttributes) IsSetPreviousFailoverVersion() bool {
	return v != nil && v.PreviousFailoverVersion != nil
}

type FailoverMarkerAttributes struct {
	DomainID        *string `json:"domainID,omitempty"`
	FailoverVersion *int64  `json:"failoverVersion,omitempty"`
	CreationTime    *int64  `json:"creationTime,omitempty"`
}

// ToWire translates a FailoverMarkerAttributes 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 *FailoverMarkerAttributes) ToWire() (wire.Value, error) {
	var (
		fields [3]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.FailoverVersion != nil {
		w, err = wire.NewValueI64(*(v.FailoverVersion)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.CreationTime != nil {
		w, err = wire.NewValueI64(*(v.CreationTime)), 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 FailoverMarkerAttributes 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 FailoverMarkerAttributes struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v FailoverMarkerAttributes
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *FailoverMarkerAttributes) 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.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.FailoverVersion = &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.CreationTime = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a FailoverMarkerAttributes struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a FailoverMarkerAttributes struct could not be encoded.
func (v *FailoverMarkerAttributes) 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.FailoverVersion != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 20, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.FailoverVersion)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

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

	return sw.WriteStructEnd()
}

// Decode deserializes a FailoverMarkerAttributes struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a FailoverMarkerAttributes struct could not be generated from the wire
// representation.
func (v *FailoverMarkerAttributes) 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.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.FailoverVersion = &x
			if err != nil {
				return err
			}

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.CreationTime = &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 FailoverMarkerAttributes
// struct.
func (v *FailoverMarkerAttributes) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

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

	return true
}

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

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

	return
}

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

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

	return
}

// IsSetFailoverVersion returns true if FailoverVersion is not nil.
func (v *FailoverMarkerAttributes) IsSetFailoverVersion() bool {
	return v != nil && v.FailoverVersion != nil
}

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

	return
}

// IsSetCreationTime returns true if CreationTime is not nil.
func (v *FailoverMarkerAttributes) IsSetCreationTime() bool {
	return v != nil && v.CreationTime != nil
}

type FailoverMarkers struct {
	FailoverMarkers []*FailoverMarkerAttributes `json:"failoverMarkers,omitempty"`
}

type _List_FailoverMarkerAttributes_ValueList []*FailoverMarkerAttributes

func (v _List_FailoverMarkerAttributes_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*FailoverMarkerAttributes', 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_FailoverMarkerAttributes_ValueList) Size() int {
	return len(v)
}

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

func (_List_FailoverMarkerAttributes_ValueList) Close() {}

// ToWire translates a FailoverMarkers 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 *FailoverMarkers) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.FailoverMarkers != nil {
		w, err = wire.NewValueList(_List_FailoverMarkerAttributes_ValueList(v.FailoverMarkers)), 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 _FailoverMarkerAttributes_Read(w wire.Value) (*FailoverMarkerAttributes, error) {
	var v FailoverMarkerAttributes
	err := v.FromWire(w)
	return &v, err
}

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

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

// FromWire deserializes a FailoverMarkers 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 FailoverMarkers struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v FailoverMarkers
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *FailoverMarkers) 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.FailoverMarkers, err = _List_FailoverMarkerAttributes_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_FailoverMarkerAttributes_Encode(val []*FailoverMarkerAttributes, 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 '[]*FailoverMarkerAttributes', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

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

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

	return sw.WriteStructEnd()
}

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

func _List_FailoverMarkerAttributes_Decode(sr stream.Reader) ([]*FailoverMarkerAttributes, 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([]*FailoverMarkerAttributes, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _FailoverMarkerAttributes_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 FailoverMarkers struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a FailoverMarkers struct could not be generated from the wire
// representation.
func (v *FailoverMarkers) 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.FailoverMarkers, err = _List_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 FailoverMarkers
// struct.
func (v *FailoverMarkers) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

func _List_FailoverMarkerAttributes_Equals(lhs, rhs []*FailoverMarkerAttributes) 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 FailoverMarkers match the
// provided FailoverMarkers.
//
// This function performs a deep comparison.
func (v *FailoverMarkers) Equals(rhs *FailoverMarkers) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.FailoverMarkers == nil && rhs.FailoverMarkers == nil) || (v.FailoverMarkers != nil && rhs.FailoverMarkers != nil && _List_FailoverMarkerAttributes_Equals(v.FailoverMarkers, rhs.FailoverMarkers))) {
		return false
	}

	return true
}

type _List_FailoverMarkerAttributes_Zapper []*FailoverMarkerAttributes

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_FailoverMarkerAttributes_Zapper.
func (l _List_FailoverMarkerAttributes_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 FailoverMarkers.
func (v *FailoverMarkers) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.FailoverMarkers != nil {
		err = multierr.Append(err, enc.AddArray("failoverMarkers", (_List_FailoverMarkerAttributes_Zapper)(v.FailoverMarkers)))
	}
	return err
}

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

	return
}

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

type GetDLQReplicationMessagesRequest struct {
	TaskInfos []*ReplicationTaskInfo `json:"taskInfos,omitempty"`
}

type _List_ReplicationTaskInfo_ValueList []*ReplicationTaskInfo

func (v _List_ReplicationTaskInfo_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*ReplicationTaskInfo', 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_ReplicationTaskInfo_ValueList) Size() int {
	return len(v)
}

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

func (_List_ReplicationTaskInfo_ValueList) Close() {}

// ToWire translates a GetDLQReplicationMessagesRequest 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 *GetDLQReplicationMessagesRequest) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.TaskInfos != nil {
		w, err = wire.NewValueList(_List_ReplicationTaskInfo_ValueList(v.TaskInfos)), 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 _ReplicationTaskInfo_Read(w wire.Value) (*ReplicationTaskInfo, error) {
	var v ReplicationTaskInfo
	err := v.FromWire(w)
	return &v, err
}

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

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

// FromWire deserializes a GetDLQReplicationMessagesRequest 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 GetDLQReplicationMessagesRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetDLQReplicationMessagesRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetDLQReplicationMessagesRequest) 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.TaskInfos, err = _List_ReplicationTaskInfo_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_ReplicationTaskInfo_Encode(val []*ReplicationTaskInfo, 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 '[]*ReplicationTaskInfo', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

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

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

	return sw.WriteStructEnd()
}

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

func _List_ReplicationTaskInfo_Decode(sr stream.Reader) ([]*ReplicationTaskInfo, 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([]*ReplicationTaskInfo, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _ReplicationTaskInfo_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 GetDLQReplicationMessagesRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetDLQReplicationMessagesRequest struct could not be generated from the wire
// representation.
func (v *GetDLQReplicationMessagesRequest) 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.TaskInfos, err = _List_ReplicationTaskInfo_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 GetDLQReplicationMessagesRequest
// struct.
func (v *GetDLQReplicationMessagesRequest) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

func _List_ReplicationTaskInfo_Equals(lhs, rhs []*ReplicationTaskInfo) 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 GetDLQReplicationMessagesRequest match the
// provided GetDLQReplicationMessagesRequest.
//
// This function performs a deep comparison.
func (v *GetDLQReplicationMessagesRequest) Equals(rhs *GetDLQReplicationMessagesRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.TaskInfos == nil && rhs.TaskInfos == nil) || (v.TaskInfos != nil && rhs.TaskInfos != nil && _List_ReplicationTaskInfo_Equals(v.TaskInfos, rhs.TaskInfos))) {
		return false
	}

	return true
}

type _List_ReplicationTaskInfo_Zapper []*ReplicationTaskInfo

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_ReplicationTaskInfo_Zapper.
func (l _List_ReplicationTaskInfo_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 GetDLQReplicationMessagesRequest.
func (v *GetDLQReplicationMessagesRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.TaskInfos != nil {
		err = multierr.Append(err, enc.AddArray("taskInfos", (_List_ReplicationTaskInfo_Zapper)(v.TaskInfos)))
	}
	return err
}

// GetTaskInfos returns the value of TaskInfos if it is set or its
// zero value if it is unset.
func (v *GetDLQReplicationMessagesRequest) GetTaskInfos() (o []*ReplicationTaskInfo) {
	if v != nil && v.TaskInfos != nil {
		return v.TaskInfos
	}

	return
}

// IsSetTaskInfos returns true if TaskInfos is not nil.
func (v *GetDLQReplicationMessagesRequest) IsSetTaskInfos() bool {
	return v != nil && v.TaskInfos != nil
}

type GetDLQReplicationMessagesResponse struct {
	ReplicationTasks []*ReplicationTask `json:"replicationTasks,omitempty"`
}

type _List_ReplicationTask_ValueList []*ReplicationTask

func (v _List_ReplicationTask_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*ReplicationTask', 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_ReplicationTask_ValueList) Size() int {
	return len(v)
}

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

func (_List_ReplicationTask_ValueList) Close() {}

// ToWire translates a GetDLQReplicationMessagesResponse 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 *GetDLQReplicationMessagesResponse) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ReplicationTasks != nil {
		w, err = wire.NewValueList(_List_ReplicationTask_ValueList(v.ReplicationTasks)), 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 _ReplicationTask_Read(w wire.Value) (*ReplicationTask, error) {
	var v ReplicationTask
	err := v.FromWire(w)
	return &v, err
}

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

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

// FromWire deserializes a GetDLQReplicationMessagesResponse 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 GetDLQReplicationMessagesResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetDLQReplicationMessagesResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetDLQReplicationMessagesResponse) 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.ReplicationTasks, err = _List_ReplicationTask_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _List_ReplicationTask_Encode(val []*ReplicationTask, 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 '[]*ReplicationTask', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

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

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

	return sw.WriteStructEnd()
}

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

func _List_ReplicationTask_Decode(sr stream.Reader) ([]*ReplicationTask, 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([]*ReplicationTask, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _ReplicationTask_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 GetDLQReplicationMessagesResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetDLQReplicationMessagesResponse struct could not be generated from the wire
// representation.
func (v *GetDLQReplicationMessagesResponse) 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.ReplicationTasks, err = _List_ReplicationTask_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 GetDLQReplicationMessagesResponse
// struct.
func (v *GetDLQReplicationMessagesResponse) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

func _List_ReplicationTask_Equals(lhs, rhs []*ReplicationTask) 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 GetDLQReplicationMessagesResponse match the
// provided GetDLQReplicationMessagesResponse.
//
// This function performs a deep comparison.
func (v *GetDLQReplicationMessagesResponse) Equals(rhs *GetDLQReplicationMessagesResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ReplicationTasks == nil && rhs.ReplicationTasks == nil) || (v.ReplicationTasks != nil && rhs.ReplicationTasks != nil && _List_ReplicationTask_Equals(v.ReplicationTasks, rhs.ReplicationTasks))) {
		return false
	}

	return true
}

type _List_ReplicationTask_Zapper []*ReplicationTask

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_ReplicationTask_Zapper.
func (l _List_ReplicationTask_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 GetDLQReplicationMessagesResponse.
func (v *GetDLQReplicationMessagesResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ReplicationTasks != nil {
		err = multierr.Append(err, enc.AddArray("replicationTasks", (_List_ReplicationTask_Zapper)(v.ReplicationTasks)))
	}
	return err
}

// GetReplicationTasks returns the value of ReplicationTasks if it is set or its
// zero value if it is unset.
func (v *GetDLQReplicationMessagesResponse) GetReplicationTasks() (o []*ReplicationTask) {
	if v != nil && v.ReplicationTasks != nil {
		return v.ReplicationTasks
	}

	return
}

// IsSetReplicationTasks returns true if ReplicationTasks is not nil.
func (v *GetDLQReplicationMessagesResponse) IsSetReplicationTasks() bool {
	return v != nil && v.ReplicationTasks != nil
}

type GetDomainReplicationMessagesRequest struct {
	LastRetrievedMessageId *int64  `json:"lastRetrievedMessageId,omitempty"`
	LastProcessedMessageId *int64  `json:"lastProcessedMessageId,omitempty"`
	ClusterName            *string `json:"clusterName,omitempty"`
}

// ToWire translates a GetDomainReplicationMessagesRequest 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 *GetDomainReplicationMessagesRequest) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.LastRetrievedMessageId != nil {
		w, err = wire.NewValueI64(*(v.LastRetrievedMessageId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.LastProcessedMessageId != nil {
		w, err = wire.NewValueI64(*(v.LastProcessedMessageId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.ClusterName != nil {
		w, err = wire.NewValueString(*(v.ClusterName)), 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 GetDomainReplicationMessagesRequest 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 GetDomainReplicationMessagesRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetDomainReplicationMessagesRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetDomainReplicationMessagesRequest) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			if field.Value.Type() == wire.TI64 {
				var x int64
				x, err = field.Value.GetI64(), error(nil)
				v.LastRetrievedMessageId = &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.LastProcessedMessageId = &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.ClusterName = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

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

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

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

	return sw.WriteStructEnd()
}

// Decode deserializes a GetDomainReplicationMessagesRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetDomainReplicationMessagesRequest struct could not be generated from the wire
// representation.
func (v *GetDomainReplicationMessagesRequest) 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.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.LastRetrievedMessageId = &x
			if err != nil {
				return err
			}

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

		case fh.ID == 30 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClusterName = &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 GetDomainReplicationMessagesRequest
// struct.
func (v *GetDomainReplicationMessagesRequest) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

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

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of GetDomainReplicationMessagesRequest.
func (v *GetDomainReplicationMessagesRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.LastRetrievedMessageId != nil {
		enc.AddInt64("lastRetrievedMessageId", *v.LastRetrievedMessageId)
	}
	if v.LastProcessedMessageId != nil {
		enc.AddInt64("lastProcessedMessageId", *v.LastProcessedMessageId)
	}
	if v.ClusterName != nil {
		enc.AddString("clusterName", *v.ClusterName)
	}
	return err
}

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

	return
}

// IsSetLastRetrievedMessageId returns true if LastRetrievedMessageId is not nil.
func (v *GetDomainReplicationMessagesRequest) IsSetLastRetrievedMessageId() bool {
	return v != nil && v.LastRetrievedMessageId != nil
}

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

	return
}

// IsSetLastProcessedMessageId returns true if LastProcessedMessageId is not nil.
func (v *GetDomainReplicationMessagesRequest) IsSetLastProcessedMessageId() bool {
	return v != nil && v.LastProcessedMessageId != nil
}

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

	return
}

// IsSetClusterName returns true if ClusterName is not nil.
func (v *GetDomainReplicationMessagesRequest) IsSetClusterName() bool {
	return v != nil && v.ClusterName != nil
}

type GetDomainReplicationMessagesResponse struct {
	Messages *ReplicationMessages `json:"messages,omitempty"`
}

// ToWire translates a GetDomainReplicationMessagesResponse 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 *GetDomainReplicationMessagesResponse) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Messages != nil {
		w, err = v.Messages.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 _ReplicationMessages_Read(w wire.Value) (*ReplicationMessages, error) {
	var v ReplicationMessages
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a GetDomainReplicationMessagesResponse 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 GetDomainReplicationMessagesResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetDomainReplicationMessagesResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetDomainReplicationMessagesResponse) 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.Messages, err = _ReplicationMessages_Read(field.Value)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

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

	return sw.WriteStructEnd()
}

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

// Decode deserializes a GetDomainReplicationMessagesResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetDomainReplicationMessagesResponse struct could not be generated from the wire
// representation.
func (v *GetDomainReplicationMessagesResponse) 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.Messages, err = _ReplicationMessages_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 GetDomainReplicationMessagesResponse
// struct.
func (v *GetDomainReplicationMessagesResponse) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

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

	return true
}

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

// GetMessages returns the value of Messages if it is set or its
// zero value if it is unset.
func (v *GetDomainReplicationMessagesResponse) GetMessages() (o *ReplicationMessages) {
	if v != nil && v.Messages != nil {
		return v.Messages
	}

	return
}

// IsSetMessages returns true if Messages is not nil.
func (v *GetDomainReplicationMessagesResponse) IsSetMessages() bool {
	return v != nil && v.Messages != nil
}

type GetReplicationMessagesRequest struct {
	Tokens      []*ReplicationToken `json:"tokens,omitempty"`
	ClusterName *string             `json:"clusterName,omitempty"`
}

type _List_ReplicationToken_ValueList []*ReplicationToken

func (v _List_ReplicationToken_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid list '[]*ReplicationToken', 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_ReplicationToken_ValueList) Size() int {
	return len(v)
}

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

func (_List_ReplicationToken_ValueList) Close() {}

// ToWire translates a GetReplicationMessagesRequest 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 *GetReplicationMessagesRequest) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Tokens != nil {
		w, err = wire.NewValueList(_List_ReplicationToken_ValueList(v.Tokens)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ClusterName != nil {
		w, err = wire.NewValueString(*(v.ClusterName)), 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 _ReplicationToken_Read(w wire.Value) (*ReplicationToken, error) {
	var v ReplicationToken
	err := v.FromWire(w)
	return &v, err
}

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

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

// FromWire deserializes a GetReplicationMessagesRequest 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 GetReplicationMessagesRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetReplicationMessagesRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetReplicationMessagesRequest) 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.Tokens, err = _List_ReplicationToken_Read(field.Value.GetList())
				if err != nil {
					return err
				}

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

			}
		}
	}

	return nil
}

func _List_ReplicationToken_Encode(val []*ReplicationToken, 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 '[]*ReplicationToken', index [%v]: value is nil", i)
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}
	return sw.WriteListEnd()
}

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

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

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

	return sw.WriteStructEnd()
}

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

func _List_ReplicationToken_Decode(sr stream.Reader) ([]*ReplicationToken, 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([]*ReplicationToken, 0, lh.Length)
	for i := 0; i < lh.Length; i++ {
		v, err := _ReplicationToken_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 GetReplicationMessagesRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetReplicationMessagesRequest struct could not be generated from the wire
// representation.
func (v *GetReplicationMessagesRequest) 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.Tokens, err = _List_ReplicationToken_Decode(sr)
			if err != nil {
				return err
			}

		case fh.ID == 20 && fh.Type == wire.TBinary:
			var x string
			x, err = sr.ReadString()
			v.ClusterName = &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 GetReplicationMessagesRequest
// struct.
func (v *GetReplicationMessagesRequest) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

func _List_ReplicationToken_Equals(lhs, rhs []*ReplicationToken) 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 GetReplicationMessagesRequest match the
// provided GetReplicationMessagesRequest.
//
// This function performs a deep comparison.
func (v *GetReplicationMessagesRequest) Equals(rhs *GetReplicationMessagesRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.Tokens == nil && rhs.Tokens == nil) || (v.Tokens != nil && rhs.Tokens != nil && _List_ReplicationToken_Equals(v.Tokens, rhs.Tokens))) {
		return false
	}
	if !_String_EqualsPtr(v.ClusterName, rhs.ClusterName) {
		return false
	}

	return true
}

type _List_ReplicationToken_Zapper []*ReplicationToken

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _List_ReplicationToken_Zapper.
func (l _List_ReplicationToken_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 GetReplicationMessagesRequest.
func (v *GetReplicationMessagesRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Tokens != nil {
		err = multierr.Append(err, enc.AddArray("tokens", (_List_ReplicationToken_Zapper)(v.Tokens)))
	}
	if v.ClusterName != nil {
		enc.AddString("clusterName", *v.ClusterName)
	}
	return err
}

// GetTokens returns the value of Tokens if it is set or its
// zero value if it is unset.
func (v *GetReplicationMessagesRequest) GetTokens() (o []*ReplicationToken) {
	if v != nil && v.Tokens != nil {
		return v.Tokens
	}

	return
}

// IsSetTokens returns true if Tokens is not nil.
func (v *GetReplicationMessagesRequest) IsSetTokens() bool {
	return v != nil && v.Tokens != nil
}

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

	return
}

// IsSetClusterName returns true if ClusterName is not nil.
func (v *GetReplicationMessagesRequest) IsSetClusterName() bool {
	return v != nil && v.ClusterName != nil
}

type GetReplicationMessagesResponse struct {
	MessagesByShard map[int32]*ReplicationMessages `json:"messagesByShard,omitempty"`
}

type _Map_I32_ReplicationMessages_MapItemList map[int32]*ReplicationMessages

func (m _Map_I32_ReplicationMessages_MapItemList) ForEach(f func(wire.MapItem) error) error {
	for k, v := range m {
		if v == nil {
			return fmt.Errorf("invalid map 'map[int32]*ReplicationMessages', key [%v]: value is nil", k)
		}
		kw, err := wire.NewValueI32(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_I32_ReplicationMessages_MapItemList) Size() int {
	return len(m)
}

func (_Map_I32_ReplicationMessages_MapItemList) KeyType() wire.Type {
	return wire.TI32
}

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

func (_Map_I32_ReplicationMessages_MapItemList) Close() {}

// ToWire translates a GetReplicationMessagesResponse 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 *GetReplicationMessagesResponse) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.MessagesByShard != nil {
		w, err = wire.NewValueMap(_Map_I32_ReplicationMessages_MapItemList(v.MessagesByShard)), 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_I32_ReplicationMessages_Read(m wire.MapItemList) (map[int32]*ReplicationMessages, error) {
	if m.KeyType() != wire.TI32 {
		return nil, nil
	}

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

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

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

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

// FromWire deserializes a GetReplicationMessagesResponse 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 GetReplicationMessagesResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v GetReplicationMessagesResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *GetReplicationMessagesResponse) 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.MessagesByShard, err = _Map_I32_ReplicationMessages_Read(field.Value.GetMap())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

func _Map_I32_ReplicationMessages_Encode(val map[int32]*ReplicationMessages, sw stream.Writer) error {

	mh := stream.MapHeader{
		KeyType:   wire.TI32,
		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[int32]*ReplicationMessages', key [%v]: value is nil", k)
		}
		if err := sw.WriteInt32(k); err != nil {
			return err
		}
		if err := v.Encode(sw); err != nil {
			return err
		}
	}

	return sw.WriteMapEnd()
}

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

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

	return sw.WriteStructEnd()
}

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

	if mh.KeyType != wire.TI32 || 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[int32]*ReplicationMessages, mh.Length)
	for i := 0; i < mh.Length; i++ {
		k, err := sr.ReadInt32()
		if err != nil {
			return nil, err
		}

		v, err := _ReplicationMessages_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 GetReplicationMessagesResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a GetReplicationMessagesResponse struct could not be generated from the wire
// representation.
func (v *GetReplicationMessagesResponse) 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.MessagesByShard, err = _Map_I32_ReplicationMessages_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 GetReplicationMessagesResponse
// struct.
func (v *GetReplicationMessagesResponse) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

func _Map_I32_ReplicationMessages_Equals(lhs, rhs map[int32]*ReplicationMessages) 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 GetReplicationMessagesResponse match the
// provided GetReplicationMessagesResponse.
//
// This function performs a deep comparison.
func (v *GetReplicationMessagesResponse) Equals(rhs *GetReplicationMessagesResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.MessagesByShard == nil && rhs.MessagesByShard == nil) || (v.MessagesByShard != nil && rhs.MessagesByShard != nil && _Map_I32_ReplicationMessages_Equals(v.MessagesByShard, rhs.MessagesByShard))) {
		return false
	}

	return true
}

type _Map_I32_ReplicationMessages_Item_Zapper struct {
	Key   int32
	Value *ReplicationMessages
}

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _Map_I32_ReplicationMessages_Item_Zapper.
func (v _Map_I32_ReplicationMessages_Item_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	enc.AddInt32("key", v.Key)
	err = multierr.Append(err, enc.AddObject("value", v.Value))
	return err
}

type _Map_I32_ReplicationMessages_Zapper map[int32]*ReplicationMessages

// MarshalLogArray implements zapcore.ArrayMarshaler, enabling
// fast logging of _Map_I32_ReplicationMessages_Zapper.
func (m _Map_I32_ReplicationMessages_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for k, v := range m {
		err = multierr.Append(err, enc.AppendObject(_Map_I32_ReplicationMessages_Item_Zapper{Key: k, Value: v}))
	}
	return err
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of GetReplicationMessagesResponse.
func (v *GetReplicationMessagesResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.MessagesByShard != nil {
		err = multierr.Append(err, enc.AddArray("messagesByShard", (_Map_I32_ReplicationMessages_Zapper)(v.MessagesByShard)))
	}
	return err
}

// GetMessagesByShard returns the value of MessagesByShard if it is set or its
// zero value if it is unset.
func (v *GetReplicationMessagesResponse) GetMessagesByShard() (o map[int32]*ReplicationMessages) {
	if v != nil && v.MessagesByShard != nil {
		return v.MessagesByShard
	}

	return
}

// IsSetMessagesByShard returns true if MessagesByShard is not nil.
func (v *GetReplicationMessagesResponse) IsSetMessagesByShard() bool {
	return v != nil && v.MessagesByShard != nil
}

type HistoryTaskV2Attributes struct {
	TaskId              *int64                       `json:"taskId,omitempty"`
	DomainId            *string                      `json:"domainId,omitempty"`
	WorkflowId          *string                      `json:"workflowId,omitempty"`
	RunId               *string                      `json:"runId,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 HistoryTaskV2Attributes 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 *HistoryTaskV2Attributes) ToWire() (wire.Value, error) {
	var (
		fields [7]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.TaskId != nil {
		w, err = wire.NewValueI64(*(v.TaskId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 5, Value: w}
		i++
	}
	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.VersionHistoryItems != nil {
		w, err = wire.NewValueList(_List_VersionHistoryItem_ValueList(v.VersionHistoryItems)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.Events != nil {
		w, err = v.Events.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.NewRunEvents != nil {
		w, err = v.NewRunEvents.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, 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
}

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 HistoryTaskV2Attributes 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 HistoryTaskV2Attributes struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v HistoryTaskV2Attributes
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *HistoryTaskV2Attributes) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 5:
			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 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.TList {
				v.VersionHistoryItems, err = _List_VersionHistoryItem_Read(field.Value.GetList())
				if err != nil {
					return err
				}

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

			}
		case 70:
			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 HistoryTaskV2Attributes struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a HistoryTaskV2Attributes struct could not be encoded.
func (v *HistoryTaskV2Attributes) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.TaskId != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 5, 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.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.VersionHistoryItems != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, 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: 50, 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: 70, 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 _VersionHistoryItem_Decode(sr stream.Reader) (*shared.VersionHistoryItem, error) {
	var v shared.VersionHistoryItem
	err := v.Decode(sr)
	return &v, err
}

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 HistoryTaskV2Attributes struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a HistoryTaskV2Attributes struct could not be generated from the wire
// representation.
func (v *HistoryTaskV2Attributes) 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 == 5 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.TaskId = &x
			if err != nil {
				return err
			}

		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.TList:
			v.VersionHistoryItems, err = _List_VersionHistoryItem_Decode(sr)
			if err != nil {
				return err
			}

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

		case fh.ID == 70 && 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 HistoryTaskV2Attributes
// struct.
func (v *HistoryTaskV2Attributes) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [7]string
	i := 0
	if v.TaskId != nil {
		fields[i] = fmt.Sprintf("TaskId: %v", *(v.TaskId))
		i++
	}
	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.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("HistoryTaskV2Attributes{%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 HistoryTaskV2Attributes match the
// provided HistoryTaskV2Attributes.
//
// This function performs a deep comparison.
func (v *HistoryTaskV2Attributes) Equals(rhs *HistoryTaskV2Attributes) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_I64_EqualsPtr(v.TaskId, rhs.TaskId) {
		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 !((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 HistoryTaskV2Attributes.
func (v *HistoryTaskV2Attributes) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.TaskId != nil {
		enc.AddInt64("taskId", *v.TaskId)
	}
	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.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
}

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

	return
}

// IsSetTaskId returns true if TaskId is not nil.
func (v *HistoryTaskV2Attributes) IsSetTaskId() bool {
	return v != nil && v.TaskId != nil
}

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

	return
}

// IsSetDomainId returns true if DomainId is not nil.
func (v *HistoryTaskV2Attributes) 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 *HistoryTaskV2Attributes) GetWorkflowId() (o string) {
	if v != nil && v.WorkflowId != nil {
		return *v.WorkflowId
	}

	return
}

// IsSetWorkflowId returns true if WorkflowId is not nil.
func (v *HistoryTaskV2Attributes) 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 *HistoryTaskV2Attributes) GetRunId() (o string) {
	if v != nil && v.RunId != nil {
		return *v.RunId
	}

	return
}

// IsSetRunId returns true if RunId is not nil.
func (v *HistoryTaskV2Attributes) IsSetRunId() bool {
	return v != nil && v.RunId != nil
}

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

	return
}

// IsSetVersionHistoryItems returns true if VersionHistoryItems is not nil.
func (v *HistoryTaskV2Attributes) 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 *HistoryTaskV2Attributes) GetEvents() (o *shared.DataBlob) {
	if v != nil && v.Events != nil {
		return v.Events
	}

	return
}

// IsSetEvents returns true if Events is not nil.
func (v *HistoryTaskV2Attributes) 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 *HistoryTaskV2Attributes) GetNewRunEvents() (o *shared.DataBlob) {
	if v != nil && v.NewRunEvents != nil {
		return v.NewRunEvents
	}

	return
}

// IsSetNewRunEvents returns true if NewRunEvents is not nil.
func (v *HistoryTaskV2Attributes) IsSetNewRunEvents() bool {
	return v != nil && v.NewRunEvents != nil
}

type MergeDLQMessagesRequest struct {
	Type                  *DLQType `json:"type,omitempty"`
	ShardID               *int32   `json:"shardID,omitempty"`
	SourceCluster         *string  `json:"sourceCluster,omitempty"`
	InclusiveEndMessageID *int64   `json:"inclusiveEndMessageID,omitempty"`
	MaximumPageSize       *int32   `json:"maximumPageSize,omitempty"`
	NextPageToken         []byte   `json:"nextPageToken,omitempty"`
}

// ToWire translates a MergeDLQMessagesRequest 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 *MergeDLQMessagesRequest) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Type != nil {
		w, err = v.Type.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ShardID != nil {
		w, err = wire.NewValueI32(*(v.ShardID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.SourceCluster != nil {
		w, err = wire.NewValueString(*(v.SourceCluster)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.InclusiveEndMessageID != nil {
		w, err = wire.NewValueI64(*(v.InclusiveEndMessageID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.MaximumPageSize != nil {
		w, err = wire.NewValueI32(*(v.MaximumPageSize)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.NextPageToken != nil {
		w, err = wire.NewValueBinary(v.NextPageToken), 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
}

func _DLQType_Read(w wire.Value) (DLQType, error) {
	var v DLQType
	err := v.FromWire(w)
	return v, err
}

// FromWire deserializes a MergeDLQMessagesRequest 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 MergeDLQMessagesRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v MergeDLQMessagesRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *MergeDLQMessagesRequest) 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 DLQType
				x, err = _DLQType_Read(field.Value)
				v.Type = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.ShardID = &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.SourceCluster = &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.InclusiveEndMessageID = &x
				if err != nil {
					return err
				}

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

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

			}
		}
	}

	return nil
}

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

	if v.Type != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TI32}); err != nil {
			return err
		}
		if err := v.Type.Encode(sw); 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.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.ShardID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.SourceCluster != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, 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.InclusiveEndMessageID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.InclusiveEndMessageID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

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

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

	return sw.WriteStructEnd()
}

func _DLQType_Decode(sr stream.Reader) (DLQType, error) {
	var v DLQType
	err := v.Decode(sr)
	return v, err
}

// Decode deserializes a MergeDLQMessagesRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a MergeDLQMessagesRequest struct could not be generated from the wire
// representation.
func (v *MergeDLQMessagesRequest) 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 DLQType
			x, err = _DLQType_Decode(sr)
			v.Type = &x
			if err != nil {
				return err
			}

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

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

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

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

		case fh.ID == 60 && fh.Type == wire.TBinary:
			v.NextPageToken, 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 MergeDLQMessagesRequest
// struct.
func (v *MergeDLQMessagesRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.Type != nil {
		fields[i] = fmt.Sprintf("Type: %v", *(v.Type))
		i++
	}
	if v.ShardID != nil {
		fields[i] = fmt.Sprintf("ShardID: %v", *(v.ShardID))
		i++
	}
	if v.SourceCluster != nil {
		fields[i] = fmt.Sprintf("SourceCluster: %v", *(v.SourceCluster))
		i++
	}
	if v.InclusiveEndMessageID != nil {
		fields[i] = fmt.Sprintf("InclusiveEndMessageID: %v", *(v.InclusiveEndMessageID))
		i++
	}
	if v.MaximumPageSize != nil {
		fields[i] = fmt.Sprintf("MaximumPageSize: %v", *(v.MaximumPageSize))
		i++
	}
	if v.NextPageToken != nil {
		fields[i] = fmt.Sprintf("NextPageToken: %v", v.NextPageToken)
		i++
	}

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

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

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

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 MergeDLQMessagesRequest match the
// provided MergeDLQMessagesRequest.
//
// This function performs a deep comparison.
func (v *MergeDLQMessagesRequest) Equals(rhs *MergeDLQMessagesRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_DLQType_EqualsPtr(v.Type, rhs.Type) {
		return false
	}
	if !_I32_EqualsPtr(v.ShardID, rhs.ShardID) {
		return false
	}
	if !_String_EqualsPtr(v.SourceCluster, rhs.SourceCluster) {
		return false
	}
	if !_I64_EqualsPtr(v.InclusiveEndMessageID, rhs.InclusiveEndMessageID) {
		return false
	}
	if !_I32_EqualsPtr(v.MaximumPageSize, rhs.MaximumPageSize) {
		return false
	}
	if !((v.NextPageToken == nil && rhs.NextPageToken == nil) || (v.NextPageToken != nil && rhs.NextPageToken != nil && bytes.Equal(v.NextPageToken, rhs.NextPageToken))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of MergeDLQMessagesRequest.
func (v *MergeDLQMessagesRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Type != nil {
		err = multierr.Append(err, enc.AddObject("type", *v.Type))
	}
	if v.ShardID != nil {
		enc.AddInt32("shardID", *v.ShardID)
	}
	if v.SourceCluster != nil {
		enc.AddString("sourceCluster", *v.SourceCluster)
	}
	if v.InclusiveEndMessageID != nil {
		enc.AddInt64("inclusiveEndMessageID", *v.InclusiveEndMessageID)
	}
	if v.MaximumPageSize != nil {
		enc.AddInt32("maximumPageSize", *v.MaximumPageSize)
	}
	if v.NextPageToken != nil {
		enc.AddString("nextPageToken", base64.StdEncoding.EncodeToString(v.NextPageToken))
	}
	return err
}

// GetType returns the value of Type if it is set or its
// zero value if it is unset.
func (v *MergeDLQMessagesRequest) GetType() (o DLQType) {
	if v != nil && v.Type != nil {
		return *v.Type
	}

	return
}

// IsSetType returns true if Type is not nil.
func (v *MergeDLQMessagesRequest) IsSetType() bool {
	return v != nil && v.Type != nil
}

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

	return
}

// IsSetShardID returns true if ShardID is not nil.
func (v *MergeDLQMessagesRequest) IsSetShardID() bool {
	return v != nil && v.ShardID != nil
}

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

	return
}

// IsSetSourceCluster returns true if SourceCluster is not nil.
func (v *MergeDLQMessagesRequest) IsSetSourceCluster() bool {
	return v != nil && v.SourceCluster != nil
}

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

	return
}

// IsSetInclusiveEndMessageID returns true if InclusiveEndMessageID is not nil.
func (v *MergeDLQMessagesRequest) IsSetInclusiveEndMessageID() bool {
	return v != nil && v.InclusiveEndMessageID != nil
}

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

	return
}

// IsSetMaximumPageSize returns true if MaximumPageSize is not nil.
func (v *MergeDLQMessagesRequest) IsSetMaximumPageSize() bool {
	return v != nil && v.MaximumPageSize != nil
}

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

	return
}

// IsSetNextPageToken returns true if NextPageToken is not nil.
func (v *MergeDLQMessagesRequest) IsSetNextPageToken() bool {
	return v != nil && v.NextPageToken != nil
}

type MergeDLQMessagesResponse struct {
	NextPageToken []byte `json:"nextPageToken,omitempty"`
}

// ToWire translates a MergeDLQMessagesResponse 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 *MergeDLQMessagesResponse) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.NextPageToken != nil {
		w, err = wire.NewValueBinary(v.NextPageToken), 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 MergeDLQMessagesResponse 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 MergeDLQMessagesResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v MergeDLQMessagesResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *MergeDLQMessagesResponse) 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 {
				v.NextPageToken, err = field.Value.GetBinary(), error(nil)
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

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

	return sw.WriteStructEnd()
}

// Decode deserializes a MergeDLQMessagesResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a MergeDLQMessagesResponse struct could not be generated from the wire
// representation.
func (v *MergeDLQMessagesResponse) 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:
			v.NextPageToken, 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 MergeDLQMessagesResponse
// struct.
func (v *MergeDLQMessagesResponse) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

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

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of MergeDLQMessagesResponse.
func (v *MergeDLQMessagesResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.NextPageToken != nil {
		enc.AddString("nextPageToken", base64.StdEncoding.EncodeToString(v.NextPageToken))
	}
	return err
}

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

	return
}

// IsSetNextPageToken returns true if NextPageToken is not nil.
func (v *MergeDLQMessagesResponse) IsSetNextPageToken() bool {
	return v != nil && v.NextPageToken != nil
}

type PurgeDLQMessagesRequest struct {
	Type                  *DLQType `json:"type,omitempty"`
	ShardID               *int32   `json:"shardID,omitempty"`
	SourceCluster         *string  `json:"sourceCluster,omitempty"`
	InclusiveEndMessageID *int64   `json:"inclusiveEndMessageID,omitempty"`
}

// ToWire translates a PurgeDLQMessagesRequest 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 *PurgeDLQMessagesRequest) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Type != nil {
		w, err = v.Type.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ShardID != nil {
		w, err = wire.NewValueI32(*(v.ShardID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.SourceCluster != nil {
		w, err = wire.NewValueString(*(v.SourceCluster)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.InclusiveEndMessageID != nil {
		w, err = wire.NewValueI64(*(v.InclusiveEndMessageID)), 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 PurgeDLQMessagesRequest 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 PurgeDLQMessagesRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v PurgeDLQMessagesRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *PurgeDLQMessagesRequest) 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 DLQType
				x, err = _DLQType_Read(field.Value)
				v.Type = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.ShardID = &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.SourceCluster = &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.InclusiveEndMessageID = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

	if v.Type != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TI32}); err != nil {
			return err
		}
		if err := v.Type.Encode(sw); 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.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.ShardID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.SourceCluster != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, 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.InclusiveEndMessageID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.InclusiveEndMessageID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a PurgeDLQMessagesRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a PurgeDLQMessagesRequest struct could not be generated from the wire
// representation.
func (v *PurgeDLQMessagesRequest) 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 DLQType
			x, err = _DLQType_Decode(sr)
			v.Type = &x
			if err != nil {
				return err
			}

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

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

		case fh.ID == 40 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.InclusiveEndMessageID = &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 PurgeDLQMessagesRequest
// struct.
func (v *PurgeDLQMessagesRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.Type != nil {
		fields[i] = fmt.Sprintf("Type: %v", *(v.Type))
		i++
	}
	if v.ShardID != nil {
		fields[i] = fmt.Sprintf("ShardID: %v", *(v.ShardID))
		i++
	}
	if v.SourceCluster != nil {
		fields[i] = fmt.Sprintf("SourceCluster: %v", *(v.SourceCluster))
		i++
	}
	if v.InclusiveEndMessageID != nil {
		fields[i] = fmt.Sprintf("InclusiveEndMessageID: %v", *(v.InclusiveEndMessageID))
		i++
	}

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

// Equals returns true if all the fields of this PurgeDLQMessagesRequest match the
// provided PurgeDLQMessagesRequest.
//
// This function performs a deep comparison.
func (v *PurgeDLQMessagesRequest) Equals(rhs *PurgeDLQMessagesRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_DLQType_EqualsPtr(v.Type, rhs.Type) {
		return false
	}
	if !_I32_EqualsPtr(v.ShardID, rhs.ShardID) {
		return false
	}
	if !_String_EqualsPtr(v.SourceCluster, rhs.SourceCluster) {
		return false
	}
	if !_I64_EqualsPtr(v.InclusiveEndMessageID, rhs.InclusiveEndMessageID) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of PurgeDLQMessagesRequest.
func (v *PurgeDLQMessagesRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Type != nil {
		err = multierr.Append(err, enc.AddObject("type", *v.Type))
	}
	if v.ShardID != nil {
		enc.AddInt32("shardID", *v.ShardID)
	}
	if v.SourceCluster != nil {
		enc.AddString("sourceCluster", *v.SourceCluster)
	}
	if v.InclusiveEndMessageID != nil {
		enc.AddInt64("inclusiveEndMessageID", *v.InclusiveEndMessageID)
	}
	return err
}

// GetType returns the value of Type if it is set or its
// zero value if it is unset.
func (v *PurgeDLQMessagesRequest) GetType() (o DLQType) {
	if v != nil && v.Type != nil {
		return *v.Type
	}

	return
}

// IsSetType returns true if Type is not nil.
func (v *PurgeDLQMessagesRequest) IsSetType() bool {
	return v != nil && v.Type != nil
}

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

	return
}

// IsSetShardID returns true if ShardID is not nil.
func (v *PurgeDLQMessagesRequest) IsSetShardID() bool {
	return v != nil && v.ShardID != nil
}

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

	return
}

// IsSetSourceCluster returns true if SourceCluster is not nil.
func (v *PurgeDLQMessagesRequest) IsSetSourceCluster() bool {
	return v != nil && v.SourceCluster != nil
}

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

	return
}

// IsSetInclusiveEndMessageID returns true if InclusiveEndMessageID is not nil.
func (v *PurgeDLQMessagesRequest) IsSetInclusiveEndMessageID() bool {
	return v != nil && v.InclusiveEndMessageID != nil
}

type ReadDLQMessagesRequest struct {
	Type                  *DLQType `json:"type,omitempty"`
	ShardID               *int32   `json:"shardID,omitempty"`
	SourceCluster         *string  `json:"sourceCluster,omitempty"`
	InclusiveEndMessageID *int64   `json:"inclusiveEndMessageID,omitempty"`
	MaximumPageSize       *int32   `json:"maximumPageSize,omitempty"`
	NextPageToken         []byte   `json:"nextPageToken,omitempty"`
}

// ToWire translates a ReadDLQMessagesRequest 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 *ReadDLQMessagesRequest) ToWire() (wire.Value, error) {
	var (
		fields [6]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Type != nil {
		w, err = v.Type.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ShardID != nil {
		w, err = wire.NewValueI32(*(v.ShardID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.SourceCluster != nil {
		w, err = wire.NewValueString(*(v.SourceCluster)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.InclusiveEndMessageID != nil {
		w, err = wire.NewValueI64(*(v.InclusiveEndMessageID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.MaximumPageSize != nil {
		w, err = wire.NewValueI32(*(v.MaximumPageSize)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.NextPageToken != nil {
		w, err = wire.NewValueBinary(v.NextPageToken), 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 ReadDLQMessagesRequest 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 ReadDLQMessagesRequest struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReadDLQMessagesRequest
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReadDLQMessagesRequest) 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 DLQType
				x, err = _DLQType_Read(field.Value)
				v.Type = &x
				if err != nil {
					return err
				}

			}
		case 20:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.ShardID = &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.SourceCluster = &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.InclusiveEndMessageID = &x
				if err != nil {
					return err
				}

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

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

			}
		}
	}

	return nil
}

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

	if v.Type != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, Type: wire.TI32}); err != nil {
			return err
		}
		if err := v.Type.Encode(sw); 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.TI32}); err != nil {
			return err
		}
		if err := sw.WriteInt32(*(v.ShardID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.SourceCluster != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 30, 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.InclusiveEndMessageID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.InclusiveEndMessageID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

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

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

	return sw.WriteStructEnd()
}

// Decode deserializes a ReadDLQMessagesRequest struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReadDLQMessagesRequest struct could not be generated from the wire
// representation.
func (v *ReadDLQMessagesRequest) 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 DLQType
			x, err = _DLQType_Decode(sr)
			v.Type = &x
			if err != nil {
				return err
			}

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

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

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

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

		case fh.ID == 60 && fh.Type == wire.TBinary:
			v.NextPageToken, 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 ReadDLQMessagesRequest
// struct.
func (v *ReadDLQMessagesRequest) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [6]string
	i := 0
	if v.Type != nil {
		fields[i] = fmt.Sprintf("Type: %v", *(v.Type))
		i++
	}
	if v.ShardID != nil {
		fields[i] = fmt.Sprintf("ShardID: %v", *(v.ShardID))
		i++
	}
	if v.SourceCluster != nil {
		fields[i] = fmt.Sprintf("SourceCluster: %v", *(v.SourceCluster))
		i++
	}
	if v.InclusiveEndMessageID != nil {
		fields[i] = fmt.Sprintf("InclusiveEndMessageID: %v", *(v.InclusiveEndMessageID))
		i++
	}
	if v.MaximumPageSize != nil {
		fields[i] = fmt.Sprintf("MaximumPageSize: %v", *(v.MaximumPageSize))
		i++
	}
	if v.NextPageToken != nil {
		fields[i] = fmt.Sprintf("NextPageToken: %v", v.NextPageToken)
		i++
	}

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

// Equals returns true if all the fields of this ReadDLQMessagesRequest match the
// provided ReadDLQMessagesRequest.
//
// This function performs a deep comparison.
func (v *ReadDLQMessagesRequest) Equals(rhs *ReadDLQMessagesRequest) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_DLQType_EqualsPtr(v.Type, rhs.Type) {
		return false
	}
	if !_I32_EqualsPtr(v.ShardID, rhs.ShardID) {
		return false
	}
	if !_String_EqualsPtr(v.SourceCluster, rhs.SourceCluster) {
		return false
	}
	if !_I64_EqualsPtr(v.InclusiveEndMessageID, rhs.InclusiveEndMessageID) {
		return false
	}
	if !_I32_EqualsPtr(v.MaximumPageSize, rhs.MaximumPageSize) {
		return false
	}
	if !((v.NextPageToken == nil && rhs.NextPageToken == nil) || (v.NextPageToken != nil && rhs.NextPageToken != nil && bytes.Equal(v.NextPageToken, rhs.NextPageToken))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReadDLQMessagesRequest.
func (v *ReadDLQMessagesRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Type != nil {
		err = multierr.Append(err, enc.AddObject("type", *v.Type))
	}
	if v.ShardID != nil {
		enc.AddInt32("shardID", *v.ShardID)
	}
	if v.SourceCluster != nil {
		enc.AddString("sourceCluster", *v.SourceCluster)
	}
	if v.InclusiveEndMessageID != nil {
		enc.AddInt64("inclusiveEndMessageID", *v.InclusiveEndMessageID)
	}
	if v.MaximumPageSize != nil {
		enc.AddInt32("maximumPageSize", *v.MaximumPageSize)
	}
	if v.NextPageToken != nil {
		enc.AddString("nextPageToken", base64.StdEncoding.EncodeToString(v.NextPageToken))
	}
	return err
}

// GetType returns the value of Type if it is set or its
// zero value if it is unset.
func (v *ReadDLQMessagesRequest) GetType() (o DLQType) {
	if v != nil && v.Type != nil {
		return *v.Type
	}

	return
}

// IsSetType returns true if Type is not nil.
func (v *ReadDLQMessagesRequest) IsSetType() bool {
	return v != nil && v.Type != nil
}

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

	return
}

// IsSetShardID returns true if ShardID is not nil.
func (v *ReadDLQMessagesRequest) IsSetShardID() bool {
	return v != nil && v.ShardID != nil
}

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

	return
}

// IsSetSourceCluster returns true if SourceCluster is not nil.
func (v *ReadDLQMessagesRequest) IsSetSourceCluster() bool {
	return v != nil && v.SourceCluster != nil
}

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

	return
}

// IsSetInclusiveEndMessageID returns true if InclusiveEndMessageID is not nil.
func (v *ReadDLQMessagesRequest) IsSetInclusiveEndMessageID() bool {
	return v != nil && v.InclusiveEndMessageID != nil
}

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

	return
}

// IsSetMaximumPageSize returns true if MaximumPageSize is not nil.
func (v *ReadDLQMessagesRequest) IsSetMaximumPageSize() bool {
	return v != nil && v.MaximumPageSize != nil
}

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

	return
}

// IsSetNextPageToken returns true if NextPageToken is not nil.
func (v *ReadDLQMessagesRequest) IsSetNextPageToken() bool {
	return v != nil && v.NextPageToken != nil
}

type ReadDLQMessagesResponse struct {
	Type                 *DLQType               `json:"type,omitempty"`
	ReplicationTasks     []*ReplicationTask     `json:"replicationTasks,omitempty"`
	NextPageToken        []byte                 `json:"nextPageToken,omitempty"`
	ReplicationTasksInfo []*ReplicationTaskInfo `json:"replicationTasksInfo,omitempty"`
}

// ToWire translates a ReadDLQMessagesResponse 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 *ReadDLQMessagesResponse) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Type != nil {
		w, err = v.Type.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ReplicationTasks != nil {
		w, err = wire.NewValueList(_List_ReplicationTask_ValueList(v.ReplicationTasks)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.NextPageToken != nil {
		w, err = wire.NewValueBinary(v.NextPageToken), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.ReplicationTasksInfo != nil {
		w, err = wire.NewValueList(_List_ReplicationTaskInfo_ValueList(v.ReplicationTasksInfo)), 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 ReadDLQMessagesResponse 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 ReadDLQMessagesResponse struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReadDLQMessagesResponse
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReadDLQMessagesResponse) 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 DLQType
				x, err = _DLQType_Read(field.Value)
				v.Type = &x
				if err != nil {
					return err
				}

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

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

			}
		case 40:
			if field.Value.Type() == wire.TList {
				v.ReplicationTasksInfo, err = _List_ReplicationTaskInfo_Read(field.Value.GetList())
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

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

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

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

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

	return sw.WriteStructEnd()
}

// Decode deserializes a ReadDLQMessagesResponse struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReadDLQMessagesResponse struct could not be generated from the wire
// representation.
func (v *ReadDLQMessagesResponse) 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 DLQType
			x, err = _DLQType_Decode(sr)
			v.Type = &x
			if err != nil {
				return err
			}

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

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

		case fh.ID == 40 && fh.Type == wire.TList:
			v.ReplicationTasksInfo, err = _List_ReplicationTaskInfo_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 ReadDLQMessagesResponse
// struct.
func (v *ReadDLQMessagesResponse) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.Type != nil {
		fields[i] = fmt.Sprintf("Type: %v", *(v.Type))
		i++
	}
	if v.ReplicationTasks != nil {
		fields[i] = fmt.Sprintf("ReplicationTasks: %v", v.ReplicationTasks)
		i++
	}
	if v.NextPageToken != nil {
		fields[i] = fmt.Sprintf("NextPageToken: %v", v.NextPageToken)
		i++
	}
	if v.ReplicationTasksInfo != nil {
		fields[i] = fmt.Sprintf("ReplicationTasksInfo: %v", v.ReplicationTasksInfo)
		i++
	}

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

// Equals returns true if all the fields of this ReadDLQMessagesResponse match the
// provided ReadDLQMessagesResponse.
//
// This function performs a deep comparison.
func (v *ReadDLQMessagesResponse) Equals(rhs *ReadDLQMessagesResponse) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_DLQType_EqualsPtr(v.Type, rhs.Type) {
		return false
	}
	if !((v.ReplicationTasks == nil && rhs.ReplicationTasks == nil) || (v.ReplicationTasks != nil && rhs.ReplicationTasks != nil && _List_ReplicationTask_Equals(v.ReplicationTasks, rhs.ReplicationTasks))) {
		return false
	}
	if !((v.NextPageToken == nil && rhs.NextPageToken == nil) || (v.NextPageToken != nil && rhs.NextPageToken != nil && bytes.Equal(v.NextPageToken, rhs.NextPageToken))) {
		return false
	}
	if !((v.ReplicationTasksInfo == nil && rhs.ReplicationTasksInfo == nil) || (v.ReplicationTasksInfo != nil && rhs.ReplicationTasksInfo != nil && _List_ReplicationTaskInfo_Equals(v.ReplicationTasksInfo, rhs.ReplicationTasksInfo))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReadDLQMessagesResponse.
func (v *ReadDLQMessagesResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Type != nil {
		err = multierr.Append(err, enc.AddObject("type", *v.Type))
	}
	if v.ReplicationTasks != nil {
		err = multierr.Append(err, enc.AddArray("replicationTasks", (_List_ReplicationTask_Zapper)(v.ReplicationTasks)))
	}
	if v.NextPageToken != nil {
		enc.AddString("nextPageToken", base64.StdEncoding.EncodeToString(v.NextPageToken))
	}
	if v.ReplicationTasksInfo != nil {
		err = multierr.Append(err, enc.AddArray("replicationTasksInfo", (_List_ReplicationTaskInfo_Zapper)(v.ReplicationTasksInfo)))
	}
	return err
}

// GetType returns the value of Type if it is set or its
// zero value if it is unset.
func (v *ReadDLQMessagesResponse) GetType() (o DLQType) {
	if v != nil && v.Type != nil {
		return *v.Type
	}

	return
}

// IsSetType returns true if Type is not nil.
func (v *ReadDLQMessagesResponse) IsSetType() bool {
	return v != nil && v.Type != nil
}

// GetReplicationTasks returns the value of ReplicationTasks if it is set or its
// zero value if it is unset.
func (v *ReadDLQMessagesResponse) GetReplicationTasks() (o []*ReplicationTask) {
	if v != nil && v.ReplicationTasks != nil {
		return v.ReplicationTasks
	}

	return
}

// IsSetReplicationTasks returns true if ReplicationTasks is not nil.
func (v *ReadDLQMessagesResponse) IsSetReplicationTasks() bool {
	return v != nil && v.ReplicationTasks != nil
}

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

	return
}

// IsSetNextPageToken returns true if NextPageToken is not nil.
func (v *ReadDLQMessagesResponse) IsSetNextPageToken() bool {
	return v != nil && v.NextPageToken != nil
}

// GetReplicationTasksInfo returns the value of ReplicationTasksInfo if it is set or its
// zero value if it is unset.
func (v *ReadDLQMessagesResponse) GetReplicationTasksInfo() (o []*ReplicationTaskInfo) {
	if v != nil && v.ReplicationTasksInfo != nil {
		return v.ReplicationTasksInfo
	}

	return
}

// IsSetReplicationTasksInfo returns true if ReplicationTasksInfo is not nil.
func (v *ReadDLQMessagesResponse) IsSetReplicationTasksInfo() bool {
	return v != nil && v.ReplicationTasksInfo != nil
}

type ReplicationMessages struct {
	ReplicationTasks       []*ReplicationTask `json:"replicationTasks,omitempty"`
	LastRetrievedMessageId *int64             `json:"lastRetrievedMessageId,omitempty"`
	HasMore                *bool              `json:"hasMore,omitempty"`
	SyncShardStatus        *SyncShardStatus   `json:"syncShardStatus,omitempty"`
}

// ToWire translates a ReplicationMessages 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 *ReplicationMessages) ToWire() (wire.Value, error) {
	var (
		fields [4]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ReplicationTasks != nil {
		w, err = wire.NewValueList(_List_ReplicationTask_ValueList(v.ReplicationTasks)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.LastRetrievedMessageId != nil {
		w, err = wire.NewValueI64(*(v.LastRetrievedMessageId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.HasMore != nil {
		w, err = wire.NewValueBool(*(v.HasMore)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	if v.SyncShardStatus != nil {
		w, err = v.SyncShardStatus.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 _SyncShardStatus_Read(w wire.Value) (*SyncShardStatus, error) {
	var v SyncShardStatus
	err := v.FromWire(w)
	return &v, err
}

// FromWire deserializes a ReplicationMessages 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 ReplicationMessages struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReplicationMessages
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReplicationMessages) 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.ReplicationTasks, err = _List_ReplicationTask_Read(field.Value.GetList())
				if err != nil {
					return err
				}

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

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

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

			}
		}
	}

	return nil
}

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

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

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

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

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

	return sw.WriteStructEnd()
}

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

// Decode deserializes a ReplicationMessages struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReplicationMessages struct could not be generated from the wire
// representation.
func (v *ReplicationMessages) 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.ReplicationTasks, err = _List_ReplicationTask_Decode(sr)
			if err != nil {
				return err
			}

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

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

		case fh.ID == 40 && fh.Type == wire.TStruct:
			v.SyncShardStatus, err = _SyncShardStatus_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 ReplicationMessages
// struct.
func (v *ReplicationMessages) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [4]string
	i := 0
	if v.ReplicationTasks != nil {
		fields[i] = fmt.Sprintf("ReplicationTasks: %v", v.ReplicationTasks)
		i++
	}
	if v.LastRetrievedMessageId != nil {
		fields[i] = fmt.Sprintf("LastRetrievedMessageId: %v", *(v.LastRetrievedMessageId))
		i++
	}
	if v.HasMore != nil {
		fields[i] = fmt.Sprintf("HasMore: %v", *(v.HasMore))
		i++
	}
	if v.SyncShardStatus != nil {
		fields[i] = fmt.Sprintf("SyncShardStatus: %v", v.SyncShardStatus)
		i++
	}

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

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 ReplicationMessages match the
// provided ReplicationMessages.
//
// This function performs a deep comparison.
func (v *ReplicationMessages) Equals(rhs *ReplicationMessages) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !((v.ReplicationTasks == nil && rhs.ReplicationTasks == nil) || (v.ReplicationTasks != nil && rhs.ReplicationTasks != nil && _List_ReplicationTask_Equals(v.ReplicationTasks, rhs.ReplicationTasks))) {
		return false
	}
	if !_I64_EqualsPtr(v.LastRetrievedMessageId, rhs.LastRetrievedMessageId) {
		return false
	}
	if !_Bool_EqualsPtr(v.HasMore, rhs.HasMore) {
		return false
	}
	if !((v.SyncShardStatus == nil && rhs.SyncShardStatus == nil) || (v.SyncShardStatus != nil && rhs.SyncShardStatus != nil && v.SyncShardStatus.Equals(rhs.SyncShardStatus))) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReplicationMessages.
func (v *ReplicationMessages) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ReplicationTasks != nil {
		err = multierr.Append(err, enc.AddArray("replicationTasks", (_List_ReplicationTask_Zapper)(v.ReplicationTasks)))
	}
	if v.LastRetrievedMessageId != nil {
		enc.AddInt64("lastRetrievedMessageId", *v.LastRetrievedMessageId)
	}
	if v.HasMore != nil {
		enc.AddBool("hasMore", *v.HasMore)
	}
	if v.SyncShardStatus != nil {
		err = multierr.Append(err, enc.AddObject("syncShardStatus", v.SyncShardStatus))
	}
	return err
}

// GetReplicationTasks returns the value of ReplicationTasks if it is set or its
// zero value if it is unset.
func (v *ReplicationMessages) GetReplicationTasks() (o []*ReplicationTask) {
	if v != nil && v.ReplicationTasks != nil {
		return v.ReplicationTasks
	}

	return
}

// IsSetReplicationTasks returns true if ReplicationTasks is not nil.
func (v *ReplicationMessages) IsSetReplicationTasks() bool {
	return v != nil && v.ReplicationTasks != nil
}

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

	return
}

// IsSetLastRetrievedMessageId returns true if LastRetrievedMessageId is not nil.
func (v *ReplicationMessages) IsSetLastRetrievedMessageId() bool {
	return v != nil && v.LastRetrievedMessageId != nil
}

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

	return
}

// IsSetHasMore returns true if HasMore is not nil.
func (v *ReplicationMessages) IsSetHasMore() bool {
	return v != nil && v.HasMore != nil
}

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

	return
}

// IsSetSyncShardStatus returns true if SyncShardStatus is not nil.
func (v *ReplicationMessages) IsSetSyncShardStatus() bool {
	return v != nil && v.SyncShardStatus != nil
}

type ReplicationTask struct {
	TaskType                      *ReplicationTaskType           `json:"taskType,omitempty"`
	SourceTaskId                  *int64                         `json:"sourceTaskId,omitempty"`
	DomainTaskAttributes          *DomainTaskAttributes          `json:"domainTaskAttributes,omitempty"`
	SyncShardStatusTaskAttributes *SyncShardStatusTaskAttributes `json:"syncShardStatusTaskAttributes,omitempty"`
	SyncActivityTaskAttributes    *SyncActivityTaskAttributes    `json:"syncActivityTaskAttributes,omitempty"`
	HistoryTaskV2Attributes       *HistoryTaskV2Attributes       `json:"historyTaskV2Attributes,omitempty"`
	FailoverMarkerAttributes      *FailoverMarkerAttributes      `json:"failoverMarkerAttributes,omitempty"`
	CreationTime                  *int64                         `json:"creationTime,omitempty"`
}

// ToWire translates a ReplicationTask 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 *ReplicationTask) ToWire() (wire.Value, error) {
	var (
		fields [8]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.TaskType != nil {
		w, err = v.TaskType.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.SourceTaskId != nil {
		w, err = wire.NewValueI64(*(v.SourceTaskId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 11, Value: w}
		i++
	}
	if v.DomainTaskAttributes != nil {
		w, err = v.DomainTaskAttributes.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.SyncShardStatusTaskAttributes != nil {
		w, err = v.SyncShardStatusTaskAttributes.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, Value: w}
		i++
	}
	if v.SyncActivityTaskAttributes != nil {
		w, err = v.SyncActivityTaskAttributes.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 50, Value: w}
		i++
	}
	if v.HistoryTaskV2Attributes != nil {
		w, err = v.HistoryTaskV2Attributes.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, Value: w}
		i++
	}
	if v.FailoverMarkerAttributes != nil {
		w, err = v.FailoverMarkerAttributes.ToWire()
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 80, Value: w}
		i++
	}
	if v.CreationTime != nil {
		w, err = wire.NewValueI64(*(v.CreationTime)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 90, Value: w}
		i++
	}

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

func _ReplicationTaskType_Read(w wire.Value) (ReplicationTaskType, error) {
	var v ReplicationTaskType
	err := v.FromWire(w)
	return v, err
}

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

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

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

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

// FromWire deserializes a ReplicationTask 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 ReplicationTask struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReplicationTask
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReplicationTask) 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 ReplicationTaskType
				x, err = _ReplicationTaskType_Read(field.Value)
				v.TaskType = &x
				if err != nil {
					return err
				}

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

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

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

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

			}
		case 70:
			if field.Value.Type() == wire.TStruct {
				v.HistoryTaskV2Attributes, err = _HistoryTaskV2Attributes_Read(field.Value)
				if err != nil {
					return err
				}

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

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

			}
		}
	}

	return nil
}

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

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

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

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

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

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

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

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

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

	return sw.WriteStructEnd()
}

func _ReplicationTaskType_Decode(sr stream.Reader) (ReplicationTaskType, error) {
	var v ReplicationTaskType
	err := v.Decode(sr)
	return v, err
}

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

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

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

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

// Decode deserializes a ReplicationTask struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReplicationTask struct could not be generated from the wire
// representation.
func (v *ReplicationTask) 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 ReplicationTaskType
			x, err = _ReplicationTaskType_Decode(sr)
			v.TaskType = &x
			if err != nil {
				return err
			}

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

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

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

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

		case fh.ID == 70 && fh.Type == wire.TStruct:
			v.HistoryTaskV2Attributes, err = _HistoryTaskV2Attributes_Decode(sr)
			if err != nil {
				return err
			}

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

		case fh.ID == 90 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.CreationTime = &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 ReplicationTask
// struct.
func (v *ReplicationTask) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [8]string
	i := 0
	if v.TaskType != nil {
		fields[i] = fmt.Sprintf("TaskType: %v", *(v.TaskType))
		i++
	}
	if v.SourceTaskId != nil {
		fields[i] = fmt.Sprintf("SourceTaskId: %v", *(v.SourceTaskId))
		i++
	}
	if v.DomainTaskAttributes != nil {
		fields[i] = fmt.Sprintf("DomainTaskAttributes: %v", v.DomainTaskAttributes)
		i++
	}
	if v.SyncShardStatusTaskAttributes != nil {
		fields[i] = fmt.Sprintf("SyncShardStatusTaskAttributes: %v", v.SyncShardStatusTaskAttributes)
		i++
	}
	if v.SyncActivityTaskAttributes != nil {
		fields[i] = fmt.Sprintf("SyncActivityTaskAttributes: %v", v.SyncActivityTaskAttributes)
		i++
	}
	if v.HistoryTaskV2Attributes != nil {
		fields[i] = fmt.Sprintf("HistoryTaskV2Attributes: %v", v.HistoryTaskV2Attributes)
		i++
	}
	if v.FailoverMarkerAttributes != nil {
		fields[i] = fmt.Sprintf("FailoverMarkerAttributes: %v", v.FailoverMarkerAttributes)
		i++
	}
	if v.CreationTime != nil {
		fields[i] = fmt.Sprintf("CreationTime: %v", *(v.CreationTime))
		i++
	}

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

func _ReplicationTaskType_EqualsPtr(lhs, rhs *ReplicationTaskType) 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 ReplicationTask match the
// provided ReplicationTask.
//
// This function performs a deep comparison.
func (v *ReplicationTask) Equals(rhs *ReplicationTask) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_ReplicationTaskType_EqualsPtr(v.TaskType, rhs.TaskType) {
		return false
	}
	if !_I64_EqualsPtr(v.SourceTaskId, rhs.SourceTaskId) {
		return false
	}
	if !((v.DomainTaskAttributes == nil && rhs.DomainTaskAttributes == nil) || (v.DomainTaskAttributes != nil && rhs.DomainTaskAttributes != nil && v.DomainTaskAttributes.Equals(rhs.DomainTaskAttributes))) {
		return false
	}
	if !((v.SyncShardStatusTaskAttributes == nil && rhs.SyncShardStatusTaskAttributes == nil) || (v.SyncShardStatusTaskAttributes != nil && rhs.SyncShardStatusTaskAttributes != nil && v.SyncShardStatusTaskAttributes.Equals(rhs.SyncShardStatusTaskAttributes))) {
		return false
	}
	if !((v.SyncActivityTaskAttributes == nil && rhs.SyncActivityTaskAttributes == nil) || (v.SyncActivityTaskAttributes != nil && rhs.SyncActivityTaskAttributes != nil && v.SyncActivityTaskAttributes.Equals(rhs.SyncActivityTaskAttributes))) {
		return false
	}
	if !((v.HistoryTaskV2Attributes == nil && rhs.HistoryTaskV2Attributes == nil) || (v.HistoryTaskV2Attributes != nil && rhs.HistoryTaskV2Attributes != nil && v.HistoryTaskV2Attributes.Equals(rhs.HistoryTaskV2Attributes))) {
		return false
	}
	if !((v.FailoverMarkerAttributes == nil && rhs.FailoverMarkerAttributes == nil) || (v.FailoverMarkerAttributes != nil && rhs.FailoverMarkerAttributes != nil && v.FailoverMarkerAttributes.Equals(rhs.FailoverMarkerAttributes))) {
		return false
	}
	if !_I64_EqualsPtr(v.CreationTime, rhs.CreationTime) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReplicationTask.
func (v *ReplicationTask) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.TaskType != nil {
		err = multierr.Append(err, enc.AddObject("taskType", *v.TaskType))
	}
	if v.SourceTaskId != nil {
		enc.AddInt64("sourceTaskId", *v.SourceTaskId)
	}
	if v.DomainTaskAttributes != nil {
		err = multierr.Append(err, enc.AddObject("domainTaskAttributes", v.DomainTaskAttributes))
	}
	if v.SyncShardStatusTaskAttributes != nil {
		err = multierr.Append(err, enc.AddObject("syncShardStatusTaskAttributes", v.SyncShardStatusTaskAttributes))
	}
	if v.SyncActivityTaskAttributes != nil {
		err = multierr.Append(err, enc.AddObject("syncActivityTaskAttributes", v.SyncActivityTaskAttributes))
	}
	if v.HistoryTaskV2Attributes != nil {
		err = multierr.Append(err, enc.AddObject("historyTaskV2Attributes", v.HistoryTaskV2Attributes))
	}
	if v.FailoverMarkerAttributes != nil {
		err = multierr.Append(err, enc.AddObject("failoverMarkerAttributes", v.FailoverMarkerAttributes))
	}
	if v.CreationTime != nil {
		enc.AddInt64("creationTime", *v.CreationTime)
	}
	return err
}

// GetTaskType returns the value of TaskType if it is set or its
// zero value if it is unset.
func (v *ReplicationTask) GetTaskType() (o ReplicationTaskType) {
	if v != nil && v.TaskType != nil {
		return *v.TaskType
	}

	return
}

// IsSetTaskType returns true if TaskType is not nil.
func (v *ReplicationTask) IsSetTaskType() bool {
	return v != nil && v.TaskType != nil
}

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

	return
}

// IsSetSourceTaskId returns true if SourceTaskId is not nil.
func (v *ReplicationTask) IsSetSourceTaskId() bool {
	return v != nil && v.SourceTaskId != nil
}

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

	return
}

// IsSetDomainTaskAttributes returns true if DomainTaskAttributes is not nil.
func (v *ReplicationTask) IsSetDomainTaskAttributes() bool {
	return v != nil && v.DomainTaskAttributes != nil
}

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

	return
}

// IsSetSyncShardStatusTaskAttributes returns true if SyncShardStatusTaskAttributes is not nil.
func (v *ReplicationTask) IsSetSyncShardStatusTaskAttributes() bool {
	return v != nil && v.SyncShardStatusTaskAttributes != nil
}

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

	return
}

// IsSetSyncActivityTaskAttributes returns true if SyncActivityTaskAttributes is not nil.
func (v *ReplicationTask) IsSetSyncActivityTaskAttributes() bool {
	return v != nil && v.SyncActivityTaskAttributes != nil
}

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

	return
}

// IsSetHistoryTaskV2Attributes returns true if HistoryTaskV2Attributes is not nil.
func (v *ReplicationTask) IsSetHistoryTaskV2Attributes() bool {
	return v != nil && v.HistoryTaskV2Attributes != nil
}

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

	return
}

// IsSetFailoverMarkerAttributes returns true if FailoverMarkerAttributes is not nil.
func (v *ReplicationTask) IsSetFailoverMarkerAttributes() bool {
	return v != nil && v.FailoverMarkerAttributes != nil
}

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

	return
}

// IsSetCreationTime returns true if CreationTime is not nil.
func (v *ReplicationTask) IsSetCreationTime() bool {
	return v != nil && v.CreationTime != nil
}

type ReplicationTaskInfo struct {
	DomainID     *string `json:"domainID,omitempty"`
	WorkflowID   *string `json:"workflowID,omitempty"`
	RunID        *string `json:"runID,omitempty"`
	TaskType     *int16  `json:"taskType,omitempty"`
	TaskID       *int64  `json:"taskID,omitempty"`
	Version      *int64  `json:"version,omitempty"`
	FirstEventID *int64  `json:"firstEventID,omitempty"`
	NextEventID  *int64  `json:"nextEventID,omitempty"`
	ScheduledID  *int64  `json:"scheduledID,omitempty"`
}

// ToWire translates a ReplicationTaskInfo 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 *ReplicationTaskInfo) ToWire() (wire.Value, error) {
	var (
		fields [9]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.TaskType != nil {
		w, err = wire.NewValueI16(*(v.TaskType)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 40, 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: 50, 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: 60, Value: w}
		i++
	}
	if v.FirstEventID != nil {
		w, err = wire.NewValueI64(*(v.FirstEventID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 70, 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: 80, 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: 90, Value: w}
		i++
	}

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

// FromWire deserializes a ReplicationTaskInfo 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 ReplicationTaskInfo struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReplicationTaskInfo
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReplicationTaskInfo) 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.TI16 {
				var x int16
				x, err = field.Value.GetI16(), error(nil)
				v.TaskType = &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.TaskID = &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.Version = &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.FirstEventID = &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.NextEventID = &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.ScheduledID = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

// Encode serializes a ReplicationTaskInfo struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a ReplicationTaskInfo struct could not be encoded.
func (v *ReplicationTaskInfo) 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.TaskType != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 40, Type: wire.TI16}); err != nil {
			return err
		}
		if err := sw.WriteInt16(*(v.TaskType)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.TaskID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 50, 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.Version != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 60, 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.FirstEventID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 70, Type: wire.TI64}); err != nil {
			return err
		}
		if err := sw.WriteInt64(*(v.FirstEventID)); err != nil {
			return err
		}
		if err := sw.WriteFieldEnd(); err != nil {
			return err
		}
	}

	if v.NextEventID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 80, 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.ScheduledID != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 90, 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
		}
	}

	return sw.WriteStructEnd()
}

// Decode deserializes a ReplicationTaskInfo struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReplicationTaskInfo struct could not be generated from the wire
// representation.
func (v *ReplicationTaskInfo) 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.TI16:
			var x int16
			x, err = sr.ReadInt16()
			v.TaskType = &x
			if err != nil {
				return err
			}

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

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

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

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

		case fh.ID == 90 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.ScheduledID = &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 ReplicationTaskInfo
// struct.
func (v *ReplicationTaskInfo) String() string {
	if v == nil {
		return "<nil>"
	}

	var fields [9]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.TaskType != nil {
		fields[i] = fmt.Sprintf("TaskType: %v", *(v.TaskType))
		i++
	}
	if v.TaskID != nil {
		fields[i] = fmt.Sprintf("TaskID: %v", *(v.TaskID))
		i++
	}
	if v.Version != nil {
		fields[i] = fmt.Sprintf("Version: %v", *(v.Version))
		i++
	}
	if v.FirstEventID != nil {
		fields[i] = fmt.Sprintf("FirstEventID: %v", *(v.FirstEventID))
		i++
	}
	if v.NextEventID != nil {
		fields[i] = fmt.Sprintf("NextEventID: %v", *(v.NextEventID))
		i++
	}
	if v.ScheduledID != nil {
		fields[i] = fmt.Sprintf("ScheduledID: %v", *(v.ScheduledID))
		i++
	}

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

func _I16_EqualsPtr(lhs, rhs *int16) 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 ReplicationTaskInfo match the
// provided ReplicationTaskInfo.
//
// This function performs a deep comparison.
func (v *ReplicationTaskInfo) Equals(rhs *ReplicationTaskInfo) 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 !_I16_EqualsPtr(v.TaskType, rhs.TaskType) {
		return false
	}
	if !_I64_EqualsPtr(v.TaskID, rhs.TaskID) {
		return false
	}
	if !_I64_EqualsPtr(v.Version, rhs.Version) {
		return false
	}
	if !_I64_EqualsPtr(v.FirstEventID, rhs.FirstEventID) {
		return false
	}
	if !_I64_EqualsPtr(v.NextEventID, rhs.NextEventID) {
		return false
	}
	if !_I64_EqualsPtr(v.ScheduledID, rhs.ScheduledID) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReplicationTaskInfo.
func (v *ReplicationTaskInfo) 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.TaskType != nil {
		enc.AddInt16("taskType", *v.TaskType)
	}
	if v.TaskID != nil {
		enc.AddInt64("taskID", *v.TaskID)
	}
	if v.Version != nil {
		enc.AddInt64("version", *v.Version)
	}
	if v.FirstEventID != nil {
		enc.AddInt64("firstEventID", *v.FirstEventID)
	}
	if v.NextEventID != nil {
		enc.AddInt64("nextEventID", *v.NextEventID)
	}
	if v.ScheduledID != nil {
		enc.AddInt64("scheduledID", *v.ScheduledID)
	}
	return err
}

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

	return
}

// IsSetDomainID returns true if DomainID is not nil.
func (v *ReplicationTaskInfo) 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 *ReplicationTaskInfo) GetWorkflowID() (o string) {
	if v != nil && v.WorkflowID != nil {
		return *v.WorkflowID
	}

	return
}

// IsSetWorkflowID returns true if WorkflowID is not nil.
func (v *ReplicationTaskInfo) 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 *ReplicationTaskInfo) GetRunID() (o string) {
	if v != nil && v.RunID != nil {
		return *v.RunID
	}

	return
}

// IsSetRunID returns true if RunID is not nil.
func (v *ReplicationTaskInfo) IsSetRunID() bool {
	return v != nil && v.RunID != nil
}

// GetTaskType returns the value of TaskType if it is set or its
// zero value if it is unset.
func (v *ReplicationTaskInfo) GetTaskType() (o int16) {
	if v != nil && v.TaskType != nil {
		return *v.TaskType
	}

	return
}

// IsSetTaskType returns true if TaskType is not nil.
func (v *ReplicationTaskInfo) IsSetTaskType() bool {
	return v != nil && v.TaskType != nil
}

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

	return
}

// IsSetTaskID returns true if TaskID is not nil.
func (v *ReplicationTaskInfo) IsSetTaskID() bool {
	return v != nil && v.TaskID != nil
}

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

	return
}

// IsSetVersion returns true if Version is not nil.
func (v *ReplicationTaskInfo) IsSetVersion() bool {
	return v != nil && v.Version != nil
}

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

	return
}

// IsSetFirstEventID returns true if FirstEventID is not nil.
func (v *ReplicationTaskInfo) IsSetFirstEventID() bool {
	return v != nil && v.FirstEventID != nil
}

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

	return
}

// IsSetNextEventID returns true if NextEventID is not nil.
func (v *ReplicationTaskInfo) IsSetNextEventID() bool {
	return v != nil && v.NextEventID != nil
}

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

	return
}

// IsSetScheduledID returns true if ScheduledID is not nil.
func (v *ReplicationTaskInfo) IsSetScheduledID() bool {
	return v != nil && v.ScheduledID != nil
}

type ReplicationTaskType int32

const (
	ReplicationTaskTypeDomain          ReplicationTaskType = 0
	ReplicationTaskTypeHistory         ReplicationTaskType = 1
	ReplicationTaskTypeSyncShardStatus ReplicationTaskType = 2
	ReplicationTaskTypeSyncActivity    ReplicationTaskType = 3
	ReplicationTaskTypeHistoryMetadata ReplicationTaskType = 4
	ReplicationTaskTypeHistoryV2       ReplicationTaskType = 5
	ReplicationTaskTypeFailoverMarker  ReplicationTaskType = 6
)

// ReplicationTaskType_Values returns all recognized values of ReplicationTaskType.
func ReplicationTaskType_Values() []ReplicationTaskType {
	return []ReplicationTaskType{
		ReplicationTaskTypeDomain,
		ReplicationTaskTypeHistory,
		ReplicationTaskTypeSyncShardStatus,
		ReplicationTaskTypeSyncActivity,
		ReplicationTaskTypeHistoryMetadata,
		ReplicationTaskTypeHistoryV2,
		ReplicationTaskTypeFailoverMarker,
	}
}

// UnmarshalText tries to decode ReplicationTaskType from a byte slice
// containing its name.
//
//	var v ReplicationTaskType
//	err := v.UnmarshalText([]byte("Domain"))
func (v *ReplicationTaskType) UnmarshalText(value []byte) error {
	switch s := string(value); s {
	case "Domain":
		*v = ReplicationTaskTypeDomain
		return nil
	case "History":
		*v = ReplicationTaskTypeHistory
		return nil
	case "SyncShardStatus":
		*v = ReplicationTaskTypeSyncShardStatus
		return nil
	case "SyncActivity":
		*v = ReplicationTaskTypeSyncActivity
		return nil
	case "HistoryMetadata":
		*v = ReplicationTaskTypeHistoryMetadata
		return nil
	case "HistoryV2":
		*v = ReplicationTaskTypeHistoryV2
		return nil
	case "FailoverMarker":
		*v = ReplicationTaskTypeFailoverMarker
		return nil
	default:
		val, err := strconv.ParseInt(s, 10, 32)
		if err != nil {
			return fmt.Errorf("unknown enum value %q for %q: %v", s, "ReplicationTaskType", err)
		}
		*v = ReplicationTaskType(val)
		return nil
	}
}

// MarshalText encodes ReplicationTaskType to text.
//
// If the enum value is recognized, its name is returned.
// Otherwise, its integer value is returned.
//
// This implements the TextMarshaler interface.
func (v ReplicationTaskType) MarshalText() ([]byte, error) {
	switch int32(v) {
	case 0:
		return []byte("Domain"), nil
	case 1:
		return []byte("History"), nil
	case 2:
		return []byte("SyncShardStatus"), nil
	case 3:
		return []byte("SyncActivity"), nil
	case 4:
		return []byte("HistoryMetadata"), nil
	case 5:
		return []byte("HistoryV2"), nil
	case 6:
		return []byte("FailoverMarker"), nil
	}
	return []byte(strconv.FormatInt(int64(v), 10)), nil
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReplicationTaskType.
// Enums are logged as objects, where the value is logged with key "value", and
// if this value's name is known, the name is logged with key "name".
func (v ReplicationTaskType) MarshalLogObject(enc zapcore.ObjectEncoder) error {
	enc.AddInt32("value", int32(v))
	switch int32(v) {
	case 0:
		enc.AddString("name", "Domain")
	case 1:
		enc.AddString("name", "History")
	case 2:
		enc.AddString("name", "SyncShardStatus")
	case 3:
		enc.AddString("name", "SyncActivity")
	case 4:
		enc.AddString("name", "HistoryMetadata")
	case 5:
		enc.AddString("name", "HistoryV2")
	case 6:
		enc.AddString("name", "FailoverMarker")
	}
	return nil
}

// Ptr returns a pointer to this enum value.
func (v ReplicationTaskType) Ptr() *ReplicationTaskType {
	return &v
}

// Encode encodes ReplicationTaskType directly to bytes.
//
//	sWriter := BinaryStreamer.Writer(writer)
//
//	var v ReplicationTaskType
//	return v.Encode(sWriter)
func (v ReplicationTaskType) Encode(sw stream.Writer) error {
	return sw.WriteInt32(int32(v))
}

// ToWire translates ReplicationTaskType into a Thrift-level intermediate
// representation. This intermediate representation may be serialized
// into bytes using a ThriftRW protocol implementation.
//
// Enums are represented as 32-bit integers over the wire.
func (v ReplicationTaskType) ToWire() (wire.Value, error) {
	return wire.NewValueI32(int32(v)), nil
}

// FromWire deserializes ReplicationTaskType from its Thrift-level
// representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TI32)
//	if err != nil {
//	  return ReplicationTaskType(0), err
//	}
//
//	var v ReplicationTaskType
//	if err := v.FromWire(x); err != nil {
//	  return ReplicationTaskType(0), err
//	}
//	return v, nil
func (v *ReplicationTaskType) FromWire(w wire.Value) error {
	*v = (ReplicationTaskType)(w.GetI32())
	return nil
}

// Decode reads off the encoded ReplicationTaskType directly off of the wire.
//
//	sReader := BinaryStreamer.Reader(reader)
//
//	var v ReplicationTaskType
//	if err := v.Decode(sReader); err != nil {
//	  return ReplicationTaskType(0), err
//	}
//	return v, nil
func (v *ReplicationTaskType) Decode(sr stream.Reader) error {
	i, err := sr.ReadInt32()
	if err != nil {
		return err
	}
	*v = (ReplicationTaskType)(i)
	return nil
}

// String returns a readable string representation of ReplicationTaskType.
func (v ReplicationTaskType) String() string {
	w := int32(v)
	switch w {
	case 0:
		return "Domain"
	case 1:
		return "History"
	case 2:
		return "SyncShardStatus"
	case 3:
		return "SyncActivity"
	case 4:
		return "HistoryMetadata"
	case 5:
		return "HistoryV2"
	case 6:
		return "FailoverMarker"
	}
	return fmt.Sprintf("ReplicationTaskType(%d)", w)
}

// Equals returns true if this ReplicationTaskType value matches the provided
// value.
func (v ReplicationTaskType) Equals(rhs ReplicationTaskType) bool {
	return v == rhs
}

// MarshalJSON serializes ReplicationTaskType into JSON.
//
// If the enum value is recognized, its name is returned.
// Otherwise, its integer value is returned.
//
// This implements json.Marshaler.
func (v ReplicationTaskType) MarshalJSON() ([]byte, error) {
	switch int32(v) {
	case 0:
		return ([]byte)("\"Domain\""), nil
	case 1:
		return ([]byte)("\"History\""), nil
	case 2:
		return ([]byte)("\"SyncShardStatus\""), nil
	case 3:
		return ([]byte)("\"SyncActivity\""), nil
	case 4:
		return ([]byte)("\"HistoryMetadata\""), nil
	case 5:
		return ([]byte)("\"HistoryV2\""), nil
	case 6:
		return ([]byte)("\"FailoverMarker\""), nil
	}
	return ([]byte)(strconv.FormatInt(int64(v), 10)), nil
}

// UnmarshalJSON attempts to decode ReplicationTaskType from its JSON
// representation.
//
// This implementation supports both, numeric and string inputs. If a
// string is provided, it must be a known enum name.
//
// This implements json.Unmarshaler.
func (v *ReplicationTaskType) UnmarshalJSON(text []byte) error {
	d := json.NewDecoder(bytes.NewReader(text))
	d.UseNumber()
	t, err := d.Token()
	if err != nil {
		return err
	}

	switch w := t.(type) {
	case json.Number:
		x, err := w.Int64()
		if err != nil {
			return err
		}
		if x > math.MaxInt32 {
			return fmt.Errorf("enum overflow from JSON %q for %q", text, "ReplicationTaskType")
		}
		if x < math.MinInt32 {
			return fmt.Errorf("enum underflow from JSON %q for %q", text, "ReplicationTaskType")
		}
		*v = (ReplicationTaskType)(x)
		return nil
	case string:
		return v.UnmarshalText([]byte(w))
	default:
		return fmt.Errorf("invalid JSON value %q (%T) to unmarshal into %q", t, t, "ReplicationTaskType")
	}
}

type ReplicationToken struct {
	ShardID                *int32 `json:"shardID,omitempty"`
	LastRetrievedMessageId *int64 `json:"lastRetrievedMessageId,omitempty"`
	LastProcessedMessageId *int64 `json:"lastProcessedMessageId,omitempty"`
}

// ToWire translates a ReplicationToken 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 *ReplicationToken) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.ShardID != nil {
		w, err = wire.NewValueI32(*(v.ShardID)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.LastRetrievedMessageId != nil {
		w, err = wire.NewValueI64(*(v.LastRetrievedMessageId)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.LastProcessedMessageId != nil {
		w, err = wire.NewValueI64(*(v.LastProcessedMessageId)), 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 ReplicationToken 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 ReplicationToken struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v ReplicationToken
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *ReplicationToken) 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.ShardID = &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.LastRetrievedMessageId = &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.LastProcessedMessageId = &x
				if err != nil {
					return err
				}

			}
		}
	}

	return nil
}

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

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

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

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

	return sw.WriteStructEnd()
}

// Decode deserializes a ReplicationToken struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a ReplicationToken struct could not be generated from the wire
// representation.
func (v *ReplicationToken) 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.ShardID = &x
			if err != nil {
				return err
			}

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

		case fh.ID == 30 && fh.Type == wire.TI64:
			var x int64
			x, err = sr.ReadInt64()
			v.LastProcessedMessageId = &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 ReplicationToken
// struct.
func (v *ReplicationToken) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

// Equals returns true if all the fields of this ReplicationToken match the
// provided ReplicationToken.
//
// This function performs a deep comparison.
func (v *ReplicationToken) Equals(rhs *ReplicationToken) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_I32_EqualsPtr(v.ShardID, rhs.ShardID) {
		return false
	}
	if !_I64_EqualsPtr(v.LastRetrievedMessageId, rhs.LastRetrievedMessageId) {
		return false
	}
	if !_I64_EqualsPtr(v.LastProcessedMessageId, rhs.LastProcessedMessageId) {
		return false
	}

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of ReplicationToken.
func (v *ReplicationToken) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ShardID != nil {
		enc.AddInt32("shardID", *v.ShardID)
	}
	if v.LastRetrievedMessageId != nil {
		enc.AddInt64("lastRetrievedMessageId", *v.LastRetrievedMessageId)
	}
	if v.LastProcessedMessageId != nil {
		enc.AddInt64("lastProcessedMessageId", *v.LastProcessedMessageId)
	}
	return err
}

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

	return
}

// IsSetShardID returns true if ShardID is not nil.
func (v *ReplicationToken) IsSetShardID() bool {
	return v != nil && v.ShardID != nil
}

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

	return
}

// IsSetLastRetrievedMessageId returns true if LastRetrievedMessageId is not nil.
func (v *ReplicationToken) IsSetLastRetrievedMessageId() bool {
	return v != nil && v.LastRetrievedMessageId != nil
}

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

	return
}

// IsSetLastProcessedMessageId returns true if LastProcessedMessageId is not nil.
func (v *ReplicationToken) IsSetLastProcessedMessageId() bool {
	return v != nil && v.LastProcessedMessageId != nil
}

type SyncActivityTaskAttributes 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 SyncActivityTaskAttributes 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 *SyncActivityTaskAttributes) 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 SyncActivityTaskAttributes 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 SyncActivityTaskAttributes struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SyncActivityTaskAttributes
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SyncActivityTaskAttributes) 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 SyncActivityTaskAttributes struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SyncActivityTaskAttributes struct could not be encoded.
func (v *SyncActivityTaskAttributes) 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 SyncActivityTaskAttributes struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SyncActivityTaskAttributes struct could not be generated from the wire
// representation.
func (v *SyncActivityTaskAttributes) 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 SyncActivityTaskAttributes
// struct.
func (v *SyncActivityTaskAttributes) 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("SyncActivityTaskAttributes{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this SyncActivityTaskAttributes match the
// provided SyncActivityTaskAttributes.
//
// This function performs a deep comparison.
func (v *SyncActivityTaskAttributes) Equals(rhs *SyncActivityTaskAttributes) 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 SyncActivityTaskAttributes.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetDomainId() (o string) {
	if v != nil && v.DomainId != nil {
		return *v.DomainId
	}

	return
}

// IsSetDomainId returns true if DomainId is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetWorkflowId() (o string) {
	if v != nil && v.WorkflowId != nil {
		return *v.WorkflowId
	}

	return
}

// IsSetWorkflowId returns true if WorkflowId is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetRunId() (o string) {
	if v != nil && v.RunId != nil {
		return *v.RunId
	}

	return
}

// IsSetRunId returns true if RunId is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetVersion() (o int64) {
	if v != nil && v.Version != nil {
		return *v.Version
	}

	return
}

// IsSetVersion returns true if Version is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetScheduledId() (o int64) {
	if v != nil && v.ScheduledId != nil {
		return *v.ScheduledId
	}

	return
}

// IsSetScheduledId returns true if ScheduledId is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetScheduledTime() (o int64) {
	if v != nil && v.ScheduledTime != nil {
		return *v.ScheduledTime
	}

	return
}

// IsSetScheduledTime returns true if ScheduledTime is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetStartedId() (o int64) {
	if v != nil && v.StartedId != nil {
		return *v.StartedId
	}

	return
}

// IsSetStartedId returns true if StartedId is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetStartedTime() (o int64) {
	if v != nil && v.StartedTime != nil {
		return *v.StartedTime
	}

	return
}

// IsSetStartedTime returns true if StartedTime is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetLastHeartbeatTime() (o int64) {
	if v != nil && v.LastHeartbeatTime != nil {
		return *v.LastHeartbeatTime
	}

	return
}

// IsSetLastHeartbeatTime returns true if LastHeartbeatTime is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetDetails() (o []byte) {
	if v != nil && v.Details != nil {
		return v.Details
	}

	return
}

// IsSetDetails returns true if Details is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetAttempt() (o int32) {
	if v != nil && v.Attempt != nil {
		return *v.Attempt
	}

	return
}

// IsSetAttempt returns true if Attempt is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetLastFailureReason() (o string) {
	if v != nil && v.LastFailureReason != nil {
		return *v.LastFailureReason
	}

	return
}

// IsSetLastFailureReason returns true if LastFailureReason is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetLastWorkerIdentity() (o string) {
	if v != nil && v.LastWorkerIdentity != nil {
		return *v.LastWorkerIdentity
	}

	return
}

// IsSetLastWorkerIdentity returns true if LastWorkerIdentity is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetLastFailureDetails() (o []byte) {
	if v != nil && v.LastFailureDetails != nil {
		return v.LastFailureDetails
	}

	return
}

// IsSetLastFailureDetails returns true if LastFailureDetails is not nil.
func (v *SyncActivityTaskAttributes) 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 *SyncActivityTaskAttributes) GetVersionHistory() (o *shared.VersionHistory) {
	if v != nil && v.VersionHistory != nil {
		return v.VersionHistory
	}

	return
}

// IsSetVersionHistory returns true if VersionHistory is not nil.
func (v *SyncActivityTaskAttributes) IsSetVersionHistory() bool {
	return v != nil && v.VersionHistory != nil
}

type SyncShardStatus struct {
	Timestamp *int64 `json:"timestamp,omitempty"`
}

// ToWire translates a SyncShardStatus 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 *SyncShardStatus) ToWire() (wire.Value, error) {
	var (
		fields [1]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)

	if v.Timestamp != nil {
		w, err = wire.NewValueI64(*(v.Timestamp)), 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 SyncShardStatus 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 SyncShardStatus struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SyncShardStatus
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SyncShardStatus) FromWire(w wire.Value) error {
	var err error

	for _, field := range w.GetStruct().Fields {
		switch field.ID {
		case 10:
			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 SyncShardStatus struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SyncShardStatus struct could not be encoded.
func (v *SyncShardStatus) Encode(sw stream.Writer) error {
	if err := sw.WriteStructBegin(); err != nil {
		return err
	}

	if v.Timestamp != nil {
		if err := sw.WriteFieldBegin(stream.FieldHeader{ID: 10, 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 SyncShardStatus struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SyncShardStatus struct could not be generated from the wire
// representation.
func (v *SyncShardStatus) 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.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 SyncShardStatus
// struct.
func (v *SyncShardStatus) String() string {
	if v == nil {
		return "<nil>"
	}

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

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

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

	return true
}

// MarshalLogObject implements zapcore.ObjectMarshaler, enabling
// fast logging of SyncShardStatus.
func (v *SyncShardStatus) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Timestamp != nil {
		enc.AddInt64("timestamp", *v.Timestamp)
	}
	return err
}

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

	return
}

// IsSetTimestamp returns true if Timestamp is not nil.
func (v *SyncShardStatus) IsSetTimestamp() bool {
	return v != nil && v.Timestamp != nil
}

type SyncShardStatusTaskAttributes struct {
	SourceCluster *string `json:"sourceCluster,omitempty"`
	ShardId       *int64  `json:"shardId,omitempty"`
	Timestamp     *int64  `json:"timestamp,omitempty"`
}

// ToWire translates a SyncShardStatusTaskAttributes 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 *SyncShardStatusTaskAttributes) 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 SyncShardStatusTaskAttributes 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 SyncShardStatusTaskAttributes struct
// from the provided intermediate representation.
//
//	x, err := binaryProtocol.Decode(reader, wire.TStruct)
//	if err != nil {
//	  return nil, err
//	}
//
//	var v SyncShardStatusTaskAttributes
//	if err := v.FromWire(x); err != nil {
//	  return nil, err
//	}
//	return &v, nil
func (v *SyncShardStatusTaskAttributes) 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 SyncShardStatusTaskAttributes struct directly into bytes, without going
// through an intermediary type.
//
// An error is returned if a SyncShardStatusTaskAttributes struct could not be encoded.
func (v *SyncShardStatusTaskAttributes) 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 SyncShardStatusTaskAttributes struct directly from its Thrift-level
// representation, without going through an intemediary type.
//
// An error is returned if a SyncShardStatusTaskAttributes struct could not be generated from the wire
// representation.
func (v *SyncShardStatusTaskAttributes) 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 SyncShardStatusTaskAttributes
// struct.
func (v *SyncShardStatusTaskAttributes) 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("SyncShardStatusTaskAttributes{%v}", strings.Join(fields[:i], ", "))
}

// Equals returns true if all the fields of this SyncShardStatusTaskAttributes match the
// provided SyncShardStatusTaskAttributes.
//
// This function performs a deep comparison.
func (v *SyncShardStatusTaskAttributes) Equals(rhs *SyncShardStatusTaskAttributes) 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 SyncShardStatusTaskAttributes.
func (v *SyncShardStatusTaskAttributes) 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 *SyncShardStatusTaskAttributes) GetSourceCluster() (o string) {
	if v != nil && v.SourceCluster != nil {
		return *v.SourceCluster
	}

	return
}

// IsSetSourceCluster returns true if SourceCluster is not nil.
func (v *SyncShardStatusTaskAttributes) 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 *SyncShardStatusTaskAttributes) GetShardId() (o int64) {
	if v != nil && v.ShardId != nil {
		return *v.ShardId
	}

	return
}

// IsSetShardId returns true if ShardId is not nil.
func (v *SyncShardStatusTaskAttributes) 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 *SyncShardStatusTaskAttributes) GetTimestamp() (o int64) {
	if v != nil && v.Timestamp != nil {
		return *v.Timestamp
	}

	return
}

// IsSetTimestamp returns true if Timestamp is not nil.
func (v *SyncShardStatusTaskAttributes) IsSetTimestamp() bool {
	return v != nil && v.Timestamp != nil
}

// ThriftModule represents the IDL file used to generate this package.
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "replicator",
	Package:  "github.com/uber/cadence/.gen/go/replicator",
	FilePath: "replicator.thrift",
	SHA1:     "5511dc1dfc4b6025f16d77cac580134c62303bd6",
	Includes: []*thriftreflect.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\nnamespace java com.uber.cadence.replicator\n\ninclude \"shared.thrift\"\n\nenum ReplicationTaskType {\n  Domain\n  History\n  SyncShardStatus\n  SyncActivity\n  HistoryMetadata\n  HistoryV2\n  FailoverMarker\n}\n\nenum DomainOperation {\n  Create\n  Update\n  Delete\n}\n\nstruct DomainTaskAttributes {\n  05: optional DomainOperation domainOperation\n  10: optional string id\n  20: optional shared.DomainInfo info\n  30: optional shared.DomainConfiguration config\n  40: optional shared.DomainReplicationConfiguration replicationConfig\n  50: optional i64 (js.type = \"Long\") configVersion\n  60: optional i64 (js.type = \"Long\") failoverVersion\n  70: optional i64 (js.type = \"Long\") previousFailoverVersion\n}\n\nstruct SyncShardStatusTaskAttributes {\n  10: optional string sourceCluster\n  20: optional i64 (js.type = \"Long\") shardId\n  30: optional i64 (js.type = \"Long\") timestamp\n}\n\nstruct SyncActivityTaskAttributes {\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 HistoryTaskV2Attributes {\n  05: optional i64 (js.type = \"Long\") taskId\n  10: optional string domainId\n  20: optional string workflowId\n  30: optional string runId\n  40: optional list<shared.VersionHistoryItem> versionHistoryItems\n  50: optional shared.DataBlob events\n  // new run events does not need version history since there is no prior events\n  70: optional shared.DataBlob newRunEvents\n}\n\nstruct FailoverMarkerAttributes{\n\t10: optional string domainID\n\t20: optional i64 (js.type = \"Long\") failoverVersion\n\t30: optional i64 (js.type = \"Long\") creationTime\n}\n\nstruct FailoverMarkers{\n\t10: optional list<FailoverMarkerAttributes> failoverMarkers\n}\n\nstruct ReplicationTask {\n  10: optional ReplicationTaskType taskType\n  11: optional i64 (js.type = \"Long\") sourceTaskId\n  20: optional DomainTaskAttributes domainTaskAttributes\n  40: optional SyncShardStatusTaskAttributes syncShardStatusTaskAttributes\n  50: optional SyncActivityTaskAttributes syncActivityTaskAttributes\n  70: optional HistoryTaskV2Attributes historyTaskV2Attributes\n  80: optional FailoverMarkerAttributes failoverMarkerAttributes\n  90: optional i64 (js.type = \"Long\") creationTime\n}\n\nstruct ReplicationToken {\n  10: optional i32 shardID\n  // lastRetrivedMessageId is where the next fetch should begin with\n  20: optional i64 (js.type = \"Long\") lastRetrievedMessageId\n  // lastProcessedMessageId is the last messageId that is processed on the passive side.\n  // This can be different than lastRetrievedMessageId if passive side supports prefetching messages.\n  30: optional i64 (js.type = \"Long\") lastProcessedMessageId\n}\n\nstruct SyncShardStatus {\n  10: optional i64 (js.type = \"Long\") timestamp\n}\n\nstruct ReplicationMessages {\n  10: optional list<ReplicationTask> replicationTasks\n  // This can be different than the last taskId in the above list, because sender can decide to skip tasks (e.g. for completed workflows).\n  20: optional i64 (js.type = \"Long\") lastRetrievedMessageId\n  30: optional bool hasMore // Hint for flow control\n  40: optional SyncShardStatus syncShardStatus\n}\n\nstruct ReplicationTaskInfo {\n  10: optional string domainID\n  20: optional string workflowID\n  30: optional string runID\n  40: optional i16 taskType\n  50: optional i64 (js.type = \"Long\") taskID\n  60: optional i64 (js.type = \"Long\") version\n  70: optional i64 (js.type = \"Long\") firstEventID\n  80: optional i64 (js.type = \"Long\") nextEventID\n  90: optional i64 (js.type = \"Long\") scheduledID\n}\n\nstruct GetReplicationMessagesRequest {\n  10: optional list<ReplicationToken> tokens\n  20: optional string clusterName\n}\n\nstruct GetReplicationMessagesResponse {\n  10: optional map<i32, ReplicationMessages> messagesByShard\n}\n\nstruct GetDomainReplicationMessagesRequest {\n  // lastRetrievedMessageId is where the next fetch should begin with\n  10: optional i64 (js.type = \"Long\") lastRetrievedMessageId\n  // lastProcessedMessageId is the last messageId that is processed on the passive side.\n  // This can be different than lastRetrievedMessageId if passive side supports prefetching messages.\n  20: optional i64 (js.type = \"Long\") lastProcessedMessageId\n  // clusterName is the name of the pulling cluster\n  30: optional string clusterName\n}\n\nstruct GetDomainReplicationMessagesResponse {\n  10: optional ReplicationMessages messages\n}\n\nstruct GetDLQReplicationMessagesRequest {\n  10: optional list<ReplicationTaskInfo> taskInfos\n}\n\nstruct GetDLQReplicationMessagesResponse {\n  10: optional list<ReplicationTask> replicationTasks\n}\n\nenum DLQType {\n  Replication,\n  Domain,\n}\n\nstruct ReadDLQMessagesRequest{\n  10: optional DLQType type\n  20: optional i32 shardID\n  30: optional string sourceCluster\n  40: optional i64 (js.type = \"Long\") inclusiveEndMessageID\n  50: optional i32 maximumPageSize\n  60: optional binary nextPageToken\n}\n\nstruct ReadDLQMessagesResponse{\n  10: optional DLQType type\n  20: optional list<ReplicationTask> replicationTasks\n  30: optional binary nextPageToken\n  40: optional list<ReplicationTaskInfo> replicationTasksInfo\n}\n\nstruct PurgeDLQMessagesRequest{\n  10: optional DLQType type\n  20: optional i32 shardID\n  30: optional string sourceCluster\n  40: optional i64 (js.type = \"Long\") inclusiveEndMessageID\n}\n\nstruct MergeDLQMessagesRequest{\n  10: optional DLQType type\n  20: optional i32 shardID\n  30: optional string sourceCluster\n  40: optional i64 (js.type = \"Long\") inclusiveEndMessageID\n  50: optional i32 maximumPageSize\n  60: optional binary nextPageToken\n}\n\nstruct MergeDLQMessagesResponse{\n  10: optional binary nextPageToken\n}\n"
