func (v *ReplayWorkflowActivityResult) IsSetSucceeded() bool {
	return v != nil && v.Succeeded != nil
}
IsSetSucceeded returns true if Succeeded is not nil.
package shadower
import (
	bytes "bytes"
	base64 "encoding/base64"
	json "encoding/json"
	fmt "fmt"
	shared "go.uber.org/cadence/.gen/go/shared"
	multierr "go.uber.org/multierr"
	thriftreflect "go.uber.org/thriftrw/thriftreflect"
	wire "go.uber.org/thriftrw/wire"
	zapcore "go.uber.org/zap/zapcore"
	math "math"
	strconv "strconv"
	strings "strings"
)
const ErrNonRetryableType string = "com.uber.cadence.internal.shadowing.NonRetryableException"
const ErrReasonDomainNotExists string = "domain not exists"
const ErrReasonInvalidQuery string = "invalid visibility query"
const ErrReasonWorkflowTypeNotRegistered string = "workflow type not registered"
const LocalDomainName string = "cadence-shadower"
const ReplayWorkflowActivityName string = "replayWorkflowActivity"
const ScanWorkflowActivityName string = "scanWorkflowActivity"
const TaskList string = "cadence-shadower-tl"
const WorkflowIDSuffix string = "-shadow-workflow"
const WorkflowName string = "cadence-shadow-workflow"
type ExitCondition struct {
	ExpirationIntervalInSeconds *int32 `json:"expirationIntervalInSeconds,omitempty"`
	ShadowCount                 *int32 `json:"shadowCount,omitempty"`
}
func (v *ExitCondition) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)
	if v.ExpirationIntervalInSeconds != nil {
		w, err = wire.NewValueI32(*(v.ExpirationIntervalInSeconds)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.ShadowCount != nil {
		w, err = wire.NewValueI32(*(v.ShadowCount)), 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 (v *ExitCondition) 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.ExpirationIntervalInSeconds = &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.ShadowCount = &x
				if err != nil {
					return err
				}
			}
		}
	}
	return nil
}
func (v *ExitCondition) String() string {
	if v == nil {
		return "<nil>"
	}
	var fields [2]string
	i := 0
	if v.ExpirationIntervalInSeconds != nil {
		fields[i] = fmt.Sprintf("ExpirationIntervalInSeconds: %v", *(v.ExpirationIntervalInSeconds))
		i++
	}
	if v.ShadowCount != nil {
		fields[i] = fmt.Sprintf("ShadowCount: %v", *(v.ShadowCount))
		i++
	}
	return fmt.Sprintf("ExitCondition{%v}", strings.Join(fields[:i], ", "))
}
func _I32_EqualsPtr(lhs, rhs *int32) bool {
	if lhs != nil && rhs != nil {
		x := *lhs
		y := *rhs
		return (x == y)
	}
	return lhs == nil && rhs == nil
}
func (v *ExitCondition) Equals(rhs *ExitCondition) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_I32_EqualsPtr(v.ExpirationIntervalInSeconds, rhs.ExpirationIntervalInSeconds) {
		return false
	}
	if !_I32_EqualsPtr(v.ShadowCount, rhs.ShadowCount) {
		return false
	}
	return true
}
func (v *ExitCondition) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.ExpirationIntervalInSeconds != nil {
		enc.AddInt32("expirationIntervalInSeconds", *v.ExpirationIntervalInSeconds)
	}
	if v.ShadowCount != nil {
		enc.AddInt32("shadowCount", *v.ShadowCount)
	}
	return err
}
func (v *ExitCondition) GetExpirationIntervalInSeconds() (o int32) {
	if v != nil && v.ExpirationIntervalInSeconds != nil {
		return *v.ExpirationIntervalInSeconds
	}
	return
}
func (v *ExitCondition) IsSetExpirationIntervalInSeconds() bool {
	return v != nil && v.ExpirationIntervalInSeconds != nil
}
func (v *ExitCondition) GetShadowCount() (o int32) {
	if v != nil && v.ShadowCount != nil {
		return *v.ShadowCount
	}
	return
}
func (v *ExitCondition) IsSetShadowCount() bool {
	return v != nil && v.ShadowCount != nil
}
type Mode int32
const (
	ModeNormal     Mode = 0
	ModeContinuous Mode = 1
)
func Mode_Values() []Mode {
	return []Mode{
		ModeNormal,
		ModeContinuous,
	}
}
func (v *Mode) UnmarshalText(value []byte) error {
	switch s := string(value); s {
	case "Normal":
		*v = ModeNormal
		return nil
	case "Continuous":
		*v = ModeContinuous
		return nil
	default:
		val, err := strconv.ParseInt(s, 10, 32)
		if err != nil {
			return fmt.Errorf("unknown enum value %q for %q: %v", s, "Mode", err)
		}
		*v = Mode(val)
		return nil
	}
}
func (v Mode) MarshalText() ([]byte, error) {
	switch int32(v) {
	case 0:
		return []byte("Normal"), nil
	case 1:
		return []byte("Continuous"), nil
	}
	return []byte(strconv.FormatInt(int64(v), 10)), nil
}
func (v Mode) MarshalLogObject(enc zapcore.ObjectEncoder) error {
	enc.AddInt32("value", int32(v))
	switch int32(v) {
	case 0:
		enc.AddString("name", "Normal")
	case 1:
		enc.AddString("name", "Continuous")
	}
	return nil
}
func (v Mode) Ptr() *Mode {
	return &v
}
func (v Mode) ToWire() (wire.Value, error) {
	return wire.NewValueI32(int32(v)), nil
}
func (v *Mode) FromWire(w wire.Value) error {
	*v = (Mode)(w.GetI32())
	return nil
}
func (v Mode) String() string {
	w := int32(v)
	switch w {
	case 0:
		return "Normal"
	case 1:
		return "Continuous"
	}
	return fmt.Sprintf("Mode(%d)", w)
}
func (v Mode) Equals(rhs Mode) bool {
	return v == rhs
}
func (v Mode) MarshalJSON() ([]byte, error) {
	switch int32(v) {
	case 0:
		return ([]byte)("\"Normal\""), nil
	case 1:
		return ([]byte)("\"Continuous\""), nil
	}
	return ([]byte)(strconv.FormatInt(int64(v), 10)), nil
}
func (v *Mode) 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, "Mode")
		}
		if x < math.MinInt32 {
			return fmt.Errorf("enum underflow from JSON %q for %q", text, "Mode")
		}
		*v = (Mode)(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, "Mode")
	}
}
type ReplayWorkflowActivityParams struct {
	Domain     *string                     `json:"domain,omitempty"`
	Executions []*shared.WorkflowExecution `json:"executions,omitempty"`
}
type _List_WorkflowExecution_ValueList []*shared.WorkflowExecution
func (v _List_WorkflowExecution_ValueList) ForEach(f func(wire.Value) error) error {
	for i, x := range v {
		if x == nil {
			return fmt.Errorf("invalid [%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_WorkflowExecution_ValueList) Size() int {
	return len(v)
}
func (_List_WorkflowExecution_ValueList) ValueType() wire.Type {
	return wire.TStruct
}
func (_List_WorkflowExecution_ValueList) Close() {}
func (v *ReplayWorkflowActivityParams) ToWire() (wire.Value, error) {
	var (
		fields [2]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)
	if v.Domain != nil {
		w, err = wire.NewValueString(*(v.Domain)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Executions != nil {
		w, err = wire.NewValueList(_List_WorkflowExecution_ValueList(v.Executions)), 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 _WorkflowExecution_Read(w wire.Value) (*shared.WorkflowExecution, error) {
	var v shared.WorkflowExecution
	err := v.FromWire(w)
	return &v, err
}
func _List_WorkflowExecution_Read(l wire.ValueList) ([]*shared.WorkflowExecution, error) {
	if l.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make([]*shared.WorkflowExecution, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _WorkflowExecution_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
func (v *ReplayWorkflowActivityParams) 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.Domain = &x
				if err != nil {
					return err
				}
			}
		case 20:
			if field.Value.Type() == wire.TList {
				v.Executions, err = _List_WorkflowExecution_Read(field.Value.GetList())
				if err != nil {
					return err
				}
			}
		}
	}
	return nil
}
func (v *ReplayWorkflowActivityParams) String() string {
	if v == nil {
		return "<nil>"
	}
	var fields [2]string
	i := 0
	if v.Domain != nil {
		fields[i] = fmt.Sprintf("Domain: %v", *(v.Domain))
		i++
	}
	if v.Executions != nil {
		fields[i] = fmt.Sprintf("Executions: %v", v.Executions)
		i++
	}
	return fmt.Sprintf("ReplayWorkflowActivityParams{%v}", strings.Join(fields[:i], ", "))
}
func _String_EqualsPtr(lhs, rhs *string) bool {
	if lhs != nil && rhs != nil {
		x := *lhs
		y := *rhs
		return (x == y)
	}
	return lhs == nil && rhs == nil
}
func _List_WorkflowExecution_Equals(lhs, rhs []*shared.WorkflowExecution) bool {
	if len(lhs) != len(rhs) {
		return false
	}
	for i, lv := range lhs {
		rv := rhs[i]
		if !lv.Equals(rv) {
			return false
		}
	}
	return true
}
func (v *ReplayWorkflowActivityParams) Equals(rhs *ReplayWorkflowActivityParams) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_String_EqualsPtr(v.Domain, rhs.Domain) {
		return false
	}
	if !((v.Executions == nil && rhs.Executions == nil) || (v.Executions != nil && rhs.Executions != nil && _List_WorkflowExecution_Equals(v.Executions, rhs.Executions))) {
		return false
	}
	return true
}
type _List_WorkflowExecution_Zapper []*shared.WorkflowExecution
func (l _List_WorkflowExecution_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {
	for _, v := range l {
		err = multierr.Append(err, enc.AppendObject(v))
	}
	return err
}
func (v *ReplayWorkflowActivityParams) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Domain != nil {
		enc.AddString("domain", *v.Domain)
	}
	if v.Executions != nil {
		err = multierr.Append(err, enc.AddArray("executions", (_List_WorkflowExecution_Zapper)(v.Executions)))
	}
	return err
}
func (v *ReplayWorkflowActivityParams) GetDomain() (o string) {
	if v != nil && v.Domain != nil {
		return *v.Domain
	}
	return
}
func (v *ReplayWorkflowActivityParams) IsSetDomain() bool {
	return v != nil && v.Domain != nil
}
func (v *ReplayWorkflowActivityParams) GetExecutions() (o []*shared.WorkflowExecution) {
	if v != nil && v.Executions != nil {
		return v.Executions
	}
	return
}
func (v *ReplayWorkflowActivityParams) IsSetExecutions() bool {
	return v != nil && v.Executions != nil
}
type ReplayWorkflowActivityResult struct {
	Succeeded *int32 `json:"succeeded,omitempty"`
	Skipped   *int32 `json:"skipped,omitempty"`
	Failed    *int32 `json:"failed,omitempty"`
}
func (v *ReplayWorkflowActivityResult) ToWire() (wire.Value, error) {
	var (
		fields [3]wire.Field
		i      int = 0
		w      wire.Value
		err    error
	)
	if v.Succeeded != nil {
		w, err = wire.NewValueI32(*(v.Succeeded)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 10, Value: w}
		i++
	}
	if v.Skipped != nil {
		w, err = wire.NewValueI32(*(v.Skipped)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 20, Value: w}
		i++
	}
	if v.Failed != nil {
		w, err = wire.NewValueI32(*(v.Failed)), error(nil)
		if err != nil {
			return w, err
		}
		fields[i] = wire.Field{ID: 30, Value: w}
		i++
	}
	return wire.NewValueStruct(wire.Struct{Fields: fields[:i]}), nil
}
func (v *ReplayWorkflowActivityResult) 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.Succeeded = &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.Skipped = &x
				if err != nil {
					return err
				}
			}
		case 30:
			if field.Value.Type() == wire.TI32 {
				var x int32
				x, err = field.Value.GetI32(), error(nil)
				v.Failed = &x
				if err != nil {
					return err
				}
			}
		}
	}
	return nil
}
func (v *ReplayWorkflowActivityResult) String() string {
	if v == nil {
		return "<nil>"
	}
	var fields [3]string
	i := 0
	if v.Succeeded != nil {
		fields[i] = fmt.Sprintf("Succeeded: %v", *(v.Succeeded))
		i++
	}
	if v.Skipped != nil {
		fields[i] = fmt.Sprintf("Skipped: %v", *(v.Skipped))
		i++
	}
	if v.Failed != nil {
		fields[i] = fmt.Sprintf("Failed: %v", *(v.Failed))
		i++
	}
	return fmt.Sprintf("ReplayWorkflowActivityResult{%v}", strings.Join(fields[:i], ", "))
}
func (v *ReplayWorkflowActivityResult) Equals(rhs *ReplayWorkflowActivityResult) bool {
	if v == nil {
		return rhs == nil
	} else if rhs == nil {
		return false
	}
	if !_I32_EqualsPtr(v.Succeeded, rhs.Succeeded) {
		return false
	}
	if !_I32_EqualsPtr(v.Skipped, rhs.Skipped) {
		return false
	}
	if !_I32_EqualsPtr(v.Failed, rhs.Failed) {
		return false
	}
	return true
}
func (v *ReplayWorkflowActivityResult) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {
	if v == nil {
		return nil
	}
	if v.Succeeded != nil {
		enc.AddInt32("succeeded", *v.Succeeded)
	}
	if v.Skipped != nil {
		enc.AddInt32("skipped", *v.Skipped)
	}
	if v.Failed != nil {
		enc.AddInt32("failed", *v.Failed)
	}
	return err
}
func (v *ReplayWorkflowActivityResult) GetSucceeded() (o int32) {
	if v != nil && v.Succeeded != nil {
		return *v.Succeeded
	}
	return
}