// ------------------------------------------------------------------------------
// <auto-generated>
//    Generated by avrogen.vshost.exe, version 0.9.0.0
//    Changes to this file may cause incorrect behavior and will be lost if code
//    is regenerated
// </auto-generated>
// ------------------------------------------------------------------------------
namespace org.apache.avro.test
{
	using System;
	using System.Collections.Generic;
	using System.Text;
	using Avro;
	using Avro.Specific;
	
	public partial class TestRecordWithUnion : ISpecificRecord
	{
		private static Schema _SCHEMA = Avro.Schema.Parse(@"{""type"":""record"",""name"":""TestRecordWithUnion"",""namespace"":""org.apache.avro.test"",""fields"":[{""name"":""kind"",""type"":[""null"",{""type"":""enum"",""name"":""Kind"",""namespace"":""org.apache.avro.test"",""symbols"":[""FOO"",""BAR"",""BAZ""],""javaAnnotation"":""org.apache.avro.TestAnnotation""}]},{""name"":""value"",""type"":[""null"",""string""]}]}");
		private System.Nullable<org.apache.avro.test.Kind> _kind;
		private string _value;
		public virtual Schema Schema
		{
			get
			{
				return TestRecordWithUnion._SCHEMA;
			}
		}
		public System.Nullable<org.apache.avro.test.Kind> kind
		{
			get
			{
				return this._kind;
			}
			set
			{
				this._kind = value;
			}
		}
		public string @value
		{
			get
			{
				return this._value;
			}
			set
			{
				this._value = value;
			}
		}
		public virtual object Get(int fieldPos)
		{
			switch (fieldPos)
			{
			case 0: return this.kind;
			case 1: return this.@value;
			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Get()");
			};
		}
		public virtual void Put(int fieldPos, object fieldValue)
		{
			switch (fieldPos)
			{
			case 0: this.kind = fieldValue == null ? (System.Nullable<org.apache.avro.test.Kind>)null : (org.apache.avro.test.Kind)fieldValue; break;
			case 1: this.@value = (System.String)fieldValue; break;
			default: throw new AvroRuntimeException("Bad index " + fieldPos + " in Put()");
			};
		}
	}
}
