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 ApiDialog extends BserObject {
  
      private ApiPeer peer;
      private int unreadCount;
      private long sortDate;
      private int senderUid;
      private long rid;
      private long date;
      private ApiMessage message;
      private ApiMessageState state;
      private Long firstUnreadDate;
      private ApiMessageAttributes attributes;
  
      public ApiDialog(@NotNull ApiPeer peer, int unreadCount, long sortDate, int senderUid, long rid, long date, @NotNull ApiMessage message, @Nullable ApiMessageState state, @Nullable Long firstUnreadDate, @Nullable ApiMessageAttributes attributes) {
          this.peer = peer;
          this.unreadCount = unreadCount;
          this.sortDate = sortDate;
          this.senderUid = senderUid;
          this.rid = rid;
          this.date = date;
          this.message = message;
          this.state = state;
          this.firstUnreadDate = firstUnreadDate;
          this.attributes = attributes;
      }
  
      public ApiDialog() {
  
      }
  
      @NotNull
      public ApiPeer getPeer() {
          return this.peer;
      }
  
      public int getUnreadCount() {
          return this.unreadCount;
      }
  
      public long getSortDate() {
          return this.sortDate;
      }
  
      public int getSenderUid() {
          return this.senderUid;
      }
  
      public long getRid() {
          return this.rid;
      }
  
      public long getDate() {
          return this.date;
      }
  
      @NotNull
      public ApiMessage getMessage() {
          return this.message;
      }
  
      @Nullable
      public ApiMessageState getState() {
          return this.state;
      }
  
      @Nullable
      public Long getFirstUnreadDate() {
          return this.firstUnreadDate;
      }
  
      @Nullable
      public ApiMessageAttributes getAttributes() {
          return this.attributes;
      }
  
      @Override
      public void parse(BserValues values) throws IOException {
          this.peer = values.getObj(1, new ApiPeer());
          this.unreadCount = values.getInt(3);
          this.sortDate = values.getLong(4);
          this.senderUid = values.getInt(5);
          this.rid = values.getLong(6);
          this.date = values.getLong(7);
          this.message = ApiMessage.fromBytes(values.getBytes(8));
          int val_state = values.getInt(9, 0);
          if (val_state != 0) {
              this.state = ApiMessageState.parse(val_state);
          }
          this.firstUnreadDate = values.optLong(10);
          this.attributes = values.optObj(11, new ApiMessageAttributes());
      }
  
      @Override
      public void serialize(BserWriter writer) throws IOException {
          if (this.peer == null) {
              throw new IOException();
          }
          writer.writeObject(1, this.peer);
          writer.writeInt(3, this.unreadCount);
          writer.writeLong(4, this.sortDate);
          writer.writeInt(5, this.senderUid);
          writer.writeLong(6, this.rid);
          writer.writeLong(7, this.date);
          if (this.message == null) {
              throw new IOException();
          }
  
          writer.writeBytes(8, this.message.buildContainer());
          if (this.state != null) {
              writer.writeInt(9, this.state.getValue());
          }
          if (this.firstUnreadDate != null) {
              writer.writeLong(10, this.firstUnreadDate);
          }
          if (this.attributes != null) {
              writer.writeObject(11, this.attributes);
          }
      }
  
      @Override
      public String toString() {
          String res = "struct Dialog{";
          res += "peer=" + this.peer;
          res += ", unreadCount=" + this.unreadCount;
          res += ", sortDate=" + this.sortDate;
          res += ", senderUid=" + this.senderUid;
          res += ", rid=" + this.rid;
          res += ", date=" + this.date;
          res += ", message=" + this.message;
          res += ", firstUnreadDate=" + this.firstUnreadDate;
          res += ", attributes=" + this.attributes;
          res += "}";
          return res;
      }
  
  }
  