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 ApiEncryptionKeyGroup extends BserObject {
private int keyGroupId;
private List<String> supportedEncryption;
private ApiEncryptionKey identityKey;
private List<ApiEncryptionKey> keys;
private List<ApiEncryptionKeySignature> signatures;
public ApiEncryptionKeyGroup(int keyGroupId, @NotNull List<String> supportedEncryption, @NotNull ApiEncryptionKey identityKey, @NotNull List<ApiEncryptionKey> keys, @NotNull List<ApiEncryptionKeySignature> signatures) {
this.keyGroupId = keyGroupId;
this.supportedEncryption = supportedEncryption;
this.identityKey = identityKey;
this.keys = keys;
this.signatures = signatures;
}
public ApiEncryptionKeyGroup() {
}
public int getKeyGroupId() {
return this.keyGroupId;
}
@NotNull
public List<String> getSupportedEncryption() {
return this.supportedEncryption;
}
@NotNull
public ApiEncryptionKey getIdentityKey() {
return this.identityKey;
}
@NotNull
public List<ApiEncryptionKey> getKeys() {
return this.keys;
}
@NotNull
public List<ApiEncryptionKeySignature> getSignatures() {
return this.signatures;
}
@Override
public void parse(BserValues values) throws IOException {
this.keyGroupId = values.getInt(1);
this.supportedEncryption = values.getRepeatedString(2);
this.identityKey = values.getObj(3, new ApiEncryptionKey());
List<ApiEncryptionKey> _keys = new ArrayList<ApiEncryptionKey>();
for (int i = 0; i < values.getRepeatedCount(4); i ++) {
_keys.add(new ApiEncryptionKey());
}
this.keys = values.getRepeatedObj(4, _keys);
List<ApiEncryptionKeySignature> _signatures = new ArrayList<ApiEncryptionKeySignature>();
for (int i = 0; i < values.getRepeatedCount(5); i ++) {
_signatures.add(new ApiEncryptionKeySignature());
}
this.signatures = values.getRepeatedObj(5, _signatures);
if (values.hasRemaining()) {
setUnmappedObjects(values.buildRemaining());
}
}
@Override
public void serialize(BserWriter writer) throws IOException {
writer.writeInt(1, this.keyGroupId);
writer.writeRepeatedString(2, this.supportedEncryption);
if (this.identityKey == null) {
throw new IOException();
}
writer.writeObject(3, this.identityKey);
writer.writeRepeatedObj(4, this.keys);
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 EncryptionKeyGroup{";
res += "keyGroupId=" + this.keyGroupId;
res += ", supportedEncryption=" + this.supportedEncryption;
res += ", identityKey=" + this.identityKey;
res += ", keys=" + this.keys.size();
res += ", signatures=" + this.signatures.size();
res += "}";
return res;
}
}