"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/trace/v1/trace.proto
 * git: https://github.com/thesayyn/protoc-gen-ts */
const dependency_1 = __importStar(require("./../../common/v1/common"));
const dependency_2 = __importStar(require("./../../resource/v1/resource"));
const pb_1 = __importStar(require("google-protobuf"));
var opentelemetry;
(function (opentelemetry) {
    var proto;
    (function (proto) {
        var trace;
        (function (trace) {
            var v1;
            (function (v1) {
                var _TracesData_one_of_decls, _ResourceSpans_one_of_decls, _ScopeSpans_one_of_decls, _Span_one_of_decls, _Status_one_of_decls;
                let SpanFlags;
                (function (SpanFlags) {
                    SpanFlags[SpanFlags["SPAN_FLAGS_DO_NOT_USE"] = 0] = "SPAN_FLAGS_DO_NOT_USE";
                    SpanFlags[SpanFlags["SPAN_FLAGS_TRACE_FLAGS_MASK"] = 255] = "SPAN_FLAGS_TRACE_FLAGS_MASK";
                    SpanFlags[SpanFlags["SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"] = 256] = "SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK";
                    SpanFlags[SpanFlags["SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"] = 512] = "SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK";
                })(SpanFlags = v1.SpanFlags || (v1.SpanFlags = {}));
                class TracesData extends pb_1.Message {
                    constructor(data) {
                        super();
                        _TracesData_one_of_decls.set(this, []);
                        pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [1], __classPrivateFieldGet(this, _TracesData_one_of_decls, "f"));
                        if (!Array.isArray(data) && typeof data == 'object') {
                            if ('resource_spans' in data &&
                                data.resource_spans != undefined) {
                                this.resource_spans = data.resource_spans;
                            }
                        }
                    }
                    get resource_spans() {
                        return pb_1.Message.getRepeatedWrapperField(this, ResourceSpans, 1);
                    }
                    set resource_spans(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 1, value);
                    }
                    static fromObject(data) {
                        const message = new TracesData({});
                        if (data.resource_spans != null) {
                            message.resource_spans = data.resource_spans.map((item) => ResourceSpans.fromObject(item));
                        }
                        return message;
                    }
                    toObject() {
                        const data = {};
                        if (this.resource_spans != null) {
                            data.resource_spans = this.resource_spans.map((item) => item.toObject());
                        }
                        return data;
                    }
                    serialize(w) {
                        const writer = w || new pb_1.BinaryWriter();
                        if (this.resource_spans.length)
                            writer.writeRepeatedMessage(1, this.resource_spans, (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 TracesData();
                        while (reader.nextField()) {
                            if (reader.isEndGroup())
                                break;
                            switch (reader.getFieldNumber()) {
                                case 1:
                                    reader.readMessage(message.resource_spans, () => pb_1.Message.addToRepeatedWrapperField(message, 1, ResourceSpans.deserialize(reader), ResourceSpans));
                                    break;
                                default:
                                    reader.skipField();
                            }
                        }
                        return message;
                    }
                    serializeBinary() {
                        return this.serialize();
                    }
                    static deserializeBinary(bytes) {
                        return TracesData.deserialize(bytes);
                    }
                }
                _TracesData_one_of_decls = new WeakMap();
                v1.TracesData = TracesData;
                class ResourceSpans extends pb_1.Message {
                    constructor(data) {
                        super();
                        _ResourceSpans_one_of_decls.set(this, []);
                        pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], __classPrivateFieldGet(this, _ResourceSpans_one_of_decls, "f"));
                        if (!Array.isArray(data) && typeof data == 'object') {
                            if ('resource' in data && data.resource != undefined) {
                                this.resource = data.resource;
                            }
                            if ('scope_spans' in data && data.scope_spans != undefined) {
                                this.scope_spans = data.scope_spans;
                            }
                            if ('schema_url' in data && data.schema_url != undefined) {
                                this.schema_url = data.schema_url;
                            }
                        }
                    }
                    get resource() {
                        return pb_1.Message.getWrapperField(this, dependency_2.opentelemetry.proto.resource.v1.Resource, 1);
                    }
                    set resource(value) {
                        pb_1.Message.setWrapperField(this, 1, value);
                    }
                    get has_resource() {
                        return pb_1.Message.getField(this, 1) != null;
                    }
                    get scope_spans() {
                        return pb_1.Message.getRepeatedWrapperField(this, ScopeSpans, 2);
                    }
                    set scope_spans(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 2, value);
                    }
                    get schema_url() {
                        return pb_1.Message.getFieldWithDefault(this, 3, '');
                    }
                    set schema_url(value) {
                        pb_1.Message.setField(this, 3, value);
                    }
                    static fromObject(data) {
                        const message = new ResourceSpans({});
                        if (data.resource != null) {
                            message.resource =
                                dependency_2.opentelemetry.proto.resource.v1.Resource.fromObject(data.resource);
                        }
                        if (data.scope_spans != null) {
                            message.scope_spans = data.scope_spans.map((item) => ScopeSpans.fromObject(item));
                        }
                        if (data.schema_url != null) {
                            message.schema_url = data.schema_url;
                        }
                        return message;
                    }
                    toObject() {
                        const data = {};
                        if (this.resource != null) {
                            data.resource = this.resource.toObject();
                        }
                        if (this.scope_spans != null) {
                            data.scope_spans = this.scope_spans.map((item) => item.toObject());
                        }
                        if (this.schema_url != null) {
                            data.schema_url = this.schema_url;
                        }
                        return data;
                    }
                    serialize(w) {
                        const writer = w || new pb_1.BinaryWriter();
                        if (this.has_resource)
                            writer.writeMessage(1, this.resource, () => this.resource.serialize(writer));
                        if (this.scope_spans.length)
                            writer.writeRepeatedMessage(2, this.scope_spans, (item) => item.serialize(writer));
                        if (this.schema_url.length)
                            writer.writeString(3, this.schema_url);
                        if (!w)
                            return writer.getResultBuffer();
                    }
                    static deserialize(bytes) {
                        const reader = bytes instanceof pb_1.BinaryReader
                            ? bytes
                            : new pb_1.BinaryReader(bytes), message = new ResourceSpans();
                        while (reader.nextField()) {
                            if (reader.isEndGroup())
                                break;
                            switch (reader.getFieldNumber()) {
                                case 1:
                                    reader.readMessage(message.resource, () => (message.resource =
                                        dependency_2.opentelemetry.proto.resource.v1.Resource.deserialize(reader)));
                                    break;
                                case 2:
                                    reader.readMessage(message.scope_spans, () => pb_1.Message.addToRepeatedWrapperField(message, 2, ScopeSpans.deserialize(reader), ScopeSpans));
                                    break;
                                case 3:
                                    message.schema_url = reader.readString();
                                    break;
                                default:
                                    reader.skipField();
                            }
                        }
                        return message;
                    }
                    serializeBinary() {
                        return this.serialize();
                    }
                    static deserializeBinary(bytes) {
                        return ResourceSpans.deserialize(bytes);
                    }
                }
                _ResourceSpans_one_of_decls = new WeakMap();
                v1.ResourceSpans = ResourceSpans;
                class ScopeSpans extends pb_1.Message {
                    constructor(data) {
                        super();
                        _ScopeSpans_one_of_decls.set(this, []);
                        pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [2], __classPrivateFieldGet(this, _ScopeSpans_one_of_decls, "f"));
                        if (!Array.isArray(data) && typeof data == 'object') {
                            if ('scope' in data && data.scope != undefined) {
                                this.scope = data.scope;
                            }
                            if ('spans' in data && data.spans != undefined) {
                                this.spans = data.spans;
                            }
                            if ('schema_url' in data && data.schema_url != undefined) {
                                this.schema_url = data.schema_url;
                            }
                        }
                    }
                    get scope() {
                        return pb_1.Message.getWrapperField(this, dependency_1.opentelemetry.proto.common.v1.InstrumentationScope, 1);
                    }
                    set scope(value) {
                        pb_1.Message.setWrapperField(this, 1, value);
                    }
                    get has_scope() {
                        return pb_1.Message.getField(this, 1) != null;
                    }
                    get spans() {
                        return pb_1.Message.getRepeatedWrapperField(this, Span, 2);
                    }
                    set spans(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 2, value);
                    }
                    get schema_url() {
                        return pb_1.Message.getFieldWithDefault(this, 3, '');
                    }
                    set schema_url(value) {
                        pb_1.Message.setField(this, 3, value);
                    }
                    static fromObject(data) {
                        const message = new ScopeSpans({});
                        if (data.scope != null) {
                            message.scope =
                                dependency_1.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(data.scope);
                        }
                        if (data.spans != null) {
                            message.spans = data.spans.map((item) => Span.fromObject(item));
                        }
                        if (data.schema_url != null) {
                            message.schema_url = data.schema_url;
                        }
                        return message;
                    }
                    toObject() {
                        const data = {};
                        if (this.scope != null) {
                            data.scope = this.scope.toObject();
                        }
                        if (this.spans != null) {
                            data.spans = this.spans.map((item) => item.toObject());
                        }
                        if (this.schema_url != null) {
                            data.schema_url = this.schema_url;
                        }
                        return data;
                    }
                    serialize(w) {
                        const writer = w || new pb_1.BinaryWriter();
                        if (this.has_scope)
                            writer.writeMessage(1, this.scope, () => this.scope.serialize(writer));
                        if (this.spans.length)
                            writer.writeRepeatedMessage(2, this.spans, (item) => item.serialize(writer));
                        if (this.schema_url.length)
                            writer.writeString(3, this.schema_url);
                        if (!w)
                            return writer.getResultBuffer();
                    }
                    static deserialize(bytes) {
                        const reader = bytes instanceof pb_1.BinaryReader
                            ? bytes
                            : new pb_1.BinaryReader(bytes), message = new ScopeSpans();
                        while (reader.nextField()) {
                            if (reader.isEndGroup())
                                break;
                            switch (reader.getFieldNumber()) {
                                case 1:
                                    reader.readMessage(message.scope, () => (message.scope =
                                        dependency_1.opentelemetry.proto.common.v1.InstrumentationScope.deserialize(reader)));
                                    break;
                                case 2:
                                    reader.readMessage(message.spans, () => pb_1.Message.addToRepeatedWrapperField(message, 2, Span.deserialize(reader), Span));
                                    break;
                                case 3:
                                    message.schema_url = reader.readString();
                                    break;
                                default:
                                    reader.skipField();
                            }
                        }
                        return message;
                    }
                    serializeBinary() {
                        return this.serialize();
                    }
                    static deserializeBinary(bytes) {
                        return ScopeSpans.deserialize(bytes);
                    }
                }
                _ScopeSpans_one_of_decls = new WeakMap();
                v1.ScopeSpans = ScopeSpans;
                class Span extends pb_1.Message {
                    constructor(data) {
                        super();
                        _Span_one_of_decls.set(this, []);
                        pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [9, 11, 13], __classPrivateFieldGet(this, _Span_one_of_decls, "f"));
                        if (!Array.isArray(data) && typeof data == 'object') {
                            if ('trace_id' in data && data.trace_id != undefined) {
                                this.trace_id = data.trace_id;
                            }
                            if ('span_id' in data && data.span_id != undefined) {
                                this.span_id = data.span_id;
                            }
                            if ('trace_state' in data && data.trace_state != undefined) {
                                this.trace_state = data.trace_state;
                            }
                            if ('parent_span_id' in data &&
                                data.parent_span_id != undefined) {
                                this.parent_span_id = data.parent_span_id;
                            }
                            if ('flags' in data && data.flags != undefined) {
                                this.flags = data.flags;
                            }
                            if ('name' in data && data.name != undefined) {
                                this.name = data.name;
                            }
                            if ('kind' in data && data.kind != undefined) {
                                this.kind = data.kind;
                            }
                            if ('start_time_unix_nano' in data &&
                                data.start_time_unix_nano != undefined) {
                                this.start_time_unix_nano = data.start_time_unix_nano;
                            }
                            if ('end_time_unix_nano' in data &&
                                data.end_time_unix_nano != undefined) {
                                this.end_time_unix_nano = data.end_time_unix_nano;
                            }
                            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 ('events' in data && data.events != undefined) {
                                this.events = data.events;
                            }
                            if ('dropped_events_count' in data &&
                                data.dropped_events_count != undefined) {
                                this.dropped_events_count = data.dropped_events_count;
                            }
                            if ('links' in data && data.links != undefined) {
                                this.links = data.links;
                            }
                            if ('dropped_links_count' in data &&
                                data.dropped_links_count != undefined) {
                                this.dropped_links_count = data.dropped_links_count;
                            }
                            if ('status' in data && data.status != undefined) {
                                this.status = data.status;
                            }
                        }
                    }
                    get trace_id() {
                        return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0));
                    }
                    set trace_id(value) {
                        pb_1.Message.setField(this, 1, value);
                    }
                    get span_id() {
                        return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0));
                    }
                    set span_id(value) {
                        pb_1.Message.setField(this, 2, value);
                    }
                    get trace_state() {
                        return pb_1.Message.getFieldWithDefault(this, 3, '');
                    }
                    set trace_state(value) {
                        pb_1.Message.setField(this, 3, value);
                    }
                    get parent_span_id() {
                        return pb_1.Message.getFieldWithDefault(this, 4, new Uint8Array(0));
                    }
                    set parent_span_id(value) {
                        pb_1.Message.setField(this, 4, value);
                    }
                    get flags() {
                        return pb_1.Message.getFieldWithDefault(this, 16, 0);
                    }
                    set flags(value) {
                        pb_1.Message.setField(this, 16, value);
                    }
                    get name() {
                        return pb_1.Message.getFieldWithDefault(this, 5, '');
                    }
                    set name(value) {
                        pb_1.Message.setField(this, 5, value);
                    }
                    get kind() {
                        return pb_1.Message.getFieldWithDefault(this, 6, Span.SpanKind.SPAN_KIND_UNSPECIFIED);
                    }
                    set kind(value) {
                        pb_1.Message.setField(this, 6, value);
                    }
                    get start_time_unix_nano() {
                        return pb_1.Message.getFieldWithDefault(this, 7, 0);
                    }
                    set start_time_unix_nano(value) {
                        pb_1.Message.setField(this, 7, value);
                    }
                    get end_time_unix_nano() {
                        return pb_1.Message.getFieldWithDefault(this, 8, 0);
                    }
                    set end_time_unix_nano(value) {
                        pb_1.Message.setField(this, 8, value);
                    }
                    get attributes() {
                        return pb_1.Message.getRepeatedWrapperField(this, dependency_1.opentelemetry.proto.common.v1.KeyValue, 9);
                    }
                    set attributes(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 9, value);
                    }
                    get dropped_attributes_count() {
                        return pb_1.Message.getFieldWithDefault(this, 10, 0);
                    }
                    set dropped_attributes_count(value) {
                        pb_1.Message.setField(this, 10, value);
                    }
                    get events() {
                        return pb_1.Message.getRepeatedWrapperField(this, Span.Event, 11);
                    }
                    set events(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 11, value);
                    }
                    get dropped_events_count() {
                        return pb_1.Message.getFieldWithDefault(this, 12, 0);
                    }
                    set dropped_events_count(value) {
                        pb_1.Message.setField(this, 12, value);
                    }
                    get links() {
                        return pb_1.Message.getRepeatedWrapperField(this, Span.Link, 13);
                    }
                    set links(value) {
                        pb_1.Message.setRepeatedWrapperField(this, 13, value);
                    }
                    get dropped_links_count() {
                        return pb_1.Message.getFieldWithDefault(this, 14, 0);
                    }
                    set dropped_links_count(value) {
                        pb_1.Message.setField(this, 14, value);
                    }
                    get status() {
                        return pb_1.Message.getWrapperField(this, Status, 15);
                    }
                    set status(value) {
                        pb_1.Message.setWrapperField(this, 15, value);
                    }
                    get has_status() {
                        return pb_1.Message.getField(this, 15) != null;
                    }
                    static fromObject(data) {
                        const message = new Span({});
                        if (data.trace_id != null) {
                            message.trace_id = data.trace_id;
                        }
                        if (data.span_id != null) {
                            message.span_id = data.span_id;
                        }
                        if (data.trace_state != null) {
                            message.trace_state = data.trace_state;
                        }
                        if (data.parent_span_id != null) {
                            message.parent_span_id = data.parent_span_id;
                        }
                        if (data.flags != null) {
                            message.flags = data.flags;
                        }
                        if (data.name != null) {
                            message.name = data.name;
                        }
                        if (data.kind != null) {
                            message.kind = data.kind;
                        }
                        if (data.start_time_unix_nano != null) {
                            message.start_time_unix_nano = data.start_time_unix_nano;
                        }
                        if (data.end_time_unix_nano != null) {
                            message.end_time_unix_nano = data.end_time_unix_nano;
                        }
                        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.events != null) {
                            message.events = data.events.map((item) => Span.Event.fromObject(item));
                        }
                        if (data.dropped_events_count != null) {
                            message.dropped_events_count = data.dropped_events_count;
                        }
                        if (data.links != null) {
                            message.links = data.links.map((item) => Span.Link.fromObject(item));
                        }
                        if (data.dropped_links_count != null) {
                            message.dropped_links_count = data.dropped_links_count;
                        }
                        if (data.status != null) {
                            message.status = Status.fromObject(data.status);
                        }
                        return message;
                    }
                    toObject() {
                        const data = {};
                        if (this.trace_id != null) {
                            data.trace_id = this.trace_id;
                        }
                        if (this.span_id != null) {
                            data.span_id = this.span_id;
                        }
                        if (this.trace_state != null) {
                            data.trace_state = this.trace_state;
                        }
                        if (this.parent_span_id != null) {
                            data.parent_span_id = this.parent_span_id;
                        }
                        if (this.flags != null) {
                            data.flags = this.flags;
                        }
                        if (this.name != null) {
                            data.name = this.name;
                        }
                        if (this.kind != null) {
                            data.kind = this.kind;
                        }
                        if (this.start_time_unix_nano != null) {
                            data.start_time_unix_nano = this.start_time_unix_nano;
                        }
                        if (this.end_time_unix_nano != null) {
                            data.end_time_unix_nano = this.end_time_unix_nano;
                        }
                        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.events != null) {
                            data.events = this.events.map((item) => item.toObject());
                        }
                        if (this.dropped_events_count != null) {
                            data.dropped_events_count = this.dropped_events_count;
                        }
                        if (this.links != null) {
                            data.links = this.links.map((item) => item.toObject());
                        }
                        if (this.dropped_links_count != null) {
                            data.dropped_links_count = this.dropped_links_count;
                        }
                        if (this.status != null) {
                            data.status = this.status.toObject();
                        }
                        return data;
                    }
                    serialize(w) {
                        const writer = w || new pb_1.BinaryWriter();
                        if (this.trace_id.length)
                            writer.writeBytes(1, this.trace_id);
                        if (this.span_id.length)
                            writer.writeBytes(2, this.span_id);
                        if (this.trace_state.length)
                            writer.writeString(3, this.trace_state);
                        if (this.parent_span_id.length)
                            writer.writeBytes(4, this.parent_span_id);
                        if (this.flags != 0)
                            writer.writeFixed32(16, this.flags);
                        if (this.name.length)
                            writer.writeString(5, this.name);
                        if (this.kind != Span.SpanKind.SPAN_KIND_UNSPECIFIED)
                            writer.writeEnum(6, this.kind);
                        if (this.start_time_unix_nano != 0)
                            writer.writeFixed64(7, this.start_time_unix_nano);
                        if (this.end_time_unix_nano != 0)
                            writer.writeFixed64(8, this.end_time_unix_nano);
                        if (this.attributes.length)
                            writer.writeRepeatedMessage(9, this.attributes, (item) => item.serialize(writer));
                        if (this.dropped_attributes_count != 0)
                            writer.writeUint32(10, this.dropped_attributes_count);
                        if (this.events.length)
                            writer.writeRepeatedMessage(11, this.events, (item) => item.serialize(writer));
                        if (this.dropped_events_count != 0)
                            writer.writeUint32(12, this.dropped_events_count);
                        if (this.links.length)
                            writer.writeRepeatedMessage(13, this.links, (item) => item.serialize(writer));
                        if (this.dropped_links_count != 0)
                            writer.writeUint32(14, this.dropped_links_count);
                        if (this.has_status)
                            writer.writeMessage(15, this.status, () => this.status.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 Span();
                        while (reader.nextField()) {
                            if (reader.isEndGroup())
                                break;
                            switch (reader.getFieldNumber()) {
                                case 1:
                                    message.trace_id = reader.readBytes();
                                    break;
                                case 2:
                                    message.span_id = reader.readBytes();
                                    break;
                                case 3:
                                    message.trace_state = reader.readString();
                                    break;
                                case 4:
                                    message.parent_span_id = reader.readBytes();
                                    break;
                                case 16:
                                    message.flags = reader.readFixed32();
                                    break;
                                case 5:
                                    message.name = reader.readString();
                                    break;
                                case 6:
                                    message.kind = reader.readEnum();
                                    break;
                                case 7:
                                    message.start_time_unix_nano = reader.readFixed64();
                                    break;
                                case 8:
                                    message.end_time_unix_nano = reader.readFixed64();
                                    break;
                                case 9:
                                    reader.readMessage(message.attributes, () => pb_1.Message.addToRepeatedWrapperField(message, 9, dependency_1.opentelemetry.proto.common.v1.KeyValue.deserialize(reader), dependency_1.opentelemetry.proto.common.v1
                                        .KeyValue));
                                    break;
                                case 10:
                                    message.dropped_attributes_count = reader.readUint32();
                                    break;
                                case 11:
                                    reader.readMessage(message.events, () => pb_1.Message.addToRepeatedWrapperField(message, 11, Span.Event.deserialize(reader), Span.Event));
                                    break;
                                case 12:
                                    message.dropped_events_count = reader.readUint32();
                                    break;
                                case 13:
                                    reader.readMessage(message.links, () => pb_1.Message.addToRepeatedWrapperField(message, 13, Span.Link.deserialize(reader), Span.Link));
                                    break;
                                case 14:
                                    message.dropped_links_count = reader.readUint32();
                                    break;
                                case 15:
                                    reader.readMessage(message.status, () => (message.status = Status.deserialize(reader)));
                                    break;
                                default:
                                    reader.skipField();
                            }
                        }
                        return message;
                    }
                    serializeBinary() {
                        return this.serialize();
                    }
                    static deserializeBinary(bytes) {
                        return Span.deserialize(bytes);
                    }
                }
                _Span_one_of_decls = new WeakMap();
                v1.Span = Span;
                (function (Span) {
                    var _Event_one_of_decls, _Link_one_of_decls;
                    let SpanKind;
                    (function (SpanKind) {
                        SpanKind[SpanKind["SPAN_KIND_UNSPECIFIED"] = 0] = "SPAN_KIND_UNSPECIFIED";
                        SpanKind[SpanKind["SPAN_KIND_INTERNAL"] = 1] = "SPAN_KIND_INTERNAL";
                        SpanKind[SpanKind["SPAN_KIND_SERVER"] = 2] = "SPAN_KIND_SERVER";
                        SpanKind[SpanKind["SPAN_KIND_CLIENT"] = 3] = "SPAN_KIND_CLIENT";
                        SpanKind[SpanKind["SPAN_KIND_PRODUCER"] = 4] = "SPAN_KIND_PRODUCER";
                        SpanKind[SpanKind["SPAN_KIND_CONSUMER"] = 5] = "SPAN_KIND_CONSUMER";
                    })(SpanKind = Span.SpanKind || (Span.SpanKind = {}));
                    class Event extends pb_1.Message {
                        constructor(data) {
                            super();
                            _Event_one_of_decls.set(this, []);
                            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [3], __classPrivateFieldGet(this, _Event_one_of_decls, "f"));
                            if (!Array.isArray(data) && typeof data == 'object') {
                                if ('time_unix_nano' in data &&
                                    data.time_unix_nano != undefined) {
                                    this.time_unix_nano = data.time_unix_nano;
                                }
                                if ('name' in data && data.name != undefined) {
                                    this.name = data.name;
                                }
                                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;
                                }
                            }
                        }
                        get time_unix_nano() {
                            return pb_1.Message.getFieldWithDefault(this, 1, 0);
                        }
                        set time_unix_nano(value) {
                            pb_1.Message.setField(this, 1, value);
                        }
                        get name() {
                            return pb_1.Message.getFieldWithDefault(this, 2, '');
                        }
                        set name(value) {
                            pb_1.Message.setField(this, 2, value);
                        }
                        get attributes() {
                            return pb_1.Message.getRepeatedWrapperField(this, dependency_1.opentelemetry.proto.common.v1.KeyValue, 3);
                        }
                        set attributes(value) {
                            pb_1.Message.setRepeatedWrapperField(this, 3, value);
                        }
                        get dropped_attributes_count() {
                            return pb_1.Message.getFieldWithDefault(this, 4, 0);
                        }
                        set dropped_attributes_count(value) {
                            pb_1.Message.setField(this, 4, value);
                        }
                        static fromObject(data) {
                            const message = new Event({});
                            if (data.time_unix_nano != null) {
                                message.time_unix_nano = data.time_unix_nano;
                            }
                            if (data.name != null) {
                                message.name = data.name;
                            }
                            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;
                            }
                            return message;
                        }
                        toObject() {
                            const data = {};
                            if (this.time_unix_nano != null) {
                                data.time_unix_nano = this.time_unix_nano;
                            }
                            if (this.name != null) {
                                data.name = this.name;
                            }
                            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;
                            }
                            return data;
                        }
                        serialize(w) {
                            const writer = w || new pb_1.BinaryWriter();
                            if (this.time_unix_nano != 0)
                                writer.writeFixed64(1, this.time_unix_nano);
                            if (this.name.length)
                                writer.writeString(2, this.name);
                            if (this.attributes.length)
                                writer.writeRepeatedMessage(3, this.attributes, (item) => item.serialize(writer));
                            if (this.dropped_attributes_count != 0)
                                writer.writeUint32(4, this.dropped_attributes_count);
                            if (!w)
                                return writer.getResultBuffer();
                        }
                        static deserialize(bytes) {
                            const reader = bytes instanceof pb_1.BinaryReader
                                ? bytes
                                : new pb_1.BinaryReader(bytes), message = new Event();
                            while (reader.nextField()) {
                                if (reader.isEndGroup())
                                    break;
                                switch (reader.getFieldNumber()) {
                                    case 1:
                                        message.time_unix_nano = reader.readFixed64();
                                        break;
                                    case 2:
                                        message.name = reader.readString();
                                        break;
                                    case 3:
                                        reader.readMessage(message.attributes, () => pb_1.Message.addToRepeatedWrapperField(message, 3, dependency_1.opentelemetry.proto.common.v1.KeyValue.deserialize(reader), dependency_1.opentelemetry.proto.common.v1
                                            .KeyValue));
                                        break;
                                    case 4:
                                        message.dropped_attributes_count =
                                            reader.readUint32();
                                        break;
                                    default:
                                        reader.skipField();
                                }
                            }
                            return message;
                        }
                        serializeBinary() {
                            return this.serialize();
                        }
                        static deserializeBinary(bytes) {
                            return Event.deserialize(bytes);
                        }
                    }
                    _Event_one_of_decls = new WeakMap();
                    Span.Event = Event;
                    class Link extends pb_1.Message {
                        constructor(data) {
                            super();
                            _Link_one_of_decls.set(this, []);
                            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [4], __classPrivateFieldGet(this, _Link_one_of_decls, "f"));
                            if (!Array.isArray(data) && typeof data == 'object') {
                                if ('trace_id' in data && data.trace_id != undefined) {
                                    this.trace_id = data.trace_id;
                                }
                                if ('span_id' in data && data.span_id != undefined) {
                                    this.span_id = data.span_id;
                                }
                                if ('trace_state' in data &&
                                    data.trace_state != undefined) {
                                    this.trace_state = data.trace_state;
                                }
                                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 ('flags' in data && data.flags != undefined) {
                                    this.flags = data.flags;
                                }
                            }
                        }
                        get trace_id() {
                            return pb_1.Message.getFieldWithDefault(this, 1, new Uint8Array(0));
                        }
                        set trace_id(value) {
                            pb_1.Message.setField(this, 1, value);
                        }
                        get span_id() {
                            return pb_1.Message.getFieldWithDefault(this, 2, new Uint8Array(0));
                        }
                        set span_id(value) {
                            pb_1.Message.setField(this, 2, value);
                        }
                        get trace_state() {
                            return pb_1.Message.getFieldWithDefault(this, 3, '');
                        }
                        set trace_state(value) {
                            pb_1.Message.setField(this, 3, value);
                        }
                        get attributes() {
                            return pb_1.Message.getRepeatedWrapperField(this, dependency_1.opentelemetry.proto.common.v1.KeyValue, 4);
                        }
                        set attributes(value) {
                            pb_1.Message.setRepeatedWrapperField(this, 4, value);
                        }
                        get dropped_attributes_count() {
                            return pb_1.Message.getFieldWithDefault(this, 5, 0);
                        }
                        set dropped_attributes_count(value) {
                            pb_1.Message.setField(this, 5, value);
                        }
                        get flags() {
                            return pb_1.Message.getFieldWithDefault(this, 6, 0);
                        }
                        set flags(value) {
                            pb_1.Message.setField(this, 6, value);
                        }
                        static fromObject(data) {
                            const message = new Link({});
                            if (data.trace_id != null) {
                                message.trace_id = data.trace_id;
                            }
                            if (data.span_id != null) {
                                message.span_id = data.span_id;
                            }
                            if (data.trace_state != null) {
                                message.trace_state = data.trace_state;
                            }
                            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.flags != null) {
                                message.flags = data.flags;
                            }
                            return message;
                        }
                        toObject() {
                            const data = {};
                            if (this.trace_id != null) {
                                data.trace_id = this.trace_id;
                            }
                            if (this.span_id != null) {
                                data.span_id = this.span_id;
                            }
                            if (this.trace_state != null) {
                                data.trace_state = this.trace_state;
                            }
                            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.flags != null) {
                                data.flags = this.flags;
                            }
                            return data;
                        }
                        serialize(w) {
                            const writer = w || new pb_1.BinaryWriter();
                            if (this.trace_id.length)
                                writer.writeBytes(1, this.trace_id);
                            if (this.span_id.length)
                                writer.writeBytes(2, this.span_id);
                            if (this.trace_state.length)
                                writer.writeString(3, this.trace_state);
                            if (this.attributes.length)
                                writer.writeRepeatedMessage(4, this.attributes, (item) => item.serialize(writer));
                            if (this.dropped_attributes_count != 0)
                                writer.writeUint32(5, this.dropped_attributes_count);
                            if (this.flags != 0)
                                writer.writeFixed32(6, this.flags);
                            if (!w)
                                return writer.getResultBuffer();
                        }
                        static deserialize(bytes) {
                            const reader = bytes instanceof pb_1.BinaryReader
                                ? bytes
                                : new pb_1.BinaryReader(bytes), message = new Link();
                            while (reader.nextField()) {
                                if (reader.isEndGroup())
                                    break;
                                switch (reader.getFieldNumber()) {
                                    case 1:
                                        message.trace_id = reader.readBytes();
                                        break;
                                    case 2:
                                        message.span_id = reader.readBytes();
                                        break;
                                    case 3:
                                        message.trace_state = reader.readString();
                                        break;
                                    case 4:
                                        reader.readMessage(message.attributes, () => pb_1.Message.addToRepeatedWrapperField(message, 4, dependency_1.opentelemetry.proto.common.v1.KeyValue.deserialize(reader), dependency_1.opentelemetry.proto.common.v1
                                            .KeyValue));
                                        break;
                                    case 5:
                                        message.dropped_attributes_count =
                                            reader.readUint32();
                                        break;
                                    case 6:
                                        message.flags = reader.readFixed32();
                                        break;
                                    default:
                                        reader.skipField();
                                }
                            }
                            return message;
                        }
                        serializeBinary() {
                            return this.serialize();
                        }
                        static deserializeBinary(bytes) {
                            return Link.deserialize(bytes);
                        }
                    }
                    _Link_one_of_decls = new WeakMap();
                    Span.Link = Link;
                })(Span = v1.Span || (v1.Span = {}));
                class Status extends pb_1.Message {
                    constructor(data) {
                        super();
                        _Status_one_of_decls.set(this, []);
                        pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Status_one_of_decls, "f"));
                        if (!Array.isArray(data) && typeof data == 'object') {
                            if ('message' in data && data.message != undefined) {
                                this.message = data.message;
                            }
                            if ('code' in data && data.code != undefined) {
                                this.code = data.code;
                            }
                        }
                    }
                    get message() {
                        return pb_1.Message.getFieldWithDefault(this, 2, '');
                    }
                    set message(value) {
                        pb_1.Message.setField(this, 2, value);
                    }
                    get code() {
                        return pb_1.Message.getFieldWithDefault(this, 3, Status.StatusCode.STATUS_CODE_UNSET);
                    }
                    set code(value) {
                        pb_1.Message.setField(this, 3, value);
                    }
                    static fromObject(data) {
                        const message = new Status({});
                        if (data.message != null) {
                            message.message = data.message;
                        }
                        if (data.code != null) {
                            message.code = data.code;
                        }
                        return message;
                    }
                    toObject() {
                        const data = {};
                        if (this.message != null) {
                            data.message = this.message;
                        }
                        if (this.code != null) {
                            data.code = this.code;
                        }
                        return data;
                    }
                    serialize(w) {
                        const writer = w || new pb_1.BinaryWriter();
                        if (this.message.length)
                            writer.writeString(2, this.message);
                        if (this.code != Status.StatusCode.STATUS_CODE_UNSET)
                            writer.writeEnum(3, this.code);
                        if (!w)
                            return writer.getResultBuffer();
                    }
                    static deserialize(bytes) {
                        const reader = bytes instanceof pb_1.BinaryReader
                            ? bytes
                            : new pb_1.BinaryReader(bytes), message = new Status();
                        while (reader.nextField()) {
                            if (reader.isEndGroup())
                                break;
                            switch (reader.getFieldNumber()) {
                                case 2:
                                    message.message = reader.readString();
                                    break;
                                case 3:
                                    message.code = reader.readEnum();
                                    break;
                                default:
                                    reader.skipField();
                            }
                        }
                        return message;
                    }
                    serializeBinary() {
                        return this.serialize();
                    }
                    static deserializeBinary(bytes) {
                        return Status.deserialize(bytes);
                    }
                }
                _Status_one_of_decls = new WeakMap();
                v1.Status = Status;
                (function (Status) {
                    let StatusCode;
                    (function (StatusCode) {
                        StatusCode[StatusCode["STATUS_CODE_UNSET"] = 0] = "STATUS_CODE_UNSET";
                        StatusCode[StatusCode["STATUS_CODE_OK"] = 1] = "STATUS_CODE_OK";
                        StatusCode[StatusCode["STATUS_CODE_ERROR"] = 2] = "STATUS_CODE_ERROR";
                    })(StatusCode = Status.StatusCode || (Status.StatusCode = {}));
                })(Status = v1.Status || (v1.Status = {}));
            })(v1 = trace.v1 || (trace.v1 = {}));
        })(trace = proto.trace || (proto.trace = {}));
    })(proto = opentelemetry.proto || (opentelemetry.proto = {}));
})(opentelemetry || (exports.opentelemetry = opentelemetry = {}));
