content: package im.actor.core.api;
  /*
   *  Generated by the Actor API Scheme generator.  DO NOT EDIT!
   */
  
  import im.actor.runtime.bser.*;
  import im.actor.runtime.collections.*;
  import static im.actor.runtime.bser.Utils.*;
  import im.actor.core.network.parser.*;
  import org.jetbrains.annotations.Nullable;
  import org.jetbrains.annotations.NotNull;
  import com.google.j2objc.annotations.ObjectiveCName;
  import java.io.IOException;
  import java.util.List;
  import java.util.ArrayList;
  
  public class ApiUser extends BserObject {
  
      private int id;
      private long accessHash;
      private String name;
      private String localName;
      private String nick;
      private ApiSex sex;
      private ApiAvatar avatar;
      private Boolean isBot;
      private ApiMapValue ext;
  
      public ApiUser(int id, long accessHash, @NotNull String name, @Nullable String localName, @Nullable String nick, @Nullable ApiSex sex, @Nullable ApiAvatar avatar, @Nullable Boolean isBot, @Nullable ApiMapValue ext) {
          this.id = id;
          this.accessHash = accessHash;
          this.name = name;
          this.localName = localName;
          this.nick = nick;
          this.sex = sex;
          this.avatar = avatar;
          this.isBot = isBot;
          this.ext = ext;
      }
  
      public ApiUser() {
  
      }
  
      public int getId() {
          return this.id;
      }
  
      public long getAccessHash() {
          return this.accessHash;
      }
  
      @NotNull
      public String getName() {
          return this.name;
      }
  
      @Nullable
      public String getLocalName() {
          return this.localName;
      }
  
      @Nullable
      public String getNick() {
          return this.nick;
      }
  
      @Nullable
      public ApiSex getSex() {
          return this.sex;
      }
  
      @Nullable
      public ApiAvatar getAvatar() {
          return this.avatar;
      }
  
      @Nullable
      public Boolean isBot() {
          return this.isBot;
      }
  
      @Nullable
      public ApiMapValue getExt() {
          return this.ext;
      }
  
      @Override
      public void parse(BserValues values) throws IOException {
          this.id = values.getInt(1);
          this.accessHash = values.getLong(2);
          this.name = values.getString(3);
          this.localName = values.optString(4);
          this.nick = values.optString(13);
          int val_sex = values.getInt(5, 0);
          if (val_sex != 0) {
              this.sex = ApiSex.parse(val_sex);
          }
          this.avatar = values.optObj(8, new ApiAvatar());
          this.isBot = values.optBool(11);
          this.ext = values.optObj(20, new ApiMapValue());
          if (values.hasRemaining()) {
              setUnmappedObjects(values.buildRemaining());
          }
      }
  
      @Override
      public void serialize(BserWriter writer) throws IOException {
          writer.writeInt(1, this.id);
          writer.writeLong(2, this.accessHash);
          if (this.name == null) {
              throw new IOException();
          }
          writer.writeString(3, this.name);
          if (this.localName != null) {
              writer.writeString(4, this.localName);
          }
          if (this.nick != null) {
              writer.writeString(13, this.nick);
          }
          if (this.sex != null) {
              writer.writeInt(5, this.sex.getValue());
          }
          if (this.avatar != null) {
              writer.writeObject(8, this.avatar);
          }
          if (this.isBot != null) {
              writer.writeBool(11, this.isBot);
          }
          if (this.ext != null) {
              writer.writeObject(20, this.ext);
          }
          if (this.getUnmappedObjects() != null) {
              SparseArray<Object> unmapped = this.getUnmappedObjects();
              for (int i = 0; i < unmapped.size(); i++) {
                  int key = unmapped.keyAt(i);
                  writer.writeUnmapped(key, unmapped.get(key));
              }
          }
      }
  
      @Override
      public String toString() {
          String res = "struct User{";
          res += "id=" + this.id;
          res += ", name=" + this.name;
          res += ", localName=" + this.localName;
          res += ", nick=" + this.nick;
          res += ", sex=" + this.sex;
          res += ", avatar=" + (this.avatar != null ? "set":"empty");
          res += ", isBot=" + this.isBot;
          res += ", ext=" + this.ext;
          res += "}";
          return res;
      }
  
  }
  