package im.actor.core.api.base;
/*
* 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;
import im.actor.core.api.*;
public class CombinedUpdate extends RpcScope {
public static final int HEADER = 0xa41;
public static CombinedUpdate fromBytes(byte[] data) throws IOException {
return Bser.parse(new CombinedUpdate(), data);
}
private int seqStart;
private int seqEnd;
private byte[] state;
private List<ApiUser> users;
private List<ApiGroup> groups;
private List<ApiUpdateContainer> updates;
private List<ApiMessageContainer> messages;
public CombinedUpdate(int seqStart, int seqEnd, @NotNull byte[] state, @NotNull List<ApiUser> users, @NotNull List<ApiGroup> groups, @NotNull List<ApiUpdateContainer> updates, @NotNull List<ApiMessageContainer> messages) {
this.seqStart = seqStart;
this.seqEnd = seqEnd;
this.state = state;
this.users = users;
this.groups = groups;
this.updates = updates;
this.messages = messages;
}
public CombinedUpdate() {
}
public int getSeqStart() {
return this.seqStart;
}
public int getSeqEnd() {
return this.seqEnd;
}
@NotNull
public byte[] getState() {
return this.state;
}
@NotNull
public List<ApiUser> getUsers() {
return this.users;
}
@NotNull
public List<ApiGroup> getGroups() {
return this.groups;
}
@NotNull
public List<ApiUpdateContainer> getUpdates() {
return this.updates;
}
@NotNull
public List<ApiMessageContainer> getMessages() {
return this.messages;
}
@Override
public void parse(BserValues values) throws IOException {
this.seqStart = values.getInt(1);
this.seqEnd = values.getInt(2);
this.state = values.getBytes(3);
List<ApiUser> _users = new ArrayList<ApiUser>();
for (int i = 0; i < values.getRepeatedCount(4); i ++) {
_users.add(new ApiUser());
}
this.users = values.getRepeatedObj(4, _users);
List<ApiGroup> _groups = new ArrayList<ApiGroup>();
for (int i = 0; i < values.getRepeatedCount(5); i ++) {
_groups.add(new ApiGroup());
}
this.groups = values.getRepeatedObj(5, _groups);
List<ApiUpdateContainer> _updates = new ArrayList<ApiUpdateContainer>();
for (int i = 0; i < values.getRepeatedCount(6); i ++) {
_updates.add(new ApiUpdateContainer());
}
this.updates = values.getRepeatedObj(6, _updates);
List<ApiMessageContainer> _messages = new ArrayList<ApiMessageContainer>();
for (int i = 0; i < values.getRepeatedCount(7); i ++) {
_messages.add(new ApiMessageContainer());
}
this.messages = values.getRepeatedObj(7, _messages);
}
@Override
public void serialize(BserWriter writer) throws IOException {
writer.writeInt(1, this.seqStart);
writer.writeInt(2, this.seqEnd);
if (this.state == null) {
throw new IOException();
}
writer.writeBytes(3, this.state);
writer.writeRepeatedObj(4, this.users);
writer.writeRepeatedObj(5, this.groups);
writer.writeRepeatedObj(6, this.updates);
writer.writeRepeatedObj(7, this.messages);
}
@Override
public String toString() {
String res = "update box CombinedUpdate{";
res += "seqStart=" + this.seqStart;
res += ", seqEnd=" + this.seqEnd;
res += ", state=" + byteArrayToString(this.state);
res += ", users=" + this.users.size();
res += ", groups=" + this.groups.size();
res += ", updates=" + this.updates;
res += ", messages=" + this.messages;
res += "}";
return res;
}
@Override
public int getHeaderKey() {
return HEADER;
}
}