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 WeakFatUpdate extends RpcScope {
public static final int HEADER = 0xa71;
public static WeakFatUpdate fromBytes(byte[] data) throws IOException {
return Bser.parse(new WeakFatUpdate(), data);
}
private long date;
private int updateHeader;
private byte[] update;
private List<ApiUser> users;
private List<ApiGroup> groups;
public WeakFatUpdate(long date, int updateHeader, @NotNull byte[] update, @NotNull List<ApiUser> users, @NotNull List<ApiGroup> groups) {
this.date = date;
this.updateHeader = updateHeader;
this.update = update;
this.users = users;
this.groups = groups;
}
public WeakFatUpdate() {
}
public long getDate() {
return this.date;
}
public int getUpdateHeader() {
return this.updateHeader;
}
@NotNull
public byte[] getUpdate() {
return this.update;
}
@NotNull
public List<ApiUser> getUsers() {
return this.users;
}
@NotNull
public List<ApiGroup> getGroups() {
return this.groups;
}
@Override
public void parse(BserValues values) throws IOException {
this.date = values.getLong(1);
this.updateHeader = values.getInt(2);
this.update = 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);
}
@Override
public void serialize(BserWriter writer) throws IOException {
writer.writeLong(1, this.date);
writer.writeInt(2, this.updateHeader);
if (this.update == null) {
throw new IOException();
}
writer.writeBytes(3, this.update);
writer.writeRepeatedObj(4, this.users);
writer.writeRepeatedObj(5, this.groups);
}
@Override
public String toString() {
String res = "update box WeakFatUpdate{";
res += "date=" + this.date;
res += ", updateHeader=" + this.updateHeader;
res += ", update=" + byteArrayToString(this.update);
res += ", users=" + this.users;
res += ", groups=" + this.groups;
res += "}";
return res;
}
@Override
public int getHeaderKey() {
return HEADER;
}
}