// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
/*
 * SOURCES:
 *     alert.avsc
 *     candidate.avsc
 *     cutout.avsc
 *     prv_candidate.avsc
 */
package schema

import (
	"io"
	"fmt"

	"github.com/actgardner/gogen-avro/vm"
	"github.com/actgardner/gogen-avro/vm/types"
)


type UnionNullArrayPrv_candidateTypeEnum int
const (

	 UnionNullArrayPrv_candidateTypeEnumNull UnionNullArrayPrv_candidateTypeEnum = 0

	 UnionNullArrayPrv_candidateTypeEnumArrayPrv_candidate UnionNullArrayPrv_candidateTypeEnum = 1

)

type UnionNullArrayPrv_candidate struct {

	Null *types.NullVal

	ArrayPrv_candidate []*Prv_candidate

	UnionType UnionNullArrayPrv_candidateTypeEnum
}

func writeUnionNullArrayPrv_candidate(r *UnionNullArrayPrv_candidate, w io.Writer) error {
	err := vm.WriteLong(int64(r.UnionType), w)
	if err != nil {
		return err
	}
	switch r.UnionType{
	
	case UnionNullArrayPrv_candidateTypeEnumNull:
		return vm.WriteNull(r.Null, w)
        
	case UnionNullArrayPrv_candidateTypeEnumArrayPrv_candidate:
		return writeArrayPrv_candidate(r.ArrayPrv_candidate, w)
        
	}
	return fmt.Errorf("invalid value for *UnionNullArrayPrv_candidate")
}

func NewUnionNullArrayPrv_candidate() *UnionNullArrayPrv_candidate {
	return &UnionNullArrayPrv_candidate{}
}

func (_ *UnionNullArrayPrv_candidate) SetBoolean(v bool) { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) SetInt(v int32) { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) SetFloat(v float32) { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) SetDouble(v float64) { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) SetBytes(v []byte) { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) SetString(v string) { panic("Unsupported operation") }
func (r *UnionNullArrayPrv_candidate) SetLong(v int64) { 
	r.UnionType = (UnionNullArrayPrv_candidateTypeEnum)(v)
}
func (r *UnionNullArrayPrv_candidate) Get(i int) types.Field {
	switch (i) {
	
	case 0:
		
		
		return r.Null
		
	
	case 1:
		
		r.ArrayPrv_candidate = make([]*Prv_candidate, 0)
		
		
		return (*ArrayPrv_candidateWrapper)(&r.ArrayPrv_candidate)
		
	
	}
	panic("Unknown field index")
}
func (_ *UnionNullArrayPrv_candidate) SetDefault(i int) { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) AppendMap(key string) types.Field { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) AppendArray() types.Field { panic("Unsupported operation") }
func (_ *UnionNullArrayPrv_candidate) Finalize()  { }
