"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TrunkConnection_LagDirectJoint = exports.TrunkConnection_SinglePortDirectJoint = exports.TrunkConnection_PartnerJointInfo = exports.TrunkConnection_LabelsEntry = exports.TrunkConnection = exports.trunkConnection_StatusToJSON = exports.trunkConnection_StatusFromJSON = exports.TrunkConnection_Status = exports.trunkConnection_CapacityToJSON = exports.trunkConnection_CapacityFromJSON = exports.TrunkConnection_Capacity = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const transceiver_type_1 = require("../../../../yandex/cloud/cic/v1/common/transceiver_type");
const lag_allocation_settings_1 = require("../../../../yandex/cloud/cic/v1/common/lag_allocation_settings");
const timestamp_1 = require("../../../../google/protobuf/timestamp");
const wrappers_1 = require("../../../../google/protobuf/wrappers");
exports.protobufPackage = 'yandex.cloud.cic.v1';
var TrunkConnection_Capacity;
(function (TrunkConnection_Capacity) {
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_UNSPECIFIED"] = 0] = "CAPACITY_UNSPECIFIED";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_50_MBPS"] = 1] = "CAPACITY_50_MBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_100_MBPS"] = 2] = "CAPACITY_100_MBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_200_MBPS"] = 3] = "CAPACITY_200_MBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_300_MBPS"] = 4] = "CAPACITY_300_MBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_400_MBPS"] = 5] = "CAPACITY_400_MBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_500_MBPS"] = 6] = "CAPACITY_500_MBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_1_GBPS"] = 7] = "CAPACITY_1_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_2_GBPS"] = 8] = "CAPACITY_2_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_3_GBPS"] = 9] = "CAPACITY_3_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_4_GBPS"] = 10] = "CAPACITY_4_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_5_GBPS"] = 11] = "CAPACITY_5_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_10_GBPS"] = 12] = "CAPACITY_10_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_20_GBPS"] = 13] = "CAPACITY_20_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_30_GBPS"] = 14] = "CAPACITY_30_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_40_GBPS"] = 15] = "CAPACITY_40_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_50_GBPS"] = 16] = "CAPACITY_50_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_100_GBPS"] = 17] = "CAPACITY_100_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["CAPACITY_200_GBPS"] = 18] = "CAPACITY_200_GBPS";
    TrunkConnection_Capacity[TrunkConnection_Capacity["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(TrunkConnection_Capacity = exports.TrunkConnection_Capacity || (exports.TrunkConnection_Capacity = {}));
function trunkConnection_CapacityFromJSON(object) {
    switch (object) {
        case 0:
        case 'CAPACITY_UNSPECIFIED':
            return TrunkConnection_Capacity.CAPACITY_UNSPECIFIED;
        case 1:
        case 'CAPACITY_50_MBPS':
            return TrunkConnection_Capacity.CAPACITY_50_MBPS;
        case 2:
        case 'CAPACITY_100_MBPS':
            return TrunkConnection_Capacity.CAPACITY_100_MBPS;
        case 3:
        case 'CAPACITY_200_MBPS':
            return TrunkConnection_Capacity.CAPACITY_200_MBPS;
        case 4:
        case 'CAPACITY_300_MBPS':
            return TrunkConnection_Capacity.CAPACITY_300_MBPS;
        case 5:
        case 'CAPACITY_400_MBPS':
            return TrunkConnection_Capacity.CAPACITY_400_MBPS;
        case 6:
        case 'CAPACITY_500_MBPS':
            return TrunkConnection_Capacity.CAPACITY_500_MBPS;
        case 7:
        case 'CAPACITY_1_GBPS':
            return TrunkConnection_Capacity.CAPACITY_1_GBPS;
        case 8:
        case 'CAPACITY_2_GBPS':
            return TrunkConnection_Capacity.CAPACITY_2_GBPS;
        case 9:
        case 'CAPACITY_3_GBPS':
            return TrunkConnection_Capacity.CAPACITY_3_GBPS;
        case 10:
        case 'CAPACITY_4_GBPS':
            return TrunkConnection_Capacity.CAPACITY_4_GBPS;
        case 11:
        case 'CAPACITY_5_GBPS':
            return TrunkConnection_Capacity.CAPACITY_5_GBPS;
        case 12:
        case 'CAPACITY_10_GBPS':
            return TrunkConnection_Capacity.CAPACITY_10_GBPS;
        case 13:
        case 'CAPACITY_20_GBPS':
            return TrunkConnection_Capacity.CAPACITY_20_GBPS;
        case 14:
        case 'CAPACITY_30_GBPS':
            return TrunkConnection_Capacity.CAPACITY_30_GBPS;
        case 15:
        case 'CAPACITY_40_GBPS':
            return TrunkConnection_Capacity.CAPACITY_40_GBPS;
        case 16:
        case 'CAPACITY_50_GBPS':
            return TrunkConnection_Capacity.CAPACITY_50_GBPS;
        case 17:
        case 'CAPACITY_100_GBPS':
            return TrunkConnection_Capacity.CAPACITY_100_GBPS;
        case 18:
        case 'CAPACITY_200_GBPS':
            return TrunkConnection_Capacity.CAPACITY_200_GBPS;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return TrunkConnection_Capacity.UNRECOGNIZED;
    }
}
exports.trunkConnection_CapacityFromJSON = trunkConnection_CapacityFromJSON;
function trunkConnection_CapacityToJSON(object) {
    switch (object) {
        case TrunkConnection_Capacity.CAPACITY_UNSPECIFIED:
            return 'CAPACITY_UNSPECIFIED';
        case TrunkConnection_Capacity.CAPACITY_50_MBPS:
            return 'CAPACITY_50_MBPS';
        case TrunkConnection_Capacity.CAPACITY_100_MBPS:
            return 'CAPACITY_100_MBPS';
        case TrunkConnection_Capacity.CAPACITY_200_MBPS:
            return 'CAPACITY_200_MBPS';
        case TrunkConnection_Capacity.CAPACITY_300_MBPS:
            return 'CAPACITY_300_MBPS';
        case TrunkConnection_Capacity.CAPACITY_400_MBPS:
            return 'CAPACITY_400_MBPS';
        case TrunkConnection_Capacity.CAPACITY_500_MBPS:
            return 'CAPACITY_500_MBPS';
        case TrunkConnection_Capacity.CAPACITY_1_GBPS:
            return 'CAPACITY_1_GBPS';
        case TrunkConnection_Capacity.CAPACITY_2_GBPS:
            return 'CAPACITY_2_GBPS';
        case TrunkConnection_Capacity.CAPACITY_3_GBPS:
            return 'CAPACITY_3_GBPS';
        case TrunkConnection_Capacity.CAPACITY_4_GBPS:
            return 'CAPACITY_4_GBPS';
        case TrunkConnection_Capacity.CAPACITY_5_GBPS:
            return 'CAPACITY_5_GBPS';
        case TrunkConnection_Capacity.CAPACITY_10_GBPS:
            return 'CAPACITY_10_GBPS';
        case TrunkConnection_Capacity.CAPACITY_20_GBPS:
            return 'CAPACITY_20_GBPS';
        case TrunkConnection_Capacity.CAPACITY_30_GBPS:
            return 'CAPACITY_30_GBPS';
        case TrunkConnection_Capacity.CAPACITY_40_GBPS:
            return 'CAPACITY_40_GBPS';
        case TrunkConnection_Capacity.CAPACITY_50_GBPS:
            return 'CAPACITY_50_GBPS';
        case TrunkConnection_Capacity.CAPACITY_100_GBPS:
            return 'CAPACITY_100_GBPS';
        case TrunkConnection_Capacity.CAPACITY_200_GBPS:
            return 'CAPACITY_200_GBPS';
        default:
            return 'UNKNOWN';
    }
}
exports.trunkConnection_CapacityToJSON = trunkConnection_CapacityToJSON;
var TrunkConnection_Status;
(function (TrunkConnection_Status) {
    TrunkConnection_Status[TrunkConnection_Status["STATUS_UNSPECIFIED"] = 0] = "STATUS_UNSPECIFIED";
    TrunkConnection_Status[TrunkConnection_Status["CREATING"] = 1] = "CREATING";
    TrunkConnection_Status[TrunkConnection_Status["UPDATING"] = 2] = "UPDATING";
    TrunkConnection_Status[TrunkConnection_Status["DELETING"] = 3] = "DELETING";
    TrunkConnection_Status[TrunkConnection_Status["ACTIVE"] = 4] = "ACTIVE";
    TrunkConnection_Status[TrunkConnection_Status["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(TrunkConnection_Status = exports.TrunkConnection_Status || (exports.TrunkConnection_Status = {}));
function trunkConnection_StatusFromJSON(object) {
    switch (object) {
        case 0:
        case 'STATUS_UNSPECIFIED':
            return TrunkConnection_Status.STATUS_UNSPECIFIED;
        case 1:
        case 'CREATING':
            return TrunkConnection_Status.CREATING;
        case 2:
        case 'UPDATING':
            return TrunkConnection_Status.UPDATING;
        case 3:
        case 'DELETING':
            return TrunkConnection_Status.DELETING;
        case 4:
        case 'ACTIVE':
            return TrunkConnection_Status.ACTIVE;
        case -1:
        case 'UNRECOGNIZED':
        default:
            return TrunkConnection_Status.UNRECOGNIZED;
    }
}
exports.trunkConnection_StatusFromJSON = trunkConnection_StatusFromJSON;
function trunkConnection_StatusToJSON(object) {
    switch (object) {
        case TrunkConnection_Status.STATUS_UNSPECIFIED:
            return 'STATUS_UNSPECIFIED';
        case TrunkConnection_Status.CREATING:
            return 'CREATING';
        case TrunkConnection_Status.UPDATING:
            return 'UPDATING';
        case TrunkConnection_Status.DELETING:
            return 'DELETING';
        case TrunkConnection_Status.ACTIVE:
            return 'ACTIVE';
        default:
            return 'UNKNOWN';
    }
}
exports.trunkConnection_StatusToJSON = trunkConnection_StatusToJSON;
const baseTrunkConnection = {
    id: '',
    name: '',
    description: '',
    folderId: '',
    regionId: '',
    capacity: 0,
    status: 0,
    deletionProtection: false,
};
exports.TrunkConnection = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.id !== '') {
            writer.uint32(10).string(message.id);
        }
        if (message.name !== '') {
            writer.uint32(18).string(message.name);
        }
        if (message.description !== '') {
            writer.uint32(26).string(message.description);
        }
        if (message.folderId !== '') {
            writer.uint32(42).string(message.folderId);
        }
        if (message.regionId !== '') {
            writer.uint32(50).string(message.regionId);
        }
        if (message.createdAt !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim();
        }
        if (message.singlePortDirectJoint !== undefined) {
            exports.TrunkConnection_SinglePortDirectJoint.encode(message.singlePortDirectJoint, writer.uint32(74).fork()).ldelim();
        }
        if (message.lagDirectJoint !== undefined) {
            exports.TrunkConnection_LagDirectJoint.encode(message.lagDirectJoint, writer.uint32(82).fork()).ldelim();
        }
        if (message.partnerJointInfo !== undefined) {
            exports.TrunkConnection_PartnerJointInfo.encode(message.partnerJointInfo, writer.uint32(90).fork()).ldelim();
        }
        if (message.pointOfPresenceId !== undefined) {
            wrappers_1.StringValue.encode({ value: message.pointOfPresenceId }, writer.uint32(98).fork()).ldelim();
        }
        if (message.capacity !== 0) {
            writer.uint32(176).int32(message.capacity);
        }
        Object.entries(message.labels).forEach(([key, value]) => {
            exports.TrunkConnection_LabelsEntry.encode({ key: key, value }, writer.uint32(186).fork()).ldelim();
        });
        if (message.status !== 0) {
            writer.uint32(192).int32(message.status);
        }
        if (message.deletionProtection === true) {
            writer.uint32(200).bool(message.deletionProtection);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTrunkConnection);
        message.labels = {};
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.id = reader.string();
                    break;
                case 2:
                    message.name = reader.string();
                    break;
                case 3:
                    message.description = reader.string();
                    break;
                case 5:
                    message.folderId = reader.string();
                    break;
                case 6:
                    message.regionId = reader.string();
                    break;
                case 7:
                    message.createdAt = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 9:
                    message.singlePortDirectJoint = exports.TrunkConnection_SinglePortDirectJoint.decode(reader, reader.uint32());
                    break;
                case 10:
                    message.lagDirectJoint = exports.TrunkConnection_LagDirectJoint.decode(reader, reader.uint32());
                    break;
                case 11:
                    message.partnerJointInfo = exports.TrunkConnection_PartnerJointInfo.decode(reader, reader.uint32());
                    break;
                case 12:
                    message.pointOfPresenceId = wrappers_1.StringValue.decode(reader, reader.uint32()).value;
                    break;
                case 22:
                    message.capacity = reader.int32();
                    break;
                case 23:
                    const entry23 = exports.TrunkConnection_LabelsEntry.decode(reader, reader.uint32());
                    if (entry23.value !== undefined) {
                        message.labels[entry23.key] = entry23.value;
                    }
                    break;
                case 24:
                    message.status = reader.int32();
                    break;
                case 25:
                    message.deletionProtection = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseTrunkConnection);
        message.id = object.id !== undefined && object.id !== null ? String(object.id) : '';
        message.name = object.name !== undefined && object.name !== null ? String(object.name) : '';
        message.description =
            object.description !== undefined && object.description !== null
                ? String(object.description)
                : '';
        message.folderId =
            object.folderId !== undefined && object.folderId !== null
                ? String(object.folderId)
                : '';
        message.regionId =
            object.regionId !== undefined && object.regionId !== null
                ? String(object.regionId)
                : '';
        message.createdAt =
            object.createdAt !== undefined && object.createdAt !== null
                ? fromJsonTimestamp(object.createdAt)
                : undefined;
        message.singlePortDirectJoint =
            object.singlePortDirectJoint !== undefined && object.singlePortDirectJoint !== null
                ? exports.TrunkConnection_SinglePortDirectJoint.fromJSON(object.singlePortDirectJoint)
                : undefined;
        message.lagDirectJoint =
            object.lagDirectJoint !== undefined && object.lagDirectJoint !== null
                ? exports.TrunkConnection_LagDirectJoint.fromJSON(object.lagDirectJoint)
                : undefined;
        message.partnerJointInfo =
            object.partnerJointInfo !== undefined && object.partnerJointInfo !== null
                ? exports.TrunkConnection_PartnerJointInfo.fromJSON(object.partnerJointInfo)
                : undefined;
        message.pointOfPresenceId =
            object.pointOfPresenceId !== undefined && object.pointOfPresenceId !== null
                ? String(object.pointOfPresenceId)
                : undefined;
        message.capacity =
            object.capacity !== undefined && object.capacity !== null
                ? trunkConnection_CapacityFromJSON(object.capacity)
                : 0;
        message.labels = Object.entries((_a = object.labels) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
            acc[key] = String(value);
            return acc;
        }, {});
        message.status =
            object.status !== undefined && object.status !== null
                ? trunkConnection_StatusFromJSON(object.status)
                : 0;
        message.deletionProtection =
            object.deletionProtection !== undefined && object.deletionProtection !== null
                ? Boolean(object.deletionProtection)
                : false;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.id !== undefined && (obj.id = message.id);
        message.name !== undefined && (obj.name = message.name);
        message.description !== undefined && (obj.description = message.description);
        message.folderId !== undefined && (obj.folderId = message.folderId);
        message.regionId !== undefined && (obj.regionId = message.regionId);
        message.createdAt !== undefined && (obj.createdAt = message.createdAt.toISOString());
        message.singlePortDirectJoint !== undefined &&
            (obj.singlePortDirectJoint = message.singlePortDirectJoint
                ? exports.TrunkConnection_SinglePortDirectJoint.toJSON(message.singlePortDirectJoint)
                : undefined);
        message.lagDirectJoint !== undefined &&
            (obj.lagDirectJoint = message.lagDirectJoint
                ? exports.TrunkConnection_LagDirectJoint.toJSON(message.lagDirectJoint)
                : undefined);
        message.partnerJointInfo !== undefined &&
            (obj.partnerJointInfo = message.partnerJointInfo
                ? exports.TrunkConnection_PartnerJointInfo.toJSON(message.partnerJointInfo)
                : undefined);
        message.pointOfPresenceId !== undefined &&
            (obj.pointOfPresenceId = message.pointOfPresenceId);
        message.capacity !== undefined &&
            (obj.capacity = trunkConnection_CapacityToJSON(message.capacity));
        obj.labels = {};
        if (message.labels) {
            Object.entries(message.labels).forEach(([k, v]) => {
                obj.labels[k] = v;
            });
        }
        message.status !== undefined && (obj.status = trunkConnection_StatusToJSON(message.status));
        message.deletionProtection !== undefined &&
            (obj.deletionProtection = message.deletionProtection);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
        const message = Object.assign({}, baseTrunkConnection);
        message.id = (_a = object.id) !== null && _a !== void 0 ? _a : '';
        message.name = (_b = object.name) !== null && _b !== void 0 ? _b : '';
        message.description = (_c = object.description) !== null && _c !== void 0 ? _c : '';
        message.folderId = (_d = object.folderId) !== null && _d !== void 0 ? _d : '';
        message.regionId = (_e = object.regionId) !== null && _e !== void 0 ? _e : '';
        message.createdAt = (_f = object.createdAt) !== null && _f !== void 0 ? _f : undefined;
        message.singlePortDirectJoint =
            object.singlePortDirectJoint !== undefined && object.singlePortDirectJoint !== null
                ? exports.TrunkConnection_SinglePortDirectJoint.fromPartial(object.singlePortDirectJoint)
                : undefined;
        message.lagDirectJoint =
            object.lagDirectJoint !== undefined && object.lagDirectJoint !== null
                ? exports.TrunkConnection_LagDirectJoint.fromPartial(object.lagDirectJoint)
                : undefined;
        message.partnerJointInfo =
            object.partnerJointInfo !== undefined && object.partnerJointInfo !== null
                ? exports.TrunkConnection_PartnerJointInfo.fromPartial(object.partnerJointInfo)
                : undefined;
        message.pointOfPresenceId = (_g = object.pointOfPresenceId) !== null && _g !== void 0 ? _g : undefined;
        message.capacity = (_h = object.capacity) !== null && _h !== void 0 ? _h : 0;
        message.labels = Object.entries((_j = object.labels) !== null && _j !== void 0 ? _j : {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = String(value);
            }
            return acc;
        }, {});
        message.status = (_k = object.status) !== null && _k !== void 0 ? _k : 0;
        message.deletionProtection = (_l = object.deletionProtection) !== null && _l !== void 0 ? _l : false;
        return message;
    },
};
const baseTrunkConnection_LabelsEntry = { key: '', value: '' };
exports.TrunkConnection_LabelsEntry = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.key !== '') {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== '') {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTrunkConnection_LabelsEntry);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTrunkConnection_LabelsEntry);
        message.key = object.key !== undefined && object.key !== null ? String(object.key) : '';
        message.value =
            object.value !== undefined && object.value !== null ? String(object.value) : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.key !== undefined && (obj.key = message.key);
        message.value !== undefined && (obj.value = message.value);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTrunkConnection_LabelsEntry);
        message.key = (_a = object.key) !== null && _a !== void 0 ? _a : '';
        message.value = (_b = object.value) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseTrunkConnection_PartnerJointInfo = { serviceKey: '' };
exports.TrunkConnection_PartnerJointInfo = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.serviceKey !== '') {
            writer.uint32(26).string(message.serviceKey);
        }
        if (message.partnerId !== undefined) {
            wrappers_1.StringValue.encode({ value: message.partnerId }, writer.uint32(34).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTrunkConnection_PartnerJointInfo);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 3:
                    message.serviceKey = reader.string();
                    break;
                case 4:
                    message.partnerId = wrappers_1.StringValue.decode(reader, reader.uint32()).value;
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTrunkConnection_PartnerJointInfo);
        message.serviceKey =
            object.serviceKey !== undefined && object.serviceKey !== null
                ? String(object.serviceKey)
                : '';
        message.partnerId =
            object.partnerId !== undefined && object.partnerId !== null
                ? String(object.partnerId)
                : undefined;
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.serviceKey !== undefined && (obj.serviceKey = message.serviceKey);
        message.partnerId !== undefined && (obj.partnerId = message.partnerId);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTrunkConnection_PartnerJointInfo);
        message.serviceKey = (_a = object.serviceKey) !== null && _a !== void 0 ? _a : '';
        message.partnerId = (_b = object.partnerId) !== null && _b !== void 0 ? _b : undefined;
        return message;
    },
};
const baseTrunkConnection_SinglePortDirectJoint = {
    transceiverType: 0,
    accessDeviceName: '',
};
exports.TrunkConnection_SinglePortDirectJoint = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transceiverType !== 0) {
            writer.uint32(8).int32(message.transceiverType);
        }
        if (message.portName !== undefined) {
            wrappers_1.StringValue.encode({ value: message.portName }, writer.uint32(26).fork()).ldelim();
        }
        if (message.accessDeviceName !== '') {
            writer.uint32(34).string(message.accessDeviceName);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTrunkConnection_SinglePortDirectJoint);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transceiverType = reader.int32();
                    break;
                case 3:
                    message.portName = wrappers_1.StringValue.decode(reader, reader.uint32()).value;
                    break;
                case 4:
                    message.accessDeviceName = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTrunkConnection_SinglePortDirectJoint);
        message.transceiverType =
            object.transceiverType !== undefined && object.transceiverType !== null
                ? (0, transceiver_type_1.transceiverTypeFromJSON)(object.transceiverType)
                : 0;
        message.portName =
            object.portName !== undefined && object.portName !== null
                ? String(object.portName)
                : undefined;
        message.accessDeviceName =
            object.accessDeviceName !== undefined && object.accessDeviceName !== null
                ? String(object.accessDeviceName)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transceiverType !== undefined &&
            (obj.transceiverType = (0, transceiver_type_1.transceiverTypeToJSON)(message.transceiverType));
        message.portName !== undefined && (obj.portName = message.portName);
        message.accessDeviceName !== undefined && (obj.accessDeviceName = message.accessDeviceName);
        return obj;
    },
    fromPartial(object) {
        var _a, _b, _c;
        const message = Object.assign({}, baseTrunkConnection_SinglePortDirectJoint);
        message.transceiverType = (_a = object.transceiverType) !== null && _a !== void 0 ? _a : 0;
        message.portName = (_b = object.portName) !== null && _b !== void 0 ? _b : undefined;
        message.accessDeviceName = (_c = object.accessDeviceName) !== null && _c !== void 0 ? _c : '';
        return message;
    },
};
const baseTrunkConnection_LagDirectJoint = { transceiverType: 0, accessDeviceName: '' };
exports.TrunkConnection_LagDirectJoint = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.transceiverType !== 0) {
            writer.uint32(8).int32(message.transceiverType);
        }
        if (message.lagAllocationSettings !== undefined) {
            lag_allocation_settings_1.LagAllocationSettings.encode(message.lagAllocationSettings, writer.uint32(26).fork()).ldelim();
        }
        if (message.accessDeviceName !== '') {
            writer.uint32(34).string(message.accessDeviceName);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseTrunkConnection_LagDirectJoint);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.transceiverType = reader.int32();
                    break;
                case 3:
                    message.lagAllocationSettings = lag_allocation_settings_1.LagAllocationSettings.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.accessDeviceName = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseTrunkConnection_LagDirectJoint);
        message.transceiverType =
            object.transceiverType !== undefined && object.transceiverType !== null
                ? (0, transceiver_type_1.transceiverTypeFromJSON)(object.transceiverType)
                : 0;
        message.lagAllocationSettings =
            object.lagAllocationSettings !== undefined && object.lagAllocationSettings !== null
                ? lag_allocation_settings_1.LagAllocationSettings.fromJSON(object.lagAllocationSettings)
                : undefined;
        message.accessDeviceName =
            object.accessDeviceName !== undefined && object.accessDeviceName !== null
                ? String(object.accessDeviceName)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.transceiverType !== undefined &&
            (obj.transceiverType = (0, transceiver_type_1.transceiverTypeToJSON)(message.transceiverType));
        message.lagAllocationSettings !== undefined &&
            (obj.lagAllocationSettings = message.lagAllocationSettings
                ? lag_allocation_settings_1.LagAllocationSettings.toJSON(message.lagAllocationSettings)
                : undefined);
        message.accessDeviceName !== undefined && (obj.accessDeviceName = message.accessDeviceName);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseTrunkConnection_LagDirectJoint);
        message.transceiverType = (_a = object.transceiverType) !== null && _a !== void 0 ? _a : 0;
        message.lagAllocationSettings =
            object.lagAllocationSettings !== undefined && object.lagAllocationSettings !== null
                ? lag_allocation_settings_1.LagAllocationSettings.fromPartial(object.lagAllocationSettings)
                : undefined;
        message.accessDeviceName = (_b = object.accessDeviceName) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
function toTimestamp(date) {
    const seconds = date.getTime() / 1000;
    const nanos = (date.getTime() % 1000) * 1000000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = t.seconds * 1000;
    millis += t.nanos / 1000000;
    return new Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof Date) {
        return o;
    }
    else if (typeof o === 'string') {
        return new Date(o);
    }
    else {
        return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
    }
}
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
