/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.facebook.thrift.annotation_deprecated;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;
import java.util.BitSet;
import java.util.Arrays;
import com.facebook.thrift.*;
import com.facebook.thrift.annotations.*;
import com.facebook.thrift.async.*;
import com.facebook.thrift.meta_data.*;
import com.facebook.thrift.server.*;
import com.facebook.thrift.transport.*;
import com.facebook.thrift.protocol.*;

/**
 * Applies unstructured annotations to a definition.
 */
@SuppressWarnings({ "unused", "serial" })
public class DeprecatedUnvalidatedAnnotations implements TBase, java.io.Serializable, Cloneable {
  private static final TStruct STRUCT_DESC = new TStruct("DeprecatedUnvalidatedAnnotations");
  private static final TField ITEMS_FIELD_DESC = new TField("items", TType.MAP, (short)1);

  public final Map<String,String> items;
  public static final int ITEMS = 1;

  public DeprecatedUnvalidatedAnnotations(
      Map<String,String> items) {
    this.items = items;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public DeprecatedUnvalidatedAnnotations(DeprecatedUnvalidatedAnnotations other) {
    if (other.isSetItems()) {
      this.items = TBaseHelper.deepCopy(other.items);
    } else {
      this.items = null;
    }
  }

  public DeprecatedUnvalidatedAnnotations deepCopy() {
    return new DeprecatedUnvalidatedAnnotations(this);
  }

  public Map<String,String> getItems() {
    return this.items;
  }

  // Returns true if field items is set (has been assigned a value) and false otherwise
  public boolean isSetItems() {
    return this.items != null;
  }

  @Override
  public boolean equals(Object _that) {
    if (_that == null)
      return false;
    if (this == _that)
      return true;
    if (!(_that instanceof DeprecatedUnvalidatedAnnotations))
      return false;
    DeprecatedUnvalidatedAnnotations that = (DeprecatedUnvalidatedAnnotations)_that;

    if (!TBaseHelper.equalsNobinary(this.isSetItems(), that.isSetItems(), this.items, that.items)) { return false; }

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {items});
  }

  // This is required to satisfy the TBase interface, but can't be implemented on immutable struture.
  public void read(TProtocol iprot) throws TException {
    throw new TException("unimplemented in android immutable structure");
  }

  public static DeprecatedUnvalidatedAnnotations deserialize(TProtocol iprot) throws TException {
    Map<String,String> tmp_items = null;
    TField __field;
    iprot.readStructBegin();
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) {
        break;
      }
      switch (__field.id)
      {
        case ITEMS:
          if (__field.type == TType.MAP) {
            {
              TMap _map9 = iprot.readMapBegin();
              tmp_items = new HashMap<String,String>(Math.max(0, 2*_map9.size));
              for (int _i10 = 0; 
                   (_map9.size < 0) ? iprot.peekMap() : (_i10 < _map9.size); 
                   ++_i10)
              {
                String _key11;
                String _val12;
                _key11 = iprot.readString();
                _val12 = iprot.readString();
                tmp_items.put(_key11, _val12);
              }
              iprot.readMapEnd();
            }
          } else {
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    DeprecatedUnvalidatedAnnotations _that;
    _that = new DeprecatedUnvalidatedAnnotations(
      tmp_items
    );
    _that.validate();
    return _that;
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.items != null) {
      oprot.writeFieldBegin(ITEMS_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.items.size()));
        for (Map.Entry<String, String> _iter13 : this.items.entrySet())        {
          oprot.writeString(_iter13.getKey());
          oprot.writeString(_iter13.getValue());
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  @Override
  public String toString() {
    return toString(1, true);
  }

  @Override
  public String toString(int indent, boolean prettyPrint) {
    return TBaseHelper.toStringHelper(this, indent, prettyPrint);
  }

  public void validate() throws TException {
    // check for required fields
  }

}

