/**
 * Autogenerated by Thrift Compiler (0.12.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.facebook.buck.frontend.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.12.0)")
public class FetchRuleKeyLogsResponse implements org.apache.thrift.TBase<FetchRuleKeyLogsResponse, FetchRuleKeyLogsResponse._Fields>, java.io.Serializable, Cloneable, Comparable<FetchRuleKeyLogsResponse> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FetchRuleKeyLogsResponse");

  private static final org.apache.thrift.protocol.TField RULE_KEY_LOGS_FIELD_DESC = new org.apache.thrift.protocol.TField("ruleKeyLogs", org.apache.thrift.protocol.TType.LIST, (short)1);
  private static final org.apache.thrift.protocol.TField LOOKED_UP_STORE_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("lookedUpStoreIds", org.apache.thrift.protocol.TType.LIST, (short)2);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new FetchRuleKeyLogsResponseStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new FetchRuleKeyLogsResponseTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable java.util.List<RuleKeyLogEntry> ruleKeyLogs; // optional
  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> lookedUpStoreIds; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    RULE_KEY_LOGS((short)1, "ruleKeyLogs"),
    LOOKED_UP_STORE_IDS((short)2, "lookedUpStoreIds");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // RULE_KEY_LOGS
          return RULE_KEY_LOGS;
        case 2: // LOOKED_UP_STORE_IDS
          return LOOKED_UP_STORE_IDS;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.RULE_KEY_LOGS,_Fields.LOOKED_UP_STORE_IDS};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.RULE_KEY_LOGS, new org.apache.thrift.meta_data.FieldMetaData("ruleKeyLogs", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RuleKeyLogEntry.class))));
    tmpMap.put(_Fields.LOOKED_UP_STORE_IDS, new org.apache.thrift.meta_data.FieldMetaData("lookedUpStoreIds", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FetchRuleKeyLogsResponse.class, metaDataMap);
  }

  public FetchRuleKeyLogsResponse() {
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public FetchRuleKeyLogsResponse(FetchRuleKeyLogsResponse other) {
    if (other.isSetRuleKeyLogs()) {
      java.util.List<RuleKeyLogEntry> __this__ruleKeyLogs = new java.util.ArrayList<RuleKeyLogEntry>(other.ruleKeyLogs.size());
      for (RuleKeyLogEntry other_element : other.ruleKeyLogs) {
        __this__ruleKeyLogs.add(new RuleKeyLogEntry(other_element));
      }
      this.ruleKeyLogs = __this__ruleKeyLogs;
    }
    if (other.isSetLookedUpStoreIds()) {
      java.util.List<java.lang.String> __this__lookedUpStoreIds = new java.util.ArrayList<java.lang.String>(other.lookedUpStoreIds);
      this.lookedUpStoreIds = __this__lookedUpStoreIds;
    }
  }

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

  @Override
  public void clear() {
    this.ruleKeyLogs = null;
    this.lookedUpStoreIds = null;
  }

  public int getRuleKeyLogsSize() {
    return (this.ruleKeyLogs == null) ? 0 : this.ruleKeyLogs.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<RuleKeyLogEntry> getRuleKeyLogsIterator() {
    return (this.ruleKeyLogs == null) ? null : this.ruleKeyLogs.iterator();
  }

  public void addToRuleKeyLogs(RuleKeyLogEntry elem) {
    if (this.ruleKeyLogs == null) {
      this.ruleKeyLogs = new java.util.ArrayList<RuleKeyLogEntry>();
    }
    this.ruleKeyLogs.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<RuleKeyLogEntry> getRuleKeyLogs() {
    return this.ruleKeyLogs;
  }

  public FetchRuleKeyLogsResponse setRuleKeyLogs(@org.apache.thrift.annotation.Nullable java.util.List<RuleKeyLogEntry> ruleKeyLogs) {
    this.ruleKeyLogs = ruleKeyLogs;
    return this;
  }

  public void unsetRuleKeyLogs() {
    this.ruleKeyLogs = null;
  }

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

  public void setRuleKeyLogsIsSet(boolean value) {
    if (!value) {
      this.ruleKeyLogs = null;
    }
  }

  public int getLookedUpStoreIdsSize() {
    return (this.lookedUpStoreIds == null) ? 0 : this.lookedUpStoreIds.size();
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.Iterator<java.lang.String> getLookedUpStoreIdsIterator() {
    return (this.lookedUpStoreIds == null) ? null : this.lookedUpStoreIds.iterator();
  }

  public void addToLookedUpStoreIds(java.lang.String elem) {
    if (this.lookedUpStoreIds == null) {
      this.lookedUpStoreIds = new java.util.ArrayList<java.lang.String>();
    }
    this.lookedUpStoreIds.add(elem);
  }

  @org.apache.thrift.annotation.Nullable
  public java.util.List<java.lang.String> getLookedUpStoreIds() {
    return this.lookedUpStoreIds;
  }

  public FetchRuleKeyLogsResponse setLookedUpStoreIds(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> lookedUpStoreIds) {
    this.lookedUpStoreIds = lookedUpStoreIds;
    return this;
  }

  public void unsetLookedUpStoreIds() {
    this.lookedUpStoreIds = null;
  }

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

  public void setLookedUpStoreIdsIsSet(boolean value) {
    if (!value) {
      this.lookedUpStoreIds = null;
    }
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case RULE_KEY_LOGS:
      if (value == null) {
        unsetRuleKeyLogs();
      } else {
        setRuleKeyLogs((java.util.List<RuleKeyLogEntry>)value);
      }
      break;

    case LOOKED_UP_STORE_IDS:
      if (value == null) {
        unsetLookedUpStoreIds();
      } else {
        setLookedUpStoreIds((java.util.List<java.lang.String>)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case RULE_KEY_LOGS:
      return getRuleKeyLogs();

    case LOOKED_UP_STORE_IDS:
      return getLookedUpStoreIds();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case RULE_KEY_LOGS:
      return isSetRuleKeyLogs();
    case LOOKED_UP_STORE_IDS:
      return isSetLookedUpStoreIds();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that == null)
      return false;
    if (that instanceof FetchRuleKeyLogsResponse)
      return this.equals((FetchRuleKeyLogsResponse)that);
    return false;
  }

  public boolean equals(FetchRuleKeyLogsResponse that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_ruleKeyLogs = true && this.isSetRuleKeyLogs();
    boolean that_present_ruleKeyLogs = true && that.isSetRuleKeyLogs();
    if (this_present_ruleKeyLogs || that_present_ruleKeyLogs) {
      if (!(this_present_ruleKeyLogs && that_present_ruleKeyLogs))
        return false;
      if (!this.ruleKeyLogs.equals(that.ruleKeyLogs))
        return false;
    }

    boolean this_present_lookedUpStoreIds = true && this.isSetLookedUpStoreIds();
    boolean that_present_lookedUpStoreIds = true && that.isSetLookedUpStoreIds();
    if (this_present_lookedUpStoreIds || that_present_lookedUpStoreIds) {
      if (!(this_present_lookedUpStoreIds && that_present_lookedUpStoreIds))
        return false;
      if (!this.lookedUpStoreIds.equals(that.lookedUpStoreIds))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetRuleKeyLogs()) ? 131071 : 524287);
    if (isSetRuleKeyLogs())
      hashCode = hashCode * 8191 + ruleKeyLogs.hashCode();

    hashCode = hashCode * 8191 + ((isSetLookedUpStoreIds()) ? 131071 : 524287);
    if (isSetLookedUpStoreIds())
      hashCode = hashCode * 8191 + lookedUpStoreIds.hashCode();

    return hashCode;
  }

  @Override
  public int compareTo(FetchRuleKeyLogsResponse other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.valueOf(isSetRuleKeyLogs()).compareTo(other.isSetRuleKeyLogs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetRuleKeyLogs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ruleKeyLogs, other.ruleKeyLogs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.valueOf(isSetLookedUpStoreIds()).compareTo(other.isSetLookedUpStoreIds());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetLookedUpStoreIds()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lookedUpStoreIds, other.lookedUpStoreIds);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("FetchRuleKeyLogsResponse(");
    boolean first = true;

    if (isSetRuleKeyLogs()) {
      sb.append("ruleKeyLogs:");
      if (this.ruleKeyLogs == null) {
        sb.append("null");
      } else {
        sb.append(this.ruleKeyLogs);
      }
      first = false;
    }
    if (isSetLookedUpStoreIds()) {
      if (!first) sb.append(", ");
      sb.append("lookedUpStoreIds:");
      if (this.lookedUpStoreIds == null) {
        sb.append("null");
      } else {
        sb.append(this.lookedUpStoreIds);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class FetchRuleKeyLogsResponseStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public FetchRuleKeyLogsResponseStandardScheme getScheme() {
      return new FetchRuleKeyLogsResponseStandardScheme();
    }
  }

  private static class FetchRuleKeyLogsResponseStandardScheme extends org.apache.thrift.scheme.StandardScheme<FetchRuleKeyLogsResponse> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, FetchRuleKeyLogsResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // RULE_KEY_LOGS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list32 = iprot.readListBegin();
                struct.ruleKeyLogs = new java.util.ArrayList<RuleKeyLogEntry>(_list32.size);
                @org.apache.thrift.annotation.Nullable RuleKeyLogEntry _elem33;
                for (int _i34 = 0; _i34 < _list32.size; ++_i34)
                {
                  _elem33 = new RuleKeyLogEntry();
                  _elem33.read(iprot);
                  struct.ruleKeyLogs.add(_elem33);
                }
                iprot.readListEnd();
              }
              struct.setRuleKeyLogsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // LOOKED_UP_STORE_IDS
            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
              {
                org.apache.thrift.protocol.TList _list35 = iprot.readListBegin();
                struct.lookedUpStoreIds = new java.util.ArrayList<java.lang.String>(_list35.size);
                @org.apache.thrift.annotation.Nullable java.lang.String _elem36;
                for (int _i37 = 0; _i37 < _list35.size; ++_i37)
                {
                  _elem36 = iprot.readString();
                  struct.lookedUpStoreIds.add(_elem36);
                }
                iprot.readListEnd();
              }
              struct.setLookedUpStoreIdsIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, FetchRuleKeyLogsResponse struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.ruleKeyLogs != null) {
        if (struct.isSetRuleKeyLogs()) {
          oprot.writeFieldBegin(RULE_KEY_LOGS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.ruleKeyLogs.size()));
            for (RuleKeyLogEntry _iter38 : struct.ruleKeyLogs)
            {
              _iter38.write(oprot);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      if (struct.lookedUpStoreIds != null) {
        if (struct.isSetLookedUpStoreIds()) {
          oprot.writeFieldBegin(LOOKED_UP_STORE_IDS_FIELD_DESC);
          {
            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.lookedUpStoreIds.size()));
            for (java.lang.String _iter39 : struct.lookedUpStoreIds)
            {
              oprot.writeString(_iter39);
            }
            oprot.writeListEnd();
          }
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class FetchRuleKeyLogsResponseTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public FetchRuleKeyLogsResponseTupleScheme getScheme() {
      return new FetchRuleKeyLogsResponseTupleScheme();
    }
  }

  private static class FetchRuleKeyLogsResponseTupleScheme extends org.apache.thrift.scheme.TupleScheme<FetchRuleKeyLogsResponse> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, FetchRuleKeyLogsResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetRuleKeyLogs()) {
        optionals.set(0);
      }
      if (struct.isSetLookedUpStoreIds()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetRuleKeyLogs()) {
        {
          oprot.writeI32(struct.ruleKeyLogs.size());
          for (RuleKeyLogEntry _iter40 : struct.ruleKeyLogs)
          {
            _iter40.write(oprot);
          }
        }
      }
      if (struct.isSetLookedUpStoreIds()) {
        {
          oprot.writeI32(struct.lookedUpStoreIds.size());
          for (java.lang.String _iter41 : struct.lookedUpStoreIds)
          {
            oprot.writeString(_iter41);
          }
        }
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, FetchRuleKeyLogsResponse struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        {
          org.apache.thrift.protocol.TList _list42 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
          struct.ruleKeyLogs = new java.util.ArrayList<RuleKeyLogEntry>(_list42.size);
          @org.apache.thrift.annotation.Nullable RuleKeyLogEntry _elem43;
          for (int _i44 = 0; _i44 < _list42.size; ++_i44)
          {
            _elem43 = new RuleKeyLogEntry();
            _elem43.read(iprot);
            struct.ruleKeyLogs.add(_elem43);
          }
        }
        struct.setRuleKeyLogsIsSet(true);
      }
      if (incoming.get(1)) {
        {
          org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
          struct.lookedUpStoreIds = new java.util.ArrayList<java.lang.String>(_list45.size);
          @org.apache.thrift.annotation.Nullable java.lang.String _elem46;
          for (int _i47 = 0; _i47 < _list45.size; ++_i47)
          {
            _elem46 = iprot.readString();
            struct.lookedUpStoreIds.add(_elem46);
          }
        }
        struct.setLookedUpStoreIdsIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}

