"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.11.8
//   protoc               v4.25.9
// source: test/test.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.protoMetadata = exports.CRUDDefinition = exports.StreamDefinition = exports.TestDefinition = exports.Resource = exports.ResourceResponse = exports.ResourceListResponse = exports.ResourceList = exports.ExtendMe = exports.TestBufferedDataListResponse = exports.TestBufferedDataResponse = exports.TestBufferedDataList = exports.TestBufferedData = exports.TestEvent = exports.TestResponse = exports.StreamTestResponse = exports.TestRequest = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const any_1 = require("../google/protobuf/any");
const timestamp_1 = require("../google/protobuf/timestamp");
const auth_1 = require("../io/restorecommerce/auth");
const meta_1 = require("../io/restorecommerce/meta");
const resource_base_1 = require("../io/restorecommerce/resource_base");
const status_1 = require("../io/restorecommerce/status");
exports.protobufPackage = "test";
function createBaseTestRequest() {
    return {};
}
exports.TestRequest = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.value !== undefined) {
            writer.uint32(10).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.value = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { value: isSet(object.value) ? globalThis.String(object.value) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.value !== undefined) {
            obj.value = message.value;
        }
        return obj;
    },
    create(base) {
        return exports.TestRequest.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestRequest();
        message.value = object.value ?? undefined;
        return message;
    },
};
function createBaseStreamTestResponse() {
    return {};
}
exports.StreamTestResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.result !== undefined) {
            writer.uint32(10).string(message.result);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseStreamTestResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.result = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { result: isSet(object.result) ? globalThis.String(object.result) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.result !== undefined) {
            obj.result = message.result;
        }
        return obj;
    },
    create(base) {
        return exports.StreamTestResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseStreamTestResponse();
        message.result = object.result ?? undefined;
        return message;
    },
};
function createBaseTestResponse() {
    return {};
}
exports.TestResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.result !== undefined) {
            writer.uint32(10).string(message.result);
        }
        if (message.status !== undefined) {
            status_1.Status.encode(message.status, writer.uint32(34).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.result = reader.string();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.status = status_1.Status.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            result: isSet(object.result) ? globalThis.String(object.result) : undefined,
            status: isSet(object.status) ? status_1.Status.fromJSON(object.status) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.result !== undefined) {
            obj.result = message.result;
        }
        if (message.status !== undefined) {
            obj.status = status_1.Status.toJSON(message.status);
        }
        return obj;
    },
    create(base) {
        return exports.TestResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestResponse();
        message.result = object.result ?? undefined;
        message.status = (object.status !== undefined && object.status !== null)
            ? status_1.Status.fromPartial(object.status)
            : undefined;
        return message;
    },
};
function createBaseTestEvent() {
    return {};
}
exports.TestEvent = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.value !== undefined) {
            writer.uint32(10).string(message.value);
        }
        if (message.count !== undefined) {
            writer.uint32(16).int32(message.count);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.value = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.count = reader.int32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            value: isSet(object.value) ? globalThis.String(object.value) : undefined,
            count: isSet(object.count) ? globalThis.Number(object.count) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.value !== undefined) {
            obj.value = message.value;
        }
        if (message.count !== undefined) {
            obj.count = Math.round(message.count);
        }
        return obj;
    },
    create(base) {
        return exports.TestEvent.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestEvent();
        message.value = object.value ?? undefined;
        message.count = object.count ?? undefined;
        return message;
    },
};
function createBaseTestBufferedData() {
    return {};
}
exports.TestBufferedData = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.id !== undefined) {
            writer.uint32(10).string(message.id);
        }
        if (message.meta !== undefined) {
            meta_1.Meta.encode(message.meta, writer.uint32(18).fork()).join();
        }
        if (message.value !== undefined) {
            writer.uint32(26).string(message.value);
        }
        if (message.count !== undefined) {
            writer.uint32(32).int32(message.count);
        }
        if (message.data !== undefined) {
            any_1.Any.encode(message.data, writer.uint32(42).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestBufferedData();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.meta = meta_1.Meta.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.value = reader.string();
                    continue;
                }
                case 4: {
                    if (tag !== 32) {
                        break;
                    }
                    message.count = reader.int32();
                    continue;
                }
                case 5: {
                    if (tag !== 42) {
                        break;
                    }
                    message.data = any_1.Any.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : undefined,
            meta: isSet(object.meta) ? meta_1.Meta.fromJSON(object.meta) : undefined,
            value: isSet(object.value) ? globalThis.String(object.value) : undefined,
            count: isSet(object.count) ? globalThis.Number(object.count) : undefined,
            data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.meta !== undefined) {
            obj.meta = meta_1.Meta.toJSON(message.meta);
        }
        if (message.value !== undefined) {
            obj.value = message.value;
        }
        if (message.count !== undefined) {
            obj.count = Math.round(message.count);
        }
        if (message.data !== undefined) {
            obj.data = any_1.Any.toJSON(message.data);
        }
        return obj;
    },
    create(base) {
        return exports.TestBufferedData.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestBufferedData();
        message.id = object.id ?? undefined;
        message.meta = (object.meta !== undefined && object.meta !== null) ? meta_1.Meta.fromPartial(object.meta) : undefined;
        message.value = object.value ?? undefined;
        message.count = object.count ?? undefined;
        message.data = (object.data !== undefined && object.data !== null) ? any_1.Any.fromPartial(object.data) : undefined;
        return message;
    },
};
function createBaseTestBufferedDataList() {
    return {};
}
exports.TestBufferedDataList = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.items !== undefined && message.items.length !== 0) {
            for (const v of message.items) {
                exports.TestBufferedData.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.totalCount !== undefined) {
            writer.uint32(16).uint32(message.totalCount);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestBufferedDataList();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.items === undefined) {
                        message.items = [];
                    }
                    const el = exports.TestBufferedData.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.items.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.totalCount = reader.uint32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            items: globalThis.Array.isArray(object?.items)
                ? object.items.map((e) => exports.TestBufferedData.fromJSON(e))
                : undefined,
            totalCount: isSet(object.totalCount)
                ? globalThis.Number(object.totalCount)
                : isSet(object.total_count)
                    ? globalThis.Number(object.total_count)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.items?.length) {
            obj.items = message.items.map((e) => exports.TestBufferedData.toJSON(e));
        }
        if (message.totalCount !== undefined) {
            obj.totalCount = Math.round(message.totalCount);
        }
        return obj;
    },
    create(base) {
        return exports.TestBufferedDataList.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestBufferedDataList();
        message.items = object.items?.map((e) => exports.TestBufferedData.fromPartial(e)) || undefined;
        message.totalCount = object.totalCount ?? undefined;
        return message;
    },
};
function createBaseTestBufferedDataResponse() {
    return {};
}
exports.TestBufferedDataResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.payload !== undefined) {
            exports.TestBufferedData.encode(message.payload, writer.uint32(10).fork()).join();
        }
        if (message.status !== undefined) {
            status_1.Status.encode(message.status, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestBufferedDataResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.payload = exports.TestBufferedData.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.status = status_1.Status.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            payload: isSet(object.payload) ? exports.TestBufferedData.fromJSON(object.payload) : undefined,
            status: isSet(object.status) ? status_1.Status.fromJSON(object.status) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.payload !== undefined) {
            obj.payload = exports.TestBufferedData.toJSON(message.payload);
        }
        if (message.status !== undefined) {
            obj.status = status_1.Status.toJSON(message.status);
        }
        return obj;
    },
    create(base) {
        return exports.TestBufferedDataResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestBufferedDataResponse();
        message.payload = (object.payload !== undefined && object.payload !== null)
            ? exports.TestBufferedData.fromPartial(object.payload)
            : undefined;
        message.status = (object.status !== undefined && object.status !== null)
            ? status_1.Status.fromPartial(object.status)
            : undefined;
        return message;
    },
};
function createBaseTestBufferedDataListResponse() {
    return {};
}
exports.TestBufferedDataListResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.items !== undefined && message.items.length !== 0) {
            for (const v of message.items) {
                exports.TestBufferedDataResponse.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.totalCount !== undefined) {
            writer.uint32(16).uint32(message.totalCount);
        }
        if (message.operationStatus !== undefined) {
            status_1.OperationStatus.encode(message.operationStatus, writer.uint32(26).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTestBufferedDataListResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.items === undefined) {
                        message.items = [];
                    }
                    const el = exports.TestBufferedDataResponse.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.items.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.totalCount = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.operationStatus = status_1.OperationStatus.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            items: globalThis.Array.isArray(object?.items)
                ? object.items.map((e) => exports.TestBufferedDataResponse.fromJSON(e))
                : undefined,
            totalCount: isSet(object.totalCount)
                ? globalThis.Number(object.totalCount)
                : isSet(object.total_count)
                    ? globalThis.Number(object.total_count)
                    : undefined,
            operationStatus: isSet(object.operationStatus)
                ? status_1.OperationStatus.fromJSON(object.operationStatus)
                : isSet(object.operation_status)
                    ? status_1.OperationStatus.fromJSON(object.operation_status)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.items?.length) {
            obj.items = message.items.map((e) => exports.TestBufferedDataResponse.toJSON(e));
        }
        if (message.totalCount !== undefined) {
            obj.totalCount = Math.round(message.totalCount);
        }
        if (message.operationStatus !== undefined) {
            obj.operationStatus = status_1.OperationStatus.toJSON(message.operationStatus);
        }
        return obj;
    },
    create(base) {
        return exports.TestBufferedDataListResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTestBufferedDataListResponse();
        message.items = object.items?.map((e) => exports.TestBufferedDataResponse.fromPartial(e)) || undefined;
        message.totalCount = object.totalCount ?? undefined;
        message.operationStatus = (object.operationStatus !== undefined && object.operationStatus !== null)
            ? status_1.OperationStatus.fromPartial(object.operationStatus)
            : undefined;
        return message;
    },
};
function createBaseExtendMe() {
    return {};
}
exports.ExtendMe = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.bar !== undefined) {
            writer.uint32(1008).int32(message.bar);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseExtendMe();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 126: {
                    if (tag !== 1008) {
                        break;
                    }
                    message.bar = reader.int32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { bar: isSet(object.bar) ? globalThis.Number(object.bar) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.bar !== undefined) {
            obj.bar = Math.round(message.bar);
        }
        return obj;
    },
    create(base) {
        return exports.ExtendMe.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseExtendMe();
        message.bar = object.bar ?? undefined;
        return message;
    },
};
function createBaseResourceList() {
    return {};
}
exports.ResourceList = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.items !== undefined && message.items.length !== 0) {
            for (const v of message.items) {
                exports.Resource.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.totalCount !== undefined) {
            writer.uint32(16).uint32(message.totalCount);
        }
        if (message.subject !== undefined) {
            auth_1.Subject.encode(message.subject, writer.uint32(26).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseResourceList();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.items === undefined) {
                        message.items = [];
                    }
                    const el = exports.Resource.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.items.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.totalCount = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.subject = auth_1.Subject.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            items: globalThis.Array.isArray(object?.items) ? object.items.map((e) => exports.Resource.fromJSON(e)) : undefined,
            totalCount: isSet(object.totalCount)
                ? globalThis.Number(object.totalCount)
                : isSet(object.total_count)
                    ? globalThis.Number(object.total_count)
                    : undefined,
            subject: isSet(object.subject) ? auth_1.Subject.fromJSON(object.subject) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.items?.length) {
            obj.items = message.items.map((e) => exports.Resource.toJSON(e));
        }
        if (message.totalCount !== undefined) {
            obj.totalCount = Math.round(message.totalCount);
        }
        if (message.subject !== undefined) {
            obj.subject = auth_1.Subject.toJSON(message.subject);
        }
        return obj;
    },
    create(base) {
        return exports.ResourceList.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseResourceList();
        message.items = object.items?.map((e) => exports.Resource.fromPartial(e)) || undefined;
        message.totalCount = object.totalCount ?? undefined;
        message.subject = (object.subject !== undefined && object.subject !== null)
            ? auth_1.Subject.fromPartial(object.subject)
            : undefined;
        return message;
    },
};
function createBaseResourceListResponse() {
    return {};
}
exports.ResourceListResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.items !== undefined && message.items.length !== 0) {
            for (const v of message.items) {
                exports.ResourceResponse.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.totalCount !== undefined) {
            writer.uint32(16).uint32(message.totalCount);
        }
        if (message.operationStatus !== undefined) {
            status_1.OperationStatus.encode(message.operationStatus, writer.uint32(26).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseResourceListResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.items === undefined) {
                        message.items = [];
                    }
                    const el = exports.ResourceResponse.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.items.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.totalCount = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.operationStatus = status_1.OperationStatus.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            items: globalThis.Array.isArray(object?.items)
                ? object.items.map((e) => exports.ResourceResponse.fromJSON(e))
                : undefined,
            totalCount: isSet(object.totalCount)
                ? globalThis.Number(object.totalCount)
                : isSet(object.total_count)
                    ? globalThis.Number(object.total_count)
                    : undefined,
            operationStatus: isSet(object.operationStatus)
                ? status_1.OperationStatus.fromJSON(object.operationStatus)
                : isSet(object.operation_status)
                    ? status_1.OperationStatus.fromJSON(object.operation_status)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.items?.length) {
            obj.items = message.items.map((e) => exports.ResourceResponse.toJSON(e));
        }
        if (message.totalCount !== undefined) {
            obj.totalCount = Math.round(message.totalCount);
        }
        if (message.operationStatus !== undefined) {
            obj.operationStatus = status_1.OperationStatus.toJSON(message.operationStatus);
        }
        return obj;
    },
    create(base) {
        return exports.ResourceListResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseResourceListResponse();
        message.items = object.items?.map((e) => exports.ResourceResponse.fromPartial(e)) || undefined;
        message.totalCount = object.totalCount ?? undefined;
        message.operationStatus = (object.operationStatus !== undefined && object.operationStatus !== null)
            ? status_1.OperationStatus.fromPartial(object.operationStatus)
            : undefined;
        return message;
    },
};
function createBaseResourceResponse() {
    return {};
}
exports.ResourceResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.payload !== undefined) {
            exports.Resource.encode(message.payload, writer.uint32(10).fork()).join();
        }
        if (message.status !== undefined) {
            status_1.Status.encode(message.status, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseResourceResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.payload = exports.Resource.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.status = status_1.Status.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            payload: isSet(object.payload) ? exports.Resource.fromJSON(object.payload) : undefined,
            status: isSet(object.status) ? status_1.Status.fromJSON(object.status) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.payload !== undefined) {
            obj.payload = exports.Resource.toJSON(message.payload);
        }
        if (message.status !== undefined) {
            obj.status = status_1.Status.toJSON(message.status);
        }
        return obj;
    },
    create(base) {
        return exports.ResourceResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseResourceResponse();
        message.payload = (object.payload !== undefined && object.payload !== null)
            ? exports.Resource.fromPartial(object.payload)
            : undefined;
        message.status = (object.status !== undefined && object.status !== null)
            ? status_1.Status.fromPartial(object.status)
            : undefined;
        return message;
    },
};
function createBaseResource() {
    return {};
}
exports.Resource = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.id !== undefined) {
            writer.uint32(10).string(message.id);
        }
        if (message.meta !== undefined) {
            meta_1.Meta.encode(message.meta, writer.uint32(18).fork()).join();
        }
        if (message.value !== undefined) {
            writer.uint32(24).int32(message.value);
        }
        if (message.text !== undefined) {
            writer.uint32(34).string(message.text);
        }
        if (message.active !== undefined) {
            writer.uint32(40).bool(message.active);
        }
        if (message.created !== undefined) {
            timestamp_1.Timestamp.encode(toTimestamp(message.created), writer.uint32(50).fork()).join();
        }
        if (message.status !== undefined) {
            writer.uint32(58).string(message.status);
        }
        if (message.data !== undefined) {
            any_1.Any.encode(message.data, writer.uint32(66).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseResource();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.meta = meta_1.Meta.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.value = reader.int32();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.text = reader.string();
                    continue;
                }
                case 5: {
                    if (tag !== 40) {
                        break;
                    }
                    message.active = reader.bool();
                    continue;
                }
                case 6: {
                    if (tag !== 50) {
                        break;
                    }
                    message.created = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    continue;
                }
                case 7: {
                    if (tag !== 58) {
                        break;
                    }
                    message.status = reader.string();
                    continue;
                }
                case 8: {
                    if (tag !== 66) {
                        break;
                    }
                    message.data = any_1.Any.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            id: isSet(object.id) ? globalThis.String(object.id) : undefined,
            meta: isSet(object.meta) ? meta_1.Meta.fromJSON(object.meta) : undefined,
            value: isSet(object.value) ? globalThis.Number(object.value) : undefined,
            text: isSet(object.text) ? globalThis.String(object.text) : undefined,
            active: isSet(object.active) ? globalThis.Boolean(object.active) : undefined,
            created: isSet(object.created) ? fromJsonTimestamp(object.created) : undefined,
            status: isSet(object.status) ? globalThis.String(object.status) : undefined,
            data: isSet(object.data) ? any_1.Any.fromJSON(object.data) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.meta !== undefined) {
            obj.meta = meta_1.Meta.toJSON(message.meta);
        }
        if (message.value !== undefined) {
            obj.value = Math.round(message.value);
        }
        if (message.text !== undefined) {
            obj.text = message.text;
        }
        if (message.active !== undefined) {
            obj.active = message.active;
        }
        if (message.created !== undefined) {
            obj.created = message.created.toISOString();
        }
        if (message.status !== undefined) {
            obj.status = message.status;
        }
        if (message.data !== undefined) {
            obj.data = any_1.Any.toJSON(message.data);
        }
        return obj;
    },
    create(base) {
        return exports.Resource.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseResource();
        message.id = object.id ?? undefined;
        message.meta = (object.meta !== undefined && object.meta !== null) ? meta_1.Meta.fromPartial(object.meta) : undefined;
        message.value = object.value ?? undefined;
        message.text = object.text ?? undefined;
        message.active = object.active ?? undefined;
        message.created = object.created ?? undefined;
        message.status = object.status ?? undefined;
        message.data = (object.data !== undefined && object.data !== null) ? any_1.Any.fromPartial(object.data) : undefined;
        return message;
    },
};
exports.TestDefinition = {
    name: "Test",
    fullName: "test.Test",
    methods: {
        test: {
            name: "Test",
            requestType: exports.TestRequest,
            requestStream: false,
            responseType: exports.TestResponse,
            responseStream: false,
            options: {},
        },
        throw: {
            name: "Throw",
            requestType: exports.TestRequest,
            requestStream: false,
            responseType: exports.TestResponse,
            responseStream: false,
            options: {},
        },
        notImplemented: {
            name: "NotImplemented",
            requestType: exports.TestRequest,
            requestStream: false,
            responseType: exports.TestResponse,
            responseStream: false,
            options: {},
        },
        notFound: {
            name: "NotFound",
            requestType: exports.TestRequest,
            requestStream: false,
            responseType: exports.TestResponse,
            responseStream: false,
            options: {},
        },
        create: {
            name: "Create",
            requestType: exports.TestBufferedDataList,
            requestStream: false,
            responseType: exports.TestBufferedDataListResponse,
            responseStream: false,
            options: {},
        },
        read: {
            name: "Read",
            requestType: resource_base_1.ReadRequest,
            requestStream: false,
            responseType: exports.TestBufferedDataListResponse,
            responseStream: false,
            options: {},
        },
    },
};
exports.StreamDefinition = {
    name: "Stream",
    fullName: "test.Stream",
    methods: {
        biStream: {
            name: "BiStream",
            requestType: exports.TestRequest,
            requestStream: true,
            responseType: exports.StreamTestResponse,
            responseStream: true,
            options: {},
        },
        responseStream: {
            name: "ResponseStream",
            requestType: exports.TestRequest,
            requestStream: false,
            responseType: exports.StreamTestResponse,
            responseStream: true,
            options: {},
        },
        requestStream: {
            name: "RequestStream",
            requestType: exports.TestRequest,
            requestStream: true,
            responseType: exports.TestResponse,
            responseStream: false,
            options: {},
        },
    },
};
exports.CRUDDefinition = {
    name: "CRUD",
    fullName: "test.CRUD",
    methods: {
        read: {
            name: "Read",
            requestType: resource_base_1.ReadRequest,
            requestStream: false,
            responseType: exports.ResourceListResponse,
            responseStream: false,
            options: {},
        },
        create: {
            name: "Create",
            requestType: exports.ResourceList,
            requestStream: false,
            responseType: exports.ResourceListResponse,
            responseStream: false,
            options: {},
        },
        delete: {
            name: "Delete",
            requestType: resource_base_1.DeleteRequest,
            requestStream: false,
            responseType: resource_base_1.DeleteResponse,
            responseStream: false,
            options: {},
        },
        update: {
            name: "Update",
            requestType: exports.ResourceList,
            requestStream: false,
            responseType: exports.ResourceListResponse,
            responseStream: false,
            options: {},
        },
        upsert: {
            name: "Upsert",
            requestType: exports.ResourceList,
            requestStream: false,
            responseType: exports.ResourceListResponse,
            responseStream: false,
            options: {},
        },
    },
};
exports.protoMetadata = {
    fileDescriptor: {
        "name": "test/test.proto",
        "package": "test",
        "dependency": [
            "google/protobuf/any.proto",
            "io/restorecommerce/resource_base.proto",
            "io/restorecommerce/meta.proto",
            "io/restorecommerce/status.proto",
            "io/restorecommerce/auth.proto",
            "google/protobuf/timestamp.proto",
        ],
        "publicDependency": [],
        "weakDependency": [],
        "optionDependency": [],
        "messageType": [{
                "name": "TestRequest",
                "field": [{
                        "name": "value",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "value",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_value", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "StreamTestResponse",
                "field": [{
                        "name": "result",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "result",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_result", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "TestResponse",
                "field": [{
                        "name": "result",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "result",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "status",
                        "number": 4,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.Status",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "status",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_result", "options": undefined }, { "name": "_status", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "TestEvent",
                "field": [{
                        "name": "value",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "value",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "count",
                        "number": 2,
                        "label": 1,
                        "type": 5,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "count",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_value", "options": undefined }, { "name": "_count", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "TestBufferedData",
                "field": [{
                        "name": "id",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "id",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "meta",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.meta.Meta",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "meta",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "value",
                        "number": 3,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "value",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "count",
                        "number": 4,
                        "label": 1,
                        "type": 5,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 3,
                        "jsonName": "count",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "data",
                        "number": 5,
                        "label": 1,
                        "type": 11,
                        "typeName": ".google.protobuf.Any",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 4,
                        "jsonName": "data",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [
                    { "name": "_id", "options": undefined },
                    { "name": "_meta", "options": undefined },
                    { "name": "_value", "options": undefined },
                    { "name": "_count", "options": undefined },
                    { "name": "_data", "options": undefined },
                ],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "TestBufferedDataList",
                "field": [{
                        "name": "items",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".test.TestBufferedData",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "items",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "total_count",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "totalCount",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_total_count", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "TestBufferedDataResponse",
                "field": [{
                        "name": "payload",
                        "number": 1,
                        "label": 1,
                        "type": 11,
                        "typeName": ".test.TestBufferedData",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "payload",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "status",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.Status",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "status",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_payload", "options": undefined }, { "name": "_status", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "TestBufferedDataListResponse",
                "field": [{
                        "name": "items",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".test.TestBufferedDataResponse",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "items",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "total_count",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "totalCount",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "operation_status",
                        "number": 3,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.OperationStatus",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "operationStatus",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_total_count", "options": undefined }, {
                        "name": "_operation_status",
                        "options": undefined,
                    }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "ExtendMe",
                "field": [{
                        "name": "bar",
                        "number": 126,
                        "label": 1,
                        "type": 5,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "bar",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_bar", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "ResourceList",
                "field": [{
                        "name": "items",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".test.Resource",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "items",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "total_count",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "totalCount",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "subject",
                        "number": 3,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.auth.Subject",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "subject",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_total_count", "options": undefined }, { "name": "_subject", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "ResourceListResponse",
                "field": [{
                        "name": "items",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".test.ResourceResponse",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "items",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "total_count",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "totalCount",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "operation_status",
                        "number": 3,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.OperationStatus",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "operationStatus",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_total_count", "options": undefined }, {
                        "name": "_operation_status",
                        "options": undefined,
                    }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "ResourceResponse",
                "field": [{
                        "name": "payload",
                        "number": 1,
                        "label": 1,
                        "type": 11,
                        "typeName": ".test.Resource",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "payload",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "status",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.Status",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "status",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_payload", "options": undefined }, { "name": "_status", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "Resource",
                "field": [{
                        "name": "id",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "id",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "meta",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.meta.Meta",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "meta",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "value",
                        "number": 3,
                        "label": 1,
                        "type": 5,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "value",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "text",
                        "number": 4,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 3,
                        "jsonName": "text",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "active",
                        "number": 5,
                        "label": 1,
                        "type": 8,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 4,
                        "jsonName": "active",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "created",
                        "number": 6,
                        "label": 1,
                        "type": 11,
                        "typeName": ".google.protobuf.Timestamp",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 5,
                        "jsonName": "created",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "status",
                        "number": 7,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 6,
                        "jsonName": "status",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "data",
                        "number": 8,
                        "label": 1,
                        "type": 11,
                        "typeName": ".google.protobuf.Any",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 7,
                        "jsonName": "data",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [
                    { "name": "_id", "options": undefined },
                    { "name": "_meta", "options": undefined },
                    { "name": "_value", "options": undefined },
                    { "name": "_text", "options": undefined },
                    { "name": "_active", "options": undefined },
                    { "name": "_created", "options": undefined },
                    { "name": "_status", "options": undefined },
                    { "name": "_data", "options": undefined },
                ],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }],
        "enumType": [],
        "service": [{
                "name": "Test",
                "method": [{
                        "name": "Test",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.TestResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Throw",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.TestResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "NotImplemented",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.TestResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "NotFound",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.TestResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Create",
                        "inputType": ".test.TestBufferedDataList",
                        "outputType": ".test.TestBufferedDataListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Read",
                        "inputType": ".io.restorecommerce.resourcebase.ReadRequest",
                        "outputType": ".test.TestBufferedDataListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }],
                "options": undefined,
            }, {
                "name": "Stream",
                "method": [{
                        "name": "BiStream",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.StreamTestResponse",
                        "options": undefined,
                        "clientStreaming": true,
                        "serverStreaming": true,
                    }, {
                        "name": "ResponseStream",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.StreamTestResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": true,
                    }, {
                        "name": "RequestStream",
                        "inputType": ".test.TestRequest",
                        "outputType": ".test.TestResponse",
                        "options": undefined,
                        "clientStreaming": true,
                        "serverStreaming": false,
                    }],
                "options": undefined,
            }, {
                "name": "CRUD",
                "method": [{
                        "name": "Read",
                        "inputType": ".io.restorecommerce.resourcebase.ReadRequest",
                        "outputType": ".test.ResourceListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Create",
                        "inputType": ".test.ResourceList",
                        "outputType": ".test.ResourceListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Delete",
                        "inputType": ".io.restorecommerce.resourcebase.DeleteRequest",
                        "outputType": ".io.restorecommerce.resourcebase.DeleteResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Update",
                        "inputType": ".test.ResourceList",
                        "outputType": ".test.ResourceListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }, {
                        "name": "Upsert",
                        "inputType": ".test.ResourceList",
                        "outputType": ".test.ResourceListResponse",
                        "options": undefined,
                        "clientStreaming": false,
                        "serverStreaming": false,
                    }],
                "options": undefined,
            }],
        "extension": [],
        "options": undefined,
        "sourceCodeInfo": {
            "location": [{
                    "path": [6, 1],
                    "span": [22, 0, 26, 1],
                    "leadingComments": "*\n Stream test service\n",
                    "trailingComments": "",
                    "leadingDetachedComments": [],
                }, {
                    "path": [4, 12],
                    "span": [100, 0, 109, 1],
                    "leadingComments": "/ Example resource\n",
                    "trailingComments": "",
                    "leadingDetachedComments": [],
                }],
        },
        "syntax": "proto3",
        "edition": 0,
    },
    references: {
        ".test.TestRequest": exports.TestRequest,
        ".test.StreamTestResponse": exports.StreamTestResponse,
        ".test.TestResponse": exports.TestResponse,
        ".test.TestEvent": exports.TestEvent,
        ".test.TestBufferedData": exports.TestBufferedData,
        ".test.TestBufferedDataList": exports.TestBufferedDataList,
        ".test.TestBufferedDataResponse": exports.TestBufferedDataResponse,
        ".test.TestBufferedDataListResponse": exports.TestBufferedDataListResponse,
        ".test.ExtendMe": exports.ExtendMe,
        ".test.ResourceList": exports.ResourceList,
        ".test.ResourceListResponse": exports.ResourceListResponse,
        ".test.ResourceResponse": exports.ResourceResponse,
        ".test.Resource": exports.Resource,
    },
    dependencies: [any_1.protoMetadata, resource_base_1.protoMetadata, meta_1.protoMetadata, status_1.protoMetadata, auth_1.protoMetadata, timestamp_1.protoMetadata],
};
function toTimestamp(date) {
    const seconds = Math.trunc(date.getTime() / 1_000);
    const nanos = (date.getTime() % 1_000) * 1_000_000;
    return { seconds, nanos };
}
function fromTimestamp(t) {
    let millis = (t.seconds || 0) * 1_000;
    millis += (t.nanos || 0) / 1_000_000;
    return new globalThis.Date(millis);
}
function fromJsonTimestamp(o) {
    if (o instanceof globalThis.Date) {
        return o;
    }
    else if (typeof o === "string") {
        return new globalThis.Date(o);
    }
    else {
        return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
    }
}
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=test.js.map