"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LagInfo = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const wrappers_1 = require("../../../../../google/protobuf/wrappers");
exports.protobufPackage = 'yandex.cloud.cic.v1.common';
const baseLagInfo = { portNames: '' };
exports.LagInfo = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.lagId !== undefined) {
            wrappers_1.Int64Value.encode({ value: message.lagId }, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.portNames) {
            writer.uint32(18).string(v);
        }
        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({}, baseLagInfo);
        message.portNames = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.lagId = wrappers_1.Int64Value.decode(reader, reader.uint32()).value;
                    break;
                case 2:
                    message.portNames.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseLagInfo);
        message.lagId =
            object.lagId !== undefined && object.lagId !== null ? Number(object.lagId) : undefined;
        message.portNames = ((_a = object.portNames) !== null && _a !== void 0 ? _a : []).map((e) => String(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.lagId !== undefined && (obj.lagId = message.lagId);
        if (message.portNames) {
            obj.portNames = message.portNames.map((e) => e);
        }
        else {
            obj.portNames = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseLagInfo);
        message.lagId = (_a = object.lagId) !== null && _a !== void 0 ? _a : undefined;
        message.portNames = ((_b = object.portNames) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
        return message;
    },
};
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
