/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.vesoft.nebula.meta;

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.*;

@SuppressWarnings({ "unused", "serial" })
public class BackupMeta implements TBase, java.io.Serializable, Cloneable, Comparable<BackupMeta> {
  private static final TStruct STRUCT_DESC = new TStruct("BackupMeta");
  private static final TField SPACE_BACKUPS_FIELD_DESC = new TField("space_backups", TType.MAP, (short)1);
  private static final TField META_FILES_FIELD_DESC = new TField("meta_files", TType.LIST, (short)2);
  private static final TField BACKUP_NAME_FIELD_DESC = new TField("backup_name", TType.STRING, (short)3);
  private static final TField FULL_FIELD_DESC = new TField("full", TType.BOOL, (short)4);
  private static final TField ALL_SPACES_FIELD_DESC = new TField("all_spaces", TType.BOOL, (short)5);
  private static final TField CREATE_TIME_FIELD_DESC = new TField("create_time", TType.I64, (short)6);
  private static final TField BASE_BACKUP_NAME_FIELD_DESC = new TField("base_backup_name", TType.STRING, (short)7);
  private static final TField STORAGE_HOSTS_FIELD_DESC = new TField("storage_hosts", TType.LIST, (short)8);
  private static final TField CLUSTER_ID_FIELD_DESC = new TField("cluster_id", TType.I64, (short)9);

  public Map<Integer,SpaceBackupInfo> space_backups;
  public List<byte[]> meta_files;
  public byte[] backup_name;
  public boolean full;
  public boolean all_spaces;
  public long create_time;
  public byte[] base_backup_name;
  public List<com.vesoft.nebula.HostAddr> storage_hosts;
  public long cluster_id;
  public static final int SPACE_BACKUPS = 1;
  public static final int META_FILES = 2;
  public static final int BACKUP_NAME = 3;
  public static final int FULL = 4;
  public static final int ALL_SPACES = 5;
  public static final int CREATE_TIME = 6;
  public static final int BASE_BACKUP_NAME = 7;
  public static final int STORAGE_HOSTS = 8;
  public static final int CLUSTER_ID = 9;

  // isset id assignments
  private static final int __FULL_ISSET_ID = 0;
  private static final int __ALL_SPACES_ISSET_ID = 1;
  private static final int __CREATE_TIME_ISSET_ID = 2;
  private static final int __CLUSTER_ID_ISSET_ID = 3;
  private BitSet __isset_bit_vector = new BitSet(4);

  public static final Map<Integer, FieldMetaData> metaDataMap;

  static {
    Map<Integer, FieldMetaData> tmpMetaDataMap = new HashMap<Integer, FieldMetaData>();
    tmpMetaDataMap.put(SPACE_BACKUPS, new FieldMetaData("space_backups", TFieldRequirementType.DEFAULT, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.I32), 
            new StructMetaData(TType.STRUCT, SpaceBackupInfo.class))));
    tmpMetaDataMap.put(META_FILES, new FieldMetaData("meta_files", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new FieldValueMetaData(TType.STRING))));
    tmpMetaDataMap.put(BACKUP_NAME, new FieldMetaData("backup_name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(FULL, new FieldMetaData("full", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(ALL_SPACES, new FieldMetaData("all_spaces", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.BOOL)));
    tmpMetaDataMap.put(CREATE_TIME, new FieldMetaData("create_time", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    tmpMetaDataMap.put(BASE_BACKUP_NAME, new FieldMetaData("base_backup_name", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    tmpMetaDataMap.put(STORAGE_HOSTS, new FieldMetaData("storage_hosts", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new StructMetaData(TType.STRUCT, com.vesoft.nebula.HostAddr.class))));
    tmpMetaDataMap.put(CLUSTER_ID, new FieldMetaData("cluster_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    metaDataMap = Collections.unmodifiableMap(tmpMetaDataMap);
  }

  static {
    FieldMetaData.addStructMetaDataMap(BackupMeta.class, metaDataMap);
  }

  public BackupMeta() {
  }

  public BackupMeta(
      Map<Integer,SpaceBackupInfo> space_backups,
      List<byte[]> meta_files,
      byte[] backup_name,
      boolean full,
      boolean all_spaces,
      long create_time,
      byte[] base_backup_name,
      List<com.vesoft.nebula.HostAddr> storage_hosts,
      long cluster_id) {
    this();
    this.space_backups = space_backups;
    this.meta_files = meta_files;
    this.backup_name = backup_name;
    this.full = full;
    setFullIsSet(true);
    this.all_spaces = all_spaces;
    setAll_spacesIsSet(true);
    this.create_time = create_time;
    setCreate_timeIsSet(true);
    this.base_backup_name = base_backup_name;
    this.storage_hosts = storage_hosts;
    this.cluster_id = cluster_id;
    setCluster_idIsSet(true);
  }

  public static class Builder {
    private Map<Integer,SpaceBackupInfo> space_backups;
    private List<byte[]> meta_files;
    private byte[] backup_name;
    private boolean full;
    private boolean all_spaces;
    private long create_time;
    private byte[] base_backup_name;
    private List<com.vesoft.nebula.HostAddr> storage_hosts;
    private long cluster_id;

    BitSet __optional_isset = new BitSet(4);

    public Builder() {
    }

    public Builder setSpace_backups(final Map<Integer,SpaceBackupInfo> space_backups) {
      this.space_backups = space_backups;
      return this;
    }

    public Builder setMeta_files(final List<byte[]> meta_files) {
      this.meta_files = meta_files;
      return this;
    }

    public Builder setBackup_name(final byte[] backup_name) {
      this.backup_name = backup_name;
      return this;
    }

    public Builder setFull(final boolean full) {
      this.full = full;
      __optional_isset.set(__FULL_ISSET_ID, true);
      return this;
    }

    public Builder setAll_spaces(final boolean all_spaces) {
      this.all_spaces = all_spaces;
      __optional_isset.set(__ALL_SPACES_ISSET_ID, true);
      return this;
    }

    public Builder setCreate_time(final long create_time) {
      this.create_time = create_time;
      __optional_isset.set(__CREATE_TIME_ISSET_ID, true);
      return this;
    }

    public Builder setBase_backup_name(final byte[] base_backup_name) {
      this.base_backup_name = base_backup_name;
      return this;
    }

    public Builder setStorage_hosts(final List<com.vesoft.nebula.HostAddr> storage_hosts) {
      this.storage_hosts = storage_hosts;
      return this;
    }

    public Builder setCluster_id(final long cluster_id) {
      this.cluster_id = cluster_id;
      __optional_isset.set(__CLUSTER_ID_ISSET_ID, true);
      return this;
    }

    public BackupMeta build() {
      BackupMeta result = new BackupMeta();
      result.setSpace_backups(this.space_backups);
      result.setMeta_files(this.meta_files);
      result.setBackup_name(this.backup_name);
      if (__optional_isset.get(__FULL_ISSET_ID)) {
        result.setFull(this.full);
      }
      if (__optional_isset.get(__ALL_SPACES_ISSET_ID)) {
        result.setAll_spaces(this.all_spaces);
      }
      if (__optional_isset.get(__CREATE_TIME_ISSET_ID)) {
        result.setCreate_time(this.create_time);
      }
      result.setBase_backup_name(this.base_backup_name);
      result.setStorage_hosts(this.storage_hosts);
      if (__optional_isset.get(__CLUSTER_ID_ISSET_ID)) {
        result.setCluster_id(this.cluster_id);
      }
      return result;
    }
  }

  public static Builder builder() {
    return new Builder();
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public BackupMeta(BackupMeta other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetSpace_backups()) {
      this.space_backups = TBaseHelper.deepCopy(other.space_backups);
    }
    if (other.isSetMeta_files()) {
      this.meta_files = TBaseHelper.deepCopy(other.meta_files);
    }
    if (other.isSetBackup_name()) {
      this.backup_name = TBaseHelper.deepCopy(other.backup_name);
    }
    this.full = TBaseHelper.deepCopy(other.full);
    this.all_spaces = TBaseHelper.deepCopy(other.all_spaces);
    this.create_time = TBaseHelper.deepCopy(other.create_time);
    if (other.isSetBase_backup_name()) {
      this.base_backup_name = TBaseHelper.deepCopy(other.base_backup_name);
    }
    if (other.isSetStorage_hosts()) {
      this.storage_hosts = TBaseHelper.deepCopy(other.storage_hosts);
    }
    this.cluster_id = TBaseHelper.deepCopy(other.cluster_id);
  }

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

  public Map<Integer,SpaceBackupInfo> getSpace_backups() {
    return this.space_backups;
  }

  public BackupMeta setSpace_backups(Map<Integer,SpaceBackupInfo> space_backups) {
    this.space_backups = space_backups;
    return this;
  }

  public void unsetSpace_backups() {
    this.space_backups = null;
  }

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

  public void setSpace_backupsIsSet(boolean __value) {
    if (!__value) {
      this.space_backups = null;
    }
  }

  public List<byte[]> getMeta_files() {
    return this.meta_files;
  }

  public BackupMeta setMeta_files(List<byte[]> meta_files) {
    this.meta_files = meta_files;
    return this;
  }

  public void unsetMeta_files() {
    this.meta_files = null;
  }

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

  public void setMeta_filesIsSet(boolean __value) {
    if (!__value) {
      this.meta_files = null;
    }
  }

  public byte[] getBackup_name() {
    return this.backup_name;
  }

  public BackupMeta setBackup_name(byte[] backup_name) {
    this.backup_name = backup_name;
    return this;
  }

  public void unsetBackup_name() {
    this.backup_name = null;
  }

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

  public void setBackup_nameIsSet(boolean __value) {
    if (!__value) {
      this.backup_name = null;
    }
  }

  public boolean isFull() {
    return this.full;
  }

  public BackupMeta setFull(boolean full) {
    this.full = full;
    setFullIsSet(true);
    return this;
  }

  public void unsetFull() {
    __isset_bit_vector.clear(__FULL_ISSET_ID);
  }

  // Returns true if field full is set (has been assigned a value) and false otherwise
  public boolean isSetFull() {
    return __isset_bit_vector.get(__FULL_ISSET_ID);
  }

  public void setFullIsSet(boolean __value) {
    __isset_bit_vector.set(__FULL_ISSET_ID, __value);
  }

  public boolean isAll_spaces() {
    return this.all_spaces;
  }

  public BackupMeta setAll_spaces(boolean all_spaces) {
    this.all_spaces = all_spaces;
    setAll_spacesIsSet(true);
    return this;
  }

  public void unsetAll_spaces() {
    __isset_bit_vector.clear(__ALL_SPACES_ISSET_ID);
  }

  // Returns true if field all_spaces is set (has been assigned a value) and false otherwise
  public boolean isSetAll_spaces() {
    return __isset_bit_vector.get(__ALL_SPACES_ISSET_ID);
  }

  public void setAll_spacesIsSet(boolean __value) {
    __isset_bit_vector.set(__ALL_SPACES_ISSET_ID, __value);
  }

  public long getCreate_time() {
    return this.create_time;
  }

  public BackupMeta setCreate_time(long create_time) {
    this.create_time = create_time;
    setCreate_timeIsSet(true);
    return this;
  }

  public void unsetCreate_time() {
    __isset_bit_vector.clear(__CREATE_TIME_ISSET_ID);
  }

  // Returns true if field create_time is set (has been assigned a value) and false otherwise
  public boolean isSetCreate_time() {
    return __isset_bit_vector.get(__CREATE_TIME_ISSET_ID);
  }

  public void setCreate_timeIsSet(boolean __value) {
    __isset_bit_vector.set(__CREATE_TIME_ISSET_ID, __value);
  }

  public byte[] getBase_backup_name() {
    return this.base_backup_name;
  }

  public BackupMeta setBase_backup_name(byte[] base_backup_name) {
    this.base_backup_name = base_backup_name;
    return this;
  }

  public void unsetBase_backup_name() {
    this.base_backup_name = null;
  }

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

  public void setBase_backup_nameIsSet(boolean __value) {
    if (!__value) {
      this.base_backup_name = null;
    }
  }

  public List<com.vesoft.nebula.HostAddr> getStorage_hosts() {
    return this.storage_hosts;
  }

  public BackupMeta setStorage_hosts(List<com.vesoft.nebula.HostAddr> storage_hosts) {
    this.storage_hosts = storage_hosts;
    return this;
  }

  public void unsetStorage_hosts() {
    this.storage_hosts = null;
  }

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

  public void setStorage_hostsIsSet(boolean __value) {
    if (!__value) {
      this.storage_hosts = null;
    }
  }

  public long getCluster_id() {
    return this.cluster_id;
  }

  public BackupMeta setCluster_id(long cluster_id) {
    this.cluster_id = cluster_id;
    setCluster_idIsSet(true);
    return this;
  }

  public void unsetCluster_id() {
    __isset_bit_vector.clear(__CLUSTER_ID_ISSET_ID);
  }

  // Returns true if field cluster_id is set (has been assigned a value) and false otherwise
  public boolean isSetCluster_id() {
    return __isset_bit_vector.get(__CLUSTER_ID_ISSET_ID);
  }

  public void setCluster_idIsSet(boolean __value) {
    __isset_bit_vector.set(__CLUSTER_ID_ISSET_ID, __value);
  }

  @SuppressWarnings("unchecked")
  public void setFieldValue(int fieldID, Object __value) {
    switch (fieldID) {
    case SPACE_BACKUPS:
      if (__value == null) {
        unsetSpace_backups();
      } else {
        setSpace_backups((Map<Integer,SpaceBackupInfo>)__value);
      }
      break;

    case META_FILES:
      if (__value == null) {
        unsetMeta_files();
      } else {
        setMeta_files((List<byte[]>)__value);
      }
      break;

    case BACKUP_NAME:
      if (__value == null) {
        unsetBackup_name();
      } else {
        setBackup_name((byte[])__value);
      }
      break;

    case FULL:
      if (__value == null) {
        unsetFull();
      } else {
        setFull((Boolean)__value);
      }
      break;

    case ALL_SPACES:
      if (__value == null) {
        unsetAll_spaces();
      } else {
        setAll_spaces((Boolean)__value);
      }
      break;

    case CREATE_TIME:
      if (__value == null) {
        unsetCreate_time();
      } else {
        setCreate_time((Long)__value);
      }
      break;

    case BASE_BACKUP_NAME:
      if (__value == null) {
        unsetBase_backup_name();
      } else {
        setBase_backup_name((byte[])__value);
      }
      break;

    case STORAGE_HOSTS:
      if (__value == null) {
        unsetStorage_hosts();
      } else {
        setStorage_hosts((List<com.vesoft.nebula.HostAddr>)__value);
      }
      break;

    case CLUSTER_ID:
      if (__value == null) {
        unsetCluster_id();
      } else {
        setCluster_id((Long)__value);
      }
      break;

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

  public Object getFieldValue(int fieldID) {
    switch (fieldID) {
    case SPACE_BACKUPS:
      return getSpace_backups();

    case META_FILES:
      return getMeta_files();

    case BACKUP_NAME:
      return getBackup_name();

    case FULL:
      return new Boolean(isFull());

    case ALL_SPACES:
      return new Boolean(isAll_spaces());

    case CREATE_TIME:
      return new Long(getCreate_time());

    case BASE_BACKUP_NAME:
      return getBase_backup_name();

    case STORAGE_HOSTS:
      return getStorage_hosts();

    case CLUSTER_ID:
      return new Long(getCluster_id());

    default:
      throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
    }
  }

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

    if (!TBaseHelper.equalsNobinary(this.isSetSpace_backups(), that.isSetSpace_backups(), this.space_backups, that.space_backups)) { return false; }

    if (!TBaseHelper.equalsSlow(this.isSetMeta_files(), that.isSetMeta_files(), this.meta_files, that.meta_files)) { return false; }

    if (!TBaseHelper.equalsSlow(this.isSetBackup_name(), that.isSetBackup_name(), this.backup_name, that.backup_name)) { return false; }

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

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

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

    if (!TBaseHelper.equalsSlow(this.isSetBase_backup_name(), that.isSetBase_backup_name(), this.base_backup_name, that.base_backup_name)) { return false; }

    if (!TBaseHelper.equalsNobinary(this.isSetStorage_hosts(), that.isSetStorage_hosts(), this.storage_hosts, that.storage_hosts)) { return false; }

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

    return true;
  }

  @Override
  public int hashCode() {
    return Arrays.deepHashCode(new Object[] {space_backups, meta_files, backup_name, full, all_spaces, create_time, base_backup_name, storage_hosts, cluster_id});
  }

  @Override
  public int compareTo(BackupMeta other) {
    if (other == null) {
      // See java.lang.Comparable docs
      throw new NullPointerException();
    }

    if (other == this) {
      return 0;
    }
    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetSpace_backups()).compareTo(other.isSetSpace_backups());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(space_backups, other.space_backups);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMeta_files()).compareTo(other.isSetMeta_files());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(meta_files, other.meta_files);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetBackup_name()).compareTo(other.isSetBackup_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(backup_name, other.backup_name);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetFull()).compareTo(other.isSetFull());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(full, other.full);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAll_spaces()).compareTo(other.isSetAll_spaces());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(all_spaces, other.all_spaces);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCreate_time()).compareTo(other.isSetCreate_time());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(create_time, other.create_time);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetBase_backup_name()).compareTo(other.isSetBase_backup_name());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(base_backup_name, other.base_backup_name);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStorage_hosts()).compareTo(other.isSetStorage_hosts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(storage_hosts, other.storage_hosts);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetCluster_id()).compareTo(other.isSetCluster_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(cluster_id, other.cluster_id);
    if (lastComparison != 0) { 
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField __field;
    iprot.readStructBegin(metaDataMap);
    while (true)
    {
      __field = iprot.readFieldBegin();
      if (__field.type == TType.STOP) { 
        break;
      }
      switch (__field.id)
      {
        case SPACE_BACKUPS:
          if (__field.type == TType.MAP) {
            {
              TMap _map261 = iprot.readMapBegin();
              this.space_backups = new HashMap<Integer,SpaceBackupInfo>(Math.max(0, 2*_map261.size));
              for (int _i262 = 0; 
                   (_map261.size < 0) ? iprot.peekMap() : (_i262 < _map261.size); 
                   ++_i262)
              {
                int _key263;
                SpaceBackupInfo _val264;
                _key263 = iprot.readI32();
                _val264 = new SpaceBackupInfo();
                _val264.read(iprot);
                this.space_backups.put(_key263, _val264);
              }
              iprot.readMapEnd();
            }
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case META_FILES:
          if (__field.type == TType.LIST) {
            {
              TList _list265 = iprot.readListBegin();
              this.meta_files = new ArrayList<byte[]>(Math.max(0, _list265.size));
              for (int _i266 = 0; 
                   (_list265.size < 0) ? iprot.peekList() : (_i266 < _list265.size); 
                   ++_i266)
              {
                byte[] _elem267;
                _elem267 = iprot.readBinary();
                this.meta_files.add(_elem267);
              }
              iprot.readListEnd();
            }
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case BACKUP_NAME:
          if (__field.type == TType.STRING) {
            this.backup_name = iprot.readBinary();
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case FULL:
          if (__field.type == TType.BOOL) {
            this.full = iprot.readBool();
            setFullIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case ALL_SPACES:
          if (__field.type == TType.BOOL) {
            this.all_spaces = iprot.readBool();
            setAll_spacesIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case CREATE_TIME:
          if (__field.type == TType.I64) {
            this.create_time = iprot.readI64();
            setCreate_timeIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case BASE_BACKUP_NAME:
          if (__field.type == TType.STRING) {
            this.base_backup_name = iprot.readBinary();
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case STORAGE_HOSTS:
          if (__field.type == TType.LIST) {
            {
              TList _list268 = iprot.readListBegin();
              this.storage_hosts = new ArrayList<com.vesoft.nebula.HostAddr>(Math.max(0, _list268.size));
              for (int _i269 = 0; 
                   (_list268.size < 0) ? iprot.peekList() : (_i269 < _list268.size); 
                   ++_i269)
              {
                com.vesoft.nebula.HostAddr _elem270;
                _elem270 = new com.vesoft.nebula.HostAddr();
                _elem270.read(iprot);
                this.storage_hosts.add(_elem270);
              }
              iprot.readListEnd();
            }
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        case CLUSTER_ID:
          if (__field.type == TType.I64) {
            this.cluster_id = iprot.readI64();
            setCluster_idIsSet(true);
          } else { 
            TProtocolUtil.skip(iprot, __field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, __field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();


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

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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.space_backups != null) {
      oprot.writeFieldBegin(SPACE_BACKUPS_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.I32, TType.STRUCT, this.space_backups.size()));
        for (Map.Entry<Integer, SpaceBackupInfo> _iter271 : this.space_backups.entrySet())        {
          oprot.writeI32(_iter271.getKey());
          _iter271.getValue().write(oprot);
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.meta_files != null) {
      oprot.writeFieldBegin(META_FILES_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRING, this.meta_files.size()));
        for (byte[] _iter272 : this.meta_files)        {
          oprot.writeBinary(_iter272);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    if (this.backup_name != null) {
      oprot.writeFieldBegin(BACKUP_NAME_FIELD_DESC);
      oprot.writeBinary(this.backup_name);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(FULL_FIELD_DESC);
    oprot.writeBool(this.full);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ALL_SPACES_FIELD_DESC);
    oprot.writeBool(this.all_spaces);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
    oprot.writeI64(this.create_time);
    oprot.writeFieldEnd();
    if (this.base_backup_name != null) {
      oprot.writeFieldBegin(BASE_BACKUP_NAME_FIELD_DESC);
      oprot.writeBinary(this.base_backup_name);
      oprot.writeFieldEnd();
    }
    if (this.storage_hosts != null) {
      oprot.writeFieldBegin(STORAGE_HOSTS_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.storage_hosts.size()));
        for (com.vesoft.nebula.HostAddr _iter273 : this.storage_hosts)        {
          _iter273.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(CLUSTER_ID_FIELD_DESC);
    oprot.writeI64(this.cluster_id);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

  @Override
  public String toString(int indent, boolean prettyPrint) {
    String indentStr = prettyPrint ? TBaseHelper.getIndentedString(indent) : "";
    String newLine = prettyPrint ? "\n" : "";
    String space = prettyPrint ? " " : "";
    StringBuilder sb = new StringBuilder("BackupMeta");
    sb.append(space);
    sb.append("(");
    sb.append(newLine);
    boolean first = true;

    sb.append(indentStr);
    sb.append("space_backups");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getSpace_backups() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getSpace_backups(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("meta_files");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getMeta_files() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getMeta_files(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("backup_name");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getBackup_name() == null) {
      sb.append("null");
    } else {
        int __backup_name_size = Math.min(this.getBackup_name().length, 128);
        for (int i = 0; i < __backup_name_size; i++) {
          if (i != 0) sb.append(" ");
          sb.append(Integer.toHexString(this.getBackup_name()[i]).length() > 1 ? Integer.toHexString(this.getBackup_name()[i]).substring(Integer.toHexString(this.getBackup_name()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getBackup_name()[i]).toUpperCase());
        }
        if (this.getBackup_name().length > 128) sb.append(" ...");
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("full");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isFull(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("all_spaces");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.isAll_spaces(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("create_time");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getCreate_time(), indent + 1, prettyPrint));
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("base_backup_name");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getBase_backup_name() == null) {
      sb.append("null");
    } else {
        int __base_backup_name_size = Math.min(this.getBase_backup_name().length, 128);
        for (int i = 0; i < __base_backup_name_size; i++) {
          if (i != 0) sb.append(" ");
          sb.append(Integer.toHexString(this.getBase_backup_name()[i]).length() > 1 ? Integer.toHexString(this.getBase_backup_name()[i]).substring(Integer.toHexString(this.getBase_backup_name()[i]).length() - 2).toUpperCase() : "0" + Integer.toHexString(this.getBase_backup_name()[i]).toUpperCase());
        }
        if (this.getBase_backup_name().length > 128) sb.append(" ...");
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("storage_hosts");
    sb.append(space);
    sb.append(":").append(space);
    if (this.getStorage_hosts() == null) {
      sb.append("null");
    } else {
      sb.append(TBaseHelper.toString(this.getStorage_hosts(), indent + 1, prettyPrint));
    }
    first = false;
    if (!first) sb.append("," + newLine);
    sb.append(indentStr);
    sb.append("cluster_id");
    sb.append(space);
    sb.append(":").append(space);
    sb.append(TBaseHelper.toString(this.getCluster_id(), indent + 1, prettyPrint));
    first = false;
    sb.append(newLine + TBaseHelper.reduceIndent(indentStr));
    sb.append(")");
    return sb.toString();
  }

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

}

