/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */
package org.apache.spark.sql.execution.datasources.parquet.test.avro;  
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class ParquetEnum extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ParquetEnum\",\"namespace\":\"org.apache.spark.sql.execution.datasources.parquet.test.avro\",\"fields\":[{\"name\":\"suit\",\"type\":{\"type\":\"enum\",\"name\":\"Suit\",\"symbols\":[\"SPADES\",\"HEARTS\",\"DIAMONDS\",\"CLUBS\"]}}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit suit;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use <code>newBuilder()</code>. 
   */
  public ParquetEnum() {}

  /**
   * All-args constructor.
   */
  public ParquetEnum(org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit suit) {
    this.suit = suit;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call. 
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return suit;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call. 
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: suit = (org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'suit' field.
   */
  public org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit getSuit() {
    return suit;
  }

  /**
   * Sets the value of the 'suit' field.
   * @param value the value to set.
   */
  public void setSuit(org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit value) {
    this.suit = value;
  }

  /** Creates a new ParquetEnum RecordBuilder */
  public static org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder newBuilder() {
    return new org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder();
  }
  
  /** Creates a new ParquetEnum RecordBuilder by copying an existing Builder */
  public static org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder newBuilder(org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder other) {
    return new org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder(other);
  }
  
  /** Creates a new ParquetEnum RecordBuilder by copying an existing ParquetEnum instance */
  public static org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder newBuilder(org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum other) {
    return new org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder(other);
  }
  
  /**
   * RecordBuilder for ParquetEnum instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ParquetEnum>
    implements org.apache.avro.data.RecordBuilder<ParquetEnum> {

    private org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit suit;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.SCHEMA$);
    }
    
    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.suit)) {
        this.suit = data().deepCopy(fields()[0].schema(), other.suit);
        fieldSetFlags()[0] = true;
      }
    }
    
    /** Creates a Builder by copying an existing ParquetEnum instance */
    private Builder(org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum other) {
            super(org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.SCHEMA$);
      if (isValidValue(fields()[0], other.suit)) {
        this.suit = data().deepCopy(fields()[0].schema(), other.suit);
        fieldSetFlags()[0] = true;
      }
    }

    /** Gets the value of the 'suit' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit getSuit() {
      return suit;
    }
    
    /** Sets the value of the 'suit' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder setSuit(org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit value) {
      validate(fields()[0], value);
      this.suit = value;
      fieldSetFlags()[0] = true;
      return this; 
    }
    
    /** Checks whether the 'suit' field has been set */
    public boolean hasSuit() {
      return fieldSetFlags()[0];
    }
    
    /** Clears the value of the 'suit' field */
    public org.apache.spark.sql.execution.datasources.parquet.test.avro.ParquetEnum.Builder clearSuit() {
      suit = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    @Override
    public ParquetEnum build() {
      try {
        ParquetEnum record = new ParquetEnum();
        record.suit = fieldSetFlags()[0] ? this.suit : (org.apache.spark.sql.execution.datasources.parquet.test.avro.Suit) defaultValue(fields()[0]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}
