"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.opentelemetry = void 0;
/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 5.27.0
 * source: opentelemetry/proto/resource/v1/resource.proto
 * git: https://github.com/thesayyn/protoc-gen-ts */
const dependency_1 = __importStar(require("./../../common/v1/common"));
const pb_1 = __importStar(require("google-protobuf"));
var opentelemetry;
(function (opentelemetry) {
    var proto;
    (function (proto) {
        var resource;
        (function (resource) {
            var v1;
            (function (v1) {
                var _Resource_one_of_decls;
                class Resource extends pb_1.Message {
                    constructor(data) {
                        super();
                        _Resource_one_of_decls.set(this, []);
                        pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1, 3], __classPrivateFieldGet(this, _Resource_one_of_decls, "f"));
                        if (!Array.isArray(data) && typeof data == 'object') {
                            if ('attributes' in data && data.attributes != undefined) {
                                this.attributes = data.attributes;
                            }
                            if ('dropped_attributes_count' in data &&
                                data.dropped_attributes_count != undefined) {
                                this.dropped_attributes_count =
                                    data.dropped_attributes_count;
                            }
                            if ('entity_refs' in data && data.entity_refs != undefined) {
                                this.entity_refs = data.entity_refs;
                            }
                        }
                    }
                    get attributes() {
                        return pb_1.Message.getRepeatedWrapperField(this, dependency_1.opentelemetry.proto.common.v1.KeyValue, 1);
                    }
                    set attributes(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 1, value);
                    }
                    get dropped_attributes_count() {
                        return pb_1.Message.getFieldWithDefault(this, 2, 0);
                    }
                    set dropped_attributes_count(value) {
                        pb_1.Message.setField(this, 2, value);
                    }
                    get entity_refs() {
                        return pb_1.Message.getRepeatedWrapperField(this, dependency_1.opentelemetry.proto.common.v1.EntityRef, 3);
                    }
                    set entity_refs(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 3, value);
                    }
                    static fromObject(data) {
                        const message = new Resource({});
                        if (data.attributes != null) {
                            message.attributes = data.attributes.map((item) => dependency_1.opentelemetry.proto.common.v1.KeyValue.fromObject(item));
                        }
                        if (data.dropped_attributes_count != null) {
                            message.dropped_attributes_count =
                                data.dropped_attributes_count;
                        }
                        if (data.entity_refs != null) {
                            message.entity_refs = data.entity_refs.map((item) => dependency_1.opentelemetry.proto.common.v1.EntityRef.fromObject(item));
                        }
                        return message;
                    }
                    toObject() {
                        const data = {};
                        if (this.attributes != null) {
                            data.attributes = this.attributes.map((item) => item.toObject());
                        }
                        if (this.dropped_attributes_count != null) {
                            data.dropped_attributes_count = this.dropped_attributes_count;
                        }
                        if (this.entity_refs != null) {
                            data.entity_refs = this.entity_refs.map((item) => item.toObject());
                        }
                        return data;
                    }
                    serialize(w) {
                        const writer = w || new pb_1.BinaryWriter();
                        if (this.attributes.length)
                            writer.writeRepeatedMessage(1, this.attributes, (item) => item.serialize(writer));
                        if (this.dropped_attributes_count != 0)
                            writer.writeUint32(2, this.dropped_attributes_count);
                        if (this.entity_refs.length)
                            writer.writeRepeatedMessage(3, this.entity_refs, (item) => item.serialize(writer));
                        if (!w)
                            return writer.getResultBuffer();
                    }
                    static deserialize(bytes) {
                        const reader = bytes instanceof pb_1.BinaryReader
                            ? bytes
                            : new pb_1.BinaryReader(bytes), message = new Resource();
                        while (reader.nextField()) {
                            if (reader.isEndGroup())
                                break;
                            switch (reader.getFieldNumber()) {
                                case 1:
                                    reader.readMessage(message.attributes, () => pb_1.Message.addToRepeatedWrapperField(message, 1, dependency_1.opentelemetry.proto.common.v1.KeyValue.deserialize(reader), dependency_1.opentelemetry.proto.common.v1
                                        .KeyValue));
                                    break;
                                case 2:
                                    message.dropped_attributes_count = reader.readUint32();
                                    break;
                                case 3:
                                    reader.readMessage(message.entity_refs, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.opentelemetry.proto.common.v1.EntityRef.deserialize(reader), dependency_1.opentelemetry.proto.common.v1
                                        .EntityRef));
                                    break;
                                default:
                                    reader.skipField();
                            }
                        }
                        return message;
                    }
                    serializeBinary() {
                        return this.serialize();
                    }
                    static deserializeBinary(bytes) {
                        return Resource.deserialize(bytes);
                    }
                }
                _Resource_one_of_decls = new WeakMap();
                v1.Resource = Resource;
            })(v1 = resource.v1 || (resource.v1 = {}));
        })(resource = proto.resource || (proto.resource = {}));
    })(proto = opentelemetry.proto || (opentelemetry.proto = {}));
})(opentelemetry || (exports.opentelemetry = opentelemetry = {}));
