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 ApiEncryptedBox extends BserObject {
private int senderKeyGroupId;
private List<ApiEncyptedBoxKey> keys;
private String algType;
private byte[] encPackage;
private List<ApiEncryptedBoxSignature> signatures;
public ApiEncryptedBox(int senderKeyGroupId, @NotNull List<ApiEncyptedBoxKey> keys, @NotNull String algType, @NotNull byte[] encPackage, @NotNull List<ApiEncryptedBoxSignature> signatures) {
this.senderKeyGroupId = senderKeyGroupId;
this.keys = keys;
this.algType = algType;
this.encPackage = encPackage;
this.signatures = signatures;
}
public ApiEncryptedBox() {
}
public int getSenderKeyGroupId() {
return this.senderKeyGroupId;
}
@NotNull
public List<ApiEncyptedBoxKey> getKeys() {
return this.keys;
}
@NotNull
public String getAlgType() {
return this.algType;
}
@NotNull
public byte[] getEncPackage() {
return this.encPackage;
}
@NotNull
public List<ApiEncryptedBoxSignature> getSignatures() {
return this.signatures;
}
@Override
public void parse(BserValues values) throws IOException {
this.senderKeyGroupId = values.getInt(4);
List<ApiEncyptedBoxKey> _keys = new ArrayList<ApiEncyptedBoxKey>();
for (int i = 0; i < values.getRepeatedCount(1); i ++) {
_keys.add(new ApiEncyptedBoxKey());
}
this.keys = values.getRepeatedObj(1, _keys);
this.algType = values.getString(2);
this.encPackage = values.getBytes(3);
List<ApiEncryptedBoxSignature> _signatures = new ArrayList<ApiEncryptedBoxSignature>();
for (int i = 0; i < values.getRepeatedCount(5); i ++) {
_signatures.add(new ApiEncryptedBoxSignature());
}
this.signatures = values.getRepeatedObj(5, _signatures);
if (values.hasRemaining()) {
setUnmappedObjects(values.buildRemaining());
}
}
@Override
public void serialize(BserWriter writer) throws IOException {
writer.writeInt(4, this.senderKeyGroupId);
writer.writeRepeatedObj(1, this.keys);
if (this.algType == null) {
throw new IOException();
}
writer.writeString(2, this.algType);
if (this.encPackage == null) {
throw new IOException();
}
writer.writeBytes(3, this.encPackage);
writer.writeRepeatedObj(5, this.signatures);
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 EncryptedBox{";
res += "senderKeyGroupId=" + this.senderKeyGroupId;
res += ", keys=" + this.keys;
res += ", algType=" + this.algType;
res += ", encPackage=" + byteArrayToString(this.encPackage);
res += "}";
return res;
}
}