"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EndUserCryptoHeader = exports.EndUserTransportHeader = exports.EndUserDeviceContext = exports.EndUserSCClientStatistic = exports.EndUserSession = exports.EndUserOperationContext = exports.EndUserParams = exports.EndUserInfo = exports.EndUserRequestInfo = exports.EndUserJKSPrivateKey = exports.EndUserPrivateKeyInfo = exports.EndUserCRLInfo = exports.EndUserCertificate = exports.EndUserCertificateInfoEx = exports.EndUserCertificateInfo = exports.EndUserSenderInfo = exports.EndUserSignInfo = exports.EndUserTimeInfo = exports.EndUserOwnerInfo = exports.EndUserKeyMediaSettings = exports.EndUserOCSPAccessInfoSettings = exports.EndUserOCSPAccessInfoModeSettings = exports.EndUserModeSettings = exports.EndUserCMPSettings = exports.EndUserLDAPSettings = exports.EndUserOCSPSettings = exports.EndUserTSPSettings = exports.EndUserProxySettings = exports.EndUserFileStoreSettings = exports.EndUserKeyMedia = exports.EndUserByteArray = exports.EndUserTransferableObject = exports.IsEndUserTransferableObject = exports.InheritObject = exports.EndUserUint8Array = exports.EU_ABBREVIATIONS = exports.EndUserArrayList = exports.EU_SIGN_CP_FIELD_NAME_CLASS_FIELDS = exports.EU_SIGN_CP_FIELD_NAME_CLASS_NAME = exports.EU_SIGN_CP_FIELD_NAME_CLASS_VERSION = void 0;
const base64coder_1 = require("./base64coder");
const datecoder_1 = require("./datecoder");
const stringcoder_1 = require("./stringcoder");
exports.EU_SIGN_CP_FIELD_NAME_CLASS_VERSION = 'classVersion';
exports.EU_SIGN_CP_FIELD_NAME_CLASS_NAME = 'className';
exports.EU_SIGN_CP_FIELD_NAME_CLASS_FIELDS = 'classFields';
//================================================================================
class EndUserArrayList {
    constructor() {
        this.vendor = 'JSC IIT';
        this.parentClassName = 'Object';
        this.className = 'EndUserArrayList';
        this.classVersion = 1;
        this.m_array = [];
    }
    add(obj) {
        this.m_array.push(obj);
        return true;
    }
    clear() {
        this.m_array = [];
    }
    get(index) {
        return this.m_array[index];
    }
    size() {
        return this.m_array.length;
    }
}
exports.EndUserArrayList = EndUserArrayList;
//================================================================================
exports.EU_ABBREVIATIONS = {
    'dns': 'DNS',
    'edrpouCode': 'EDRPOUCode',
    'drfoCode': 'DRFOCode',
    'nbuCode': 'NBUCode',
    'spfmCode': 'SPFMCode',
    'ouCode': 'OUCode',
    'upn': 'UPN',
    'crlNumber': 'CRLNumber',
    'crlDistribPoint1': 'CRLDistribPoint1',
    'crlDistribPoint2': 'CRLDistribPoint2',
    'isLimitValueAvailable': 'IsLimitValueAvail',
    'caType': 'CAType'
};
//--------------------------------------------------------------------------------
const capitalizeEx = function (text) {
    // @ts-ignore
    if (typeof exports.EU_ABBREVIATIONS[text] !== 'undefined') { // @ts-ignore
        return exports.EU_ABBREVIATIONS[text];
    }
    return text.charAt(0).toUpperCase() + text.slice(1);
};
//--------------------------------------------------------------------------------
if (!Object.create) {
    // @ts-ignore
    Object.create = function (o, properties) {
        if ((typeof o !== 'object' && typeof o !== 'function') ||
            (o === null) || (typeof properties != 'undefined')) {
            throw new Error('Invalid arguments');
        }
        function F() {
        }
        F.prototype = o;
        // @ts-ignore
        return new F();
    };
}
//--------------------------------------------------------------------------------
if (!Uint8Array.prototype.slice) {
    Uint8Array.prototype.slice = Uint8Array.prototype.subarray;
}
//--------------------------------------------------------------------------------
exports.EndUserUint8Array = null;
if (typeof Uint8Array == 'undefined') {
    exports.EndUserUint8Array = function (arg1) {
        var result;
        if (typeof arg1 === 'number') {
            result = new Array(arg1);
            for (var i = 0; i < arg1; ++i)
                result[i] = 0;
        }
        else {
            result = arg1.slice(0);
        }
        result.buffer = result;
        result.subarray = function (start, end) {
            return result.slice(start, end);
        };
        result.set = function (array, offset) {
            if (arguments.length < 2)
                offset = 0;
            for (var i = 0, n = array.length; i < n; ++i, ++offset)
                result[offset] = array[i] & 0xFF;
        };
        result.byteLength = result.length;
        if (typeof arg1 === 'object' && arg1.buffer)
            result.buffer = arg1.buffer;
        return result;
    };
}
else {
    exports.EndUserUint8Array = Uint8Array;
}
//--------------------------------------------------------------------------------
function InheritObject(child, parent) {
    child.prototype = Object.create(parent.prototype);
    child.prototype.constructor = child;
}
exports.InheritObject = InheritObject;
//================================================================================
function IsEndUserTransferableObject(object) {
    if (object == null || (typeof object != 'object'))
        return false;
    if (object.className != 'EndUserTransferableObject' &&
        object.parentClassName != 'EndUserTransferableObject') {
        return false;
    }
    return true;
}
exports.IsEndUserTransferableObject = IsEndUserTransferableObject;
//--------------------------------------------------------------------------------
var EndUserTransferableObject = function () {
    this.vendor = 'JSC IIT';
    this.parentClassName = 'Object';
    this.className = 'EndUserTransferableObject';
    this.classVersion = 1;
    this.hasGetters = true;
    this.hasSetters = false;
    this.isFilled = false;
    this.fields = {};
};
exports.EndUserTransferableObject = EndUserTransferableObject;
//--------------------------------------------------------------------------------
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable = function (objectConstructor) {
    InheritObject(objectConstructor, exports.EndUserTransferableObject);
    // @ts-ignore
    exports.EndUserTransferableObject[(new objectConstructor()).className] =
        objectConstructor;
};
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.base64Coder = new base64coder_1.EndUserBase64Coder();
exports.EndUserTransferableObject.prototype.dateCoder = new datecoder_1.EndUserDateCoder();
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.setClassInfo = function (name, version, hasGetters, hasSetters) {
    this.parentClassName = 'EndUserTransferableObject';
    this.className = name;
    this.classVersion = version;
    this.hasGetters = hasGetters;
    this.hasSetters = hasSetters;
};
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.initializeFields = function () {
    for (var key in this.fields) {
        switch (this.fields[key]) {
            case 'boolean':
                this[key] = false;
                break;
            case 'int':
            case 'long':
            case 'number':
                this[key] = 0;
                break;
            case 'string':
                this[key] = '';
                break;
            case 'EndUserKeyMedia':
                // @ts-ignore
                this[key] = new exports.EndUserKeyMedia();
                break;
            default:
                this[key] = null;
        }
    }
    this.generateAccessMethods();
};
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.generateAccessMethods = function () {
    var funcBaseName;
    var funcName, funcBody;
    for (var key in this.fields) {
        funcBaseName = capitalizeEx(key);
        if (this.hasGetters) {
            funcName = (this.hasSetters || this.fields[key] != 'boolean') ?
                ('Get' + funcBaseName) : funcBaseName;
            funcBody = Function('return this.' + key + ';');
            this[funcName] = funcBody;
        }
        if (this.hasSetters) {
            funcName = 'Set' + funcBaseName;
            funcBody = Function('value', 'this.' + key + ' = value;');
            this[funcName] = funcBody;
        }
    }
};
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.set = function (object) {
    if (this.className != object.className)
        throw 'invalid class';
    for (var key in this.fields)
        this[key] = object[key];
};
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.encode = function () {
    var object;
    var fields;
    var fieldName;
    fields = new Object();
    object = new Object();
    for (var key in this.fields) {
        if (this[key] == null) {
            fields[key] = null;
            continue;
        }
        if (IsEndUserTransferableObject(this[key])) {
            fields[key] = this[key].encode();
        }
        else if (this.fields[key] == 'byteArray') {
            fields[key] = this.base64Coder.encode(this[key]);
        }
        else if (this.fields[key] == 'time') {
            fields[key] = this.dateCoder.encode(this[key]);
        }
        else {
            fields[key] = this[key];
        }
    }
    object[exports.EU_SIGN_CP_FIELD_NAME_CLASS_NAME] = this.className;
    object[exports.EU_SIGN_CP_FIELD_NAME_CLASS_VERSION] = this.classVersion;
    object[exports.EU_SIGN_CP_FIELD_NAME_CLASS_FIELDS] = fields;
    return object;
};
//--------------------------------------------------------------------------------
exports.EndUserTransferableObject.prototype.decode = function (object) {
    try {
        if (object[exports.EU_SIGN_CP_FIELD_NAME_CLASS_VERSION] == null ||
            object[exports.EU_SIGN_CP_FIELD_NAME_CLASS_FIELDS] == null) {
            return false;
        }
        var fields = object[exports.EU_SIGN_CP_FIELD_NAME_CLASS_FIELDS];
        for (var key in this.fields) {
            if (this.fields[key] == 'time') {
                this[key] = this.dateCoder.decode(fields[key]);
            }
            else if (this.fields[key] == 'EndUserOwnerInfo') {
                // @ts-ignore
                this[key] = new exports.EndUserOwnerInfo();
                this[key].decode(fields[key]);
            }
            else if (this.fields[key] == 'EndUserTimeInfo') {
                // @ts-ignore
                this[key] = new exports.EndUserTimeInfo();
                this[key].decode(fields[key]);
            }
            else if (this.fields[key] == 'EndUserKeyMedia') {
                // @ts-ignore
                this[key] = new exports.EndUserKeyMedia();
                this[key].decode(fields[key]);
            }
            else if (this.fields[key] == 'EndUserCertificateInfoEx') {
                // @ts-ignore
                this[key] = new exports.EndUserCertificateInfoEx();
                this[key].decode(fields[key]);
            }
            else if (this.fields[key] == 'byteArray') {
                if (fields[key] != null)
                    this[key] = this.base64Coder.decode(fields[key]);
            }
            else if (this.fields[key] == 'array') {
                this[key] = [];
                var array = fields[key];
                for (var i = 0; i < array.length; i++) {
                    var className = array[i][exports.EU_SIGN_CP_FIELD_NAME_CLASS_NAME];
                    // @ts-ignore
                    var classVariable = new (exports.EndUserTransferableObject[className])();
                    if (typeof classVariable !== 'undefined') {
                        if (!classVariable.decode(array[i]))
                            throw 'invalid class';
                        if (classVariable.className == 'EndUserByteArray')
                            classVariable = classVariable.GetData();
                        this[key].push(classVariable);
                    }
                    else {
                        this[key].push(array[i]);
                    }
                }
            }
            else {
                this[key] = fields[key];
            }
        }
        return true;
    }
    catch (e) {
        this.isFilled = false;
        return false;
    }
};
//================================================================================
const EndUserByteArray = function (data) {
    this.setClassInfo('EndUserByteArray', 1, true, true);
    this.fields = {
        'data': 'byteArray'
    };
    this.initializeFields();
    this.data = data;
};
exports.EndUserByteArray = EndUserByteArray;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserByteArray);
//================================================================================
const EndUserKeyMedia = function () {
    this.setClassInfo('EndUserKeyMedia', 1, true, true);
    this.fields = {
        'typeIndex': 'long',
        'devIndex': 'long',
        'password': 'string'
    };
    this.initializeFields();
};
exports.EndUserKeyMedia = EndUserKeyMedia;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserKeyMedia);
//================================================================================
const EndUserFileStoreSettings = function () {
    this.setClassInfo('EndUserFileStoreSettings', 1, true, true);
    this.fields = {
        'path': 'string',
        'checkCRLs': 'boolean',
        'autoRefresh': 'boolean',
        'ownCRLsOnly': 'boolean',
        'fullAndDeltaCRLs': 'boolean',
        'autoDownloadCRLs': 'boolean',
        'saveLoadedCerts': 'boolean',
        'expireTime': 'long'
    };
    this.initializeFields();
    this.expireTime = 3600;
};
exports.EndUserFileStoreSettings = EndUserFileStoreSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserFileStoreSettings);
//--------------------------------------------------------------------------------
const EndUserProxySettings = function () {
    this.setClassInfo('EndUserProxySettings', 1, true, true);
    this.fields = {
        'useProxy': 'boolean',
        'anonymous': 'boolean',
        'address': 'string',
        'port': 'string',
        'user': 'string',
        'password': 'string',
        'savePassword': 'boolean'
    };
    this.initializeFields();
    this.port = '80';
};
exports.EndUserProxySettings = EndUserProxySettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserProxySettings);
//--------------------------------------------------------------------------------
const EndUserTSPSettings = function () {
    this.setClassInfo('EndUserTSPSettings', 1, true, true);
    this.fields = {
        'getStamps': 'boolean',
        'address': 'string',
        'port': 'string'
    };
    this.initializeFields();
    this.port = '80';
};
exports.EndUserTSPSettings = EndUserTSPSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserTSPSettings);
//--------------------------------------------------------------------------------
const EndUserOCSPSettings = function () {
    this.setClassInfo('EndUserOCSPSettings', 1, true, true);
    this.fields = {
        'useOCSP': 'boolean',
        'beforeStore': 'boolean',
        'address': 'string',
        'port': 'string'
    };
    this.initializeFields();
    this.port = '80';
};
exports.EndUserOCSPSettings = EndUserOCSPSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserOCSPSettings);
//--------------------------------------------------------------------------------
const EndUserLDAPSettings = function () {
    this.setClassInfo('EndUserLDAPSettings', 1, true, true);
    this.fields = {
        'useLDAP': 'boolean',
        'address': 'string',
        'port': 'string',
        'anonymous': 'boolean',
        'user': 'string',
        'password': 'string'
    };
    this.initializeFields();
    this.port = '389';
};
exports.EndUserLDAPSettings = EndUserLDAPSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserLDAPSettings);
//--------------------------------------------------------------------------------
const EndUserCMPSettings = function () {
    this.setClassInfo('EndUserCMPSettings', 1, true, true);
    this.fields = {
        'useCMP': 'boolean',
        'address': 'string',
        'port': 'string',
        'commonName': 'string'
    };
    this.initializeFields();
    this.port = '80';
};
exports.EndUserCMPSettings = EndUserCMPSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserCMPSettings);
//--------------------------------------------------------------------------------
const EndUserModeSettings = function () {
    this.setClassInfo('EndUserModeSettings', 1, true, true);
    this.fields = {
        'offlineMode': 'boolean'
    };
    this.initializeFields();
};
exports.EndUserModeSettings = EndUserModeSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserModeSettings);
//--------------------------------------------------------------------------------
const EndUserOCSPAccessInfoModeSettings = function () {
    this.setClassInfo('EndUserOCSPAccessInfoModeSettings', 1, true, true);
    this.fields = {
        'enabled': 'boolean'
    };
    this.initializeFields();
};
exports.EndUserOCSPAccessInfoModeSettings = EndUserOCSPAccessInfoModeSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserOCSPAccessInfoModeSettings);
//--------------------------------------------------------------------------------
const EndUserOCSPAccessInfoSettings = function () {
    this.setClassInfo('EndUserOCSPAccessInfoSettings', 1, true, true);
    this.fields = {
        'issuerCN': 'string',
        'address': 'string',
        'port': 'string'
    };
    this.initializeFields();
};
exports.EndUserOCSPAccessInfoSettings = EndUserOCSPAccessInfoSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserOCSPAccessInfoSettings);
//--------------------------------------------------------------------------------
const EndUserKeyMediaSettings = function () {
    this.setClassInfo('EndUserKeyMediaSettings', 1, true, true);
    this.fields = {
        'sourceType': 'long',
        'showErrors': 'boolean',
        'keyMedia': 'EndUserKeyMedia'
    };
    this.initializeFields();
    this.sourceType = 1;
    this.showErrors = true;
};
exports.EndUserKeyMediaSettings = EndUserKeyMediaSettings;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserKeyMediaSettings);
//================================================================================
const EndUserOwnerInfo = function () {
    this.setClassInfo('EndUserOwnerInfo', 1, true, false);
    this.fields = {
        'isFilled': 'boolean',
        'issuer': 'string',
        'issuerCN': 'string',
        'serial': 'string',
        'subject': 'string',
        'subjCN': 'string',
        'subjOrg': 'string',
        'subjOrgUnit': 'string',
        'subjTitle': 'string',
        'subjState': 'string',
        'subjLocality': 'string',
        'subjFullName': 'string',
        'subjAddress': 'string',
        'subjPhone': 'string',
        'subjEMail': 'string',
        'subjDNS': 'string',
        'subjEDRPOUCode': 'string',
        'subjDRFOCode': 'string'
    };
    this.initializeFields();
};
exports.EndUserOwnerInfo = EndUserOwnerInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserOwnerInfo);
//================================================================================
const EndUserTimeInfo = function () {
    this.setClassInfo('EndUserTimeInfo', 2, true, false);
    this.fields = {
        'version': 'number',
        'isTimeAvail': 'boolean',
        'isTimeStamp': 'boolean',
        'time': 'time',
        'isSignTimeStampAvail': 'boolean',
        'signTimeStamp': 'time'
    };
    this.initializeFields();
};
exports.EndUserTimeInfo = EndUserTimeInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserTimeInfo);
//================================================================================
const EndUserSignInfo = function () {
    this.setClassInfo('EndUserSignInfo', 1, true, false);
    this.fields = {
        'ownerInfo': 'EndUserOwnerInfo',
        'timeInfo': 'EndUserTimeInfo',
        'data': 'byteArray'
    };
    this.initializeFields();
    var pThis = this;
    this.GetDataString = function (charset) {
        return stringcoder_1.EndUserStringCoder.ArrayToString(charset, pThis.data);
    };
};
exports.EndUserSignInfo = EndUserSignInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserSignInfo);
//================================================================================
const EndUserSenderInfo = function () {
    this.setClassInfo('EndUserSenderInfo', 1, true, false);
    this.fields = {
        'ownerInfo': 'EndUserOwnerInfo',
        'timeInfo': 'EndUserTimeInfo',
        'data': 'byteArray'
    };
    this.initializeFields();
    var pThis = this;
    this.GetDataString = function (charset) {
        return stringcoder_1.EndUserStringCoder.ArrayToString(charset, pThis.data);
    };
};
exports.EndUserSenderInfo = EndUserSenderInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserSenderInfo);
//================================================================================
const EndUserCertificateInfo = function () {
    this.setClassInfo('EndUserCertificateInfo', 1, true, false);
    this.fields = {
        'isFilled': 'boolean',
        'version': 'long',
        'issuer': 'string',
        'issuerCN': 'string',
        'serial': 'string',
        'subject': 'string',
        'subjCN': 'string',
        'subjOrg': 'string',
        'subjOrgUnit': 'string',
        'subjTitle': 'string',
        'subjState': 'string',
        'subjLocality': 'string',
        'subjFullName': 'string',
        'subjAddress': 'string',
        'subjPhone': 'string',
        'subjEMail': 'string',
        'subjDNS': 'string',
        'subjEDRPOUCode': 'string',
        'subjDRFOCode': 'string',
        'subjNBUCode': 'string',
        'subjSPFMCode': 'string',
        'subjOCode': 'string',
        'subjOUCode': 'string',
        'subjUserCode': 'string',
        'certBeginTime': 'time',
        'certEndTime': 'time',
        'isPrivKeyTimesAvail': 'boolean',
        'privKeyBeginTime': 'time',
        'privKeyEndTime': 'time',
        'publicKeyBits': 'long',
        'publicKey': 'string',
        'publicKeyID': 'string',
        'isECDHPublicKeyAvail': 'boolean',
        'ECDHPublicKeyBits': 'long',
        'ECDHPublicKey': 'string',
        'ECDHPublicKeyID': 'string',
        'issuerPublicKeyID': 'string',
        'keyUsage': 'string',
        'extKeyUsages': 'string',
        'policies': 'string',
        'crlDistribPoint1': 'string',
        'crlDistribPoint2': 'string',
        'isPowerCert': 'boolean',
        'isSubjTypeAvail': 'boolean',
        'isSubjCA': 'boolean'
    };
    this.initializeFields();
};
exports.EndUserCertificateInfo = EndUserCertificateInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserCertificateInfo);
//--------------------------------------------------------------------------------
const EndUserCertificateInfoEx = function () {
    this.setClassInfo('EndUserCertificateInfoEx', 5, true, false);
    this.fields = {
        'isFilled': 'boolean',
        'version': 'long',
        'issuer': 'string',
        'issuerCN': 'string',
        'serial': 'string',
        'subject': 'string',
        'subjCN': 'string',
        'subjOrg': 'string',
        'subjOrgUnit': 'string',
        'subjTitle': 'string',
        'subjState': 'string',
        'subjLocality': 'string',
        'subjFullName': 'string',
        'subjAddress': 'string',
        'subjPhone': 'string',
        'subjEMail': 'string',
        'subjDNS': 'string',
        'subjEDRPOUCode': 'string',
        'subjDRFOCode': 'string',
        'subjNBUCode': 'string',
        'subjSPFMCode': 'string',
        'subjOCode': 'string',
        'subjOUCode': 'string',
        'subjUserCode': 'string',
        'certBeginTime': 'time',
        'certEndTime': 'time',
        'isPrivKeyTimesAvail': 'boolean',
        'privKeyBeginTime': 'time',
        'privKeyEndTime': 'time',
        'publicKeyBits': 'long',
        'publicKey': 'string',
        'publicKeyID': 'string',
        'issuerPublicKeyID': 'string',
        'keyUsage': 'string',
        'extKeyUsages': 'string',
        'policies': 'string',
        'crlDistribPoint1': 'string',
        'crlDistribPoint2': 'string',
        'isPowerCert': 'boolean',
        'isSubjTypeAvail': 'boolean',
        'isSubjCA': 'boolean',
        'chainLength': 'int',
        'UPN': 'string',
        'publicKeyType': 'long',
        'keyUsageType': 'long',
        'RSAModul': 'string',
        'RSAExponent': 'string',
        'OCSPAccessInfo': 'string',
        'issuerAccessInfo': 'string',
        'TSPAccessInfo': 'string',
        'isLimitValueAvailable': 'boolean',
        'limitValue': 'long',
        'limitValueCurrency': 'string',
        'subjType': 'long',
        'subjSubType': 'long',
        'subjUNZR': 'string',
        'subjCountry': 'string',
        'fingerprint': 'string'
    };
    this.initializeFields();
    var pThis = this;
    this.IsLimitValueAvailable = function () {
        return pThis.isLimitValueAvailable;
    };
};
exports.EndUserCertificateInfoEx = EndUserCertificateInfoEx;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserCertificateInfoEx);
//--------------------------------------------------------------------------------
const EndUserCertificate = function () {
    this.setClassInfo('EndUserCertificate', 1, true, true);
    this.fields = {
        'infoEx': 'EndUserCertificateInfoEx',
        'data': 'byteArray'
    };
    this.initializeFields();
};
exports.EndUserCertificate = EndUserCertificate;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserCertificate);
//================================================================================
const EndUserCRLInfo = function () {
    this.setClassInfo('EndUserCRLInfo', 1, true, false);
    this.fields = {
        'isFilled': 'boolean',
        'issuer': 'string',
        'issuerCN': 'string',
        'crlNumber': 'long',
        'thisUpdate': 'time',
        'nextUpdate': 'time'
    };
    this.initializeFields();
};
exports.EndUserCRLInfo = EndUserCRLInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserCRLInfo);
//--------------------------------------------------------------------------------
var EndUserCRLDetailedInfo = function () {
    this.setClassInfo('EndUserCRLDetailedInfo', 1, true, false);
    this.fields = {
        'isFilled': 'boolean',
        'version': 'long',
        'issuer': 'string',
        'issuerCN': 'string',
        'issuerPublicKeyID': 'string',
        'crlNumber': 'long',
        'thisUpdate': 'time',
        'nextUpdate': 'time',
        'revokedItemsCount': 'long'
    };
    this.initializeFields();
};
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(EndUserCRLDetailedInfo);
//--------------------------------------------------------------------------------
const EndUserPrivateKeyInfo = function () {
    this.setClassInfo('EndUserPrivateKeyInfo', 1, true, true);
    this.fields = {
        'privateKey': 'byteArray',
        'privateKeyInfo': 'byteArray'
    };
    this.initializeFields();
};
exports.EndUserPrivateKeyInfo = EndUserPrivateKeyInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserPrivateKeyInfo);
//--------------------------------------------------------------------------------
const EndUserJKSPrivateKey = function () {
    this.setClassInfo('EndUserJKSPrivateKey', 1, true, false);
    this.fields = {
        'privateKey': 'byteArray',
        'certificates': 'array'
    };
    var pThis = this;
    this.initializeFields();
    this.GetCertificatesCount = function () {
        return pThis.certificates.length;
    };
    this.GetCertificate = function (index) {
        if (index < 0 || index >= pThis.certificates.length)
            return null;
        return pThis.certificates[index];
    };
};
exports.EndUserJKSPrivateKey = EndUserJKSPrivateKey;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserJKSPrivateKey);
//================================================================================
const EndUserRequestInfo = function () {
    this.setClassInfo('EndUserRequestInfo', 3, true, false);
    this.fields = {
        'request': 'byteArray',
        'requestType': 'number',
        'defaultRequestFileName': 'string',
        'isSimple': 'boolean',
        'subject': 'string',
        'subjCN': 'string',
        'subjOrg': 'string',
        'subjOrgUnit': 'string',
        'subjTitle': 'string',
        'subjState': 'string',
        'subjLocality': 'string',
        'subjFullName': 'string',
        'subjAddress': 'string',
        'subjPhone': 'string',
        'subjEMail': 'string',
        'subjDNS': 'string',
        'subjEDRPOUCode': 'string',
        'subjDRFOCode': 'string',
        'subjNBUCode': 'string',
        'subjSPFMCode': 'string',
        'subjOCode': 'string',
        'subjOUCode': ' string',
        'subjUserCode': 'string',
        'certBeginTime': 'time',
        'certEndTime': 'time',
        'isPrivKeyTimesAvail': 'boolean',
        'privKeyBeginTime': 'time',
        'privKeyEndTime': 'time',
        'publicKeyType': 'number',
        'publicKeyBits': 'number',
        'RSAModul': 'string',
        'RSAExponent': 'string',
        'publicKey': 'string',
        'publicKeyID': 'string',
        'extKeyUsages': 'string',
        'crlDistribPoint1': 'string',
        'crlDistribPoint2': 'string',
        'isSubjTypeAvail': 'boolean',
        'subjType': 'number',
        'subjSubType': 'number',
        'isSelfSigned': 'boolean',
        'signIssuer': 'string',
        'signSerial': 'string',
        'subjUNZR': 'string',
        'subjCountry': 'string'
    };
    this.initializeFields();
};
exports.EndUserRequestInfo = EndUserRequestInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserRequestInfo);
//================================================================================
const EndUserInfo = function () {
    this.setClassInfo('EndUserInfo', 3, true, true);
    this.fields = {
        'commonName': 'string',
        'locality': 'string',
        'state': 'string',
        'organization': 'string',
        'orgUnit': 'string',
        'title': 'string',
        'street': 'string',
        'phone': 'string',
        'surname': 'string',
        'givenname': 'string',
        'EMail': 'string',
        'DNS': 'string',
        'EDRPOUCode': 'string',
        'DRFOCode': 'string',
        'NBUCode': 'string',
        'SPFMCode': 'string',
        'OCode': 'string',
        'OUCode': 'string',
        'userCode': 'string',
        'UPN': 'string',
        'UNZR': 'string',
        'country': 'string'
    };
    this.initializeFields();
};
exports.EndUserInfo = EndUserInfo;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserInfo);
//================================================================================
const EndUserParams = function () {
    this.setClassInfo('EndUserParams', 1, true, true);
    this.fields = {
        'SN': 'number',
        'commonName': 'string',
        'locality': 'string',
        'state': 'string',
        'organization': 'string',
        'orgUnit': 'string',
        'title': 'string',
        'street': 'string',
        'phone': 'string',
        'surname': 'string',
        'givenname': 'string',
        'EMail': 'string',
        'DNS': 'string',
        'EDRPOUCode': 'string',
        'DRFOCode': 'string',
        'NBUCode': 'string',
        'SPFMCode': 'string',
        'information': 'string',
        'passPhrase': 'string',
        'isPublishCertificate': 'boolean',
        'RAAdminSN': 'number'
    };
    this.initializeFields();
};
exports.EndUserParams = EndUserParams;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserParams);
//================================================================================
const EndUserOperationContext = function () {
    this.setClassInfo('EndUserOperationContext', 1, true, false);
    this.fields = {
        'handle': 'string'
    };
    this.initializeFields();
    this.handle = null;
};
exports.EndUserOperationContext = EndUserOperationContext;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserOperationContext);
//================================================================================
const EndUserSession = function () {
    this.setClassInfo('EndUserSession', 1, true, false);
    this.fields = {
        'handle': 'string',
        'data': 'byteArray'
    };
    this.initializeFields();
    var pThis = this;
    this.SetData = function (data) {
        pThis.data = data;
    };
};
exports.EndUserSession = EndUserSession;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserSession);
//================================================================================
const EndUserSCClientStatistic = function () {
    this.setClassInfo('EndUserSCClientStatistic', 1, true, false);
    this.fields = {
        'activeSessions': 'number',
        'gatedSessions': 'number',
        'unprotectedData': 'number',
        'protectedData': 'number'
    };
    this.initializeFields();
    var pThis = this;
};
exports.EndUserSCClientStatistic = EndUserSCClientStatistic;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserSCClientStatistic);
//================================================================================
const EndUserDeviceContext = function () {
    this.setClassInfo('EndUserDeviceContext', 1, true, false);
    this.fields = {
        'handle': 'string'
    };
    this.initializeFields();
    this.handle = null;
};
exports.EndUserDeviceContext = EndUserDeviceContext;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserDeviceContext);
//================================================================================
const EndUserTransportHeader = function () {
    this.setClassInfo('EndUserTransportHeader', 1, true, false);
    this.fields = {
        'receiptNumber': 'number',
        'cryptoData': 'byteArray'
    };
    this.initializeFields();
};
exports.EndUserTransportHeader = EndUserTransportHeader;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserTransportHeader);
//================================================================================
const EndUserCryptoHeader = function () {
    this.setClassInfo('EndUserCryptoHeader', 1, true, false);
    this.fields = {
        'caType': 'string',
        'headerType': 'number',
        'headerSize': 'number',
        'cryptoData': 'byteArray'
    };
    this.initializeFields();
};
exports.EndUserCryptoHeader = EndUserCryptoHeader;
// @ts-ignore
exports.EndUserTransferableObject.makeTransferable(exports.EndUserCryptoHeader);
