// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.10.1
//   protoc               v3.21.12
// source: Event.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { ImgDetections } from "./ImgDetections";
export const protobufPackage = "dai.proto.event";
export var PrepareFileUploadClass;
(function (PrepareFileUploadClass) {
    PrepareFileUploadClass[PrepareFileUploadClass["UNKNOWN_FILE"] = 0] = "UNKNOWN_FILE";
    PrepareFileUploadClass[PrepareFileUploadClass["IMAGE_COLOR"] = 1] = "IMAGE_COLOR";
    PrepareFileUploadClass[PrepareFileUploadClass["IMAGE_STEREO_LEFT"] = 2] = "IMAGE_STEREO_LEFT";
    PrepareFileUploadClass[PrepareFileUploadClass["IMAGE_STEREO_RIGHT"] = 3] = "IMAGE_STEREO_RIGHT";
    PrepareFileUploadClass[PrepareFileUploadClass["DISPARITY"] = 4] = "DISPARITY";
    PrepareFileUploadClass[PrepareFileUploadClass["VIDEO"] = 5] = "VIDEO";
    PrepareFileUploadClass[PrepareFileUploadClass["POINTCLOUD"] = 6] = "POINTCLOUD";
    PrepareFileUploadClass[PrepareFileUploadClass["ANNOTATION"] = 7] = "ANNOTATION";
    PrepareFileUploadClass[PrepareFileUploadClass["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(PrepareFileUploadClass || (PrepareFileUploadClass = {}));
export function prepareFileUploadClassFromJSON(object) {
    switch (object) {
        case 0:
        case "UNKNOWN_FILE":
            return PrepareFileUploadClass.UNKNOWN_FILE;
        case 1:
        case "IMAGE_COLOR":
            return PrepareFileUploadClass.IMAGE_COLOR;
        case 2:
        case "IMAGE_STEREO_LEFT":
            return PrepareFileUploadClass.IMAGE_STEREO_LEFT;
        case 3:
        case "IMAGE_STEREO_RIGHT":
            return PrepareFileUploadClass.IMAGE_STEREO_RIGHT;
        case 4:
        case "DISPARITY":
            return PrepareFileUploadClass.DISPARITY;
        case 5:
        case "VIDEO":
            return PrepareFileUploadClass.VIDEO;
        case 6:
        case "POINTCLOUD":
            return PrepareFileUploadClass.POINTCLOUD;
        case 7:
        case "ANNOTATION":
            return PrepareFileUploadClass.ANNOTATION;
        case -1:
        case "UNRECOGNIZED":
        default:
            return PrepareFileUploadClass.UNRECOGNIZED;
    }
}
export function prepareFileUploadClassToJSON(object) {
    switch (object) {
        case PrepareFileUploadClass.UNKNOWN_FILE:
            return "UNKNOWN_FILE";
        case PrepareFileUploadClass.IMAGE_COLOR:
            return "IMAGE_COLOR";
        case PrepareFileUploadClass.IMAGE_STEREO_LEFT:
            return "IMAGE_STEREO_LEFT";
        case PrepareFileUploadClass.IMAGE_STEREO_RIGHT:
            return "IMAGE_STEREO_RIGHT";
        case PrepareFileUploadClass.DISPARITY:
            return "DISPARITY";
        case PrepareFileUploadClass.VIDEO:
            return "VIDEO";
        case PrepareFileUploadClass.POINTCLOUD:
            return "POINTCLOUD";
        case PrepareFileUploadClass.ANNOTATION:
            return "ANNOTATION";
        case PrepareFileUploadClass.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
export var RejectedFileGroupReason;
(function (RejectedFileGroupReason) {
    RejectedFileGroupReason[RejectedFileGroupReason["GROUP_UNEXPECTED_ERROR"] = 0] = "GROUP_UNEXPECTED_ERROR";
    RejectedFileGroupReason[RejectedFileGroupReason["FILE_INPUT_VALIDATION"] = 1] = "FILE_INPUT_VALIDATION";
    RejectedFileGroupReason[RejectedFileGroupReason["STORAGE_QUOTA_EXCEEDED"] = 2] = "STORAGE_QUOTA_EXCEEDED";
    RejectedFileGroupReason[RejectedFileGroupReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(RejectedFileGroupReason || (RejectedFileGroupReason = {}));
export function rejectedFileGroupReasonFromJSON(object) {
    switch (object) {
        case 0:
        case "GROUP_UNEXPECTED_ERROR":
            return RejectedFileGroupReason.GROUP_UNEXPECTED_ERROR;
        case 1:
        case "FILE_INPUT_VALIDATION":
            return RejectedFileGroupReason.FILE_INPUT_VALIDATION;
        case 2:
        case "STORAGE_QUOTA_EXCEEDED":
            return RejectedFileGroupReason.STORAGE_QUOTA_EXCEEDED;
        case -1:
        case "UNRECOGNIZED":
        default:
            return RejectedFileGroupReason.UNRECOGNIZED;
    }
}
export function rejectedFileGroupReasonToJSON(object) {
    switch (object) {
        case RejectedFileGroupReason.GROUP_UNEXPECTED_ERROR:
            return "GROUP_UNEXPECTED_ERROR";
        case RejectedFileGroupReason.FILE_INPUT_VALIDATION:
            return "FILE_INPUT_VALIDATION";
        case RejectedFileGroupReason.STORAGE_QUOTA_EXCEEDED:
            return "STORAGE_QUOTA_EXCEEDED";
        case RejectedFileGroupReason.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
export var RejectedFileReason;
(function (RejectedFileReason) {
    RejectedFileReason[RejectedFileReason["FILE_UNEXPECTED_ERROR"] = 0] = "FILE_UNEXPECTED_ERROR";
    RejectedFileReason[RejectedFileReason["INPUT_VALIDATION"] = 1] = "INPUT_VALIDATION";
    RejectedFileReason[RejectedFileReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(RejectedFileReason || (RejectedFileReason = {}));
export function rejectedFileReasonFromJSON(object) {
    switch (object) {
        case 0:
        case "FILE_UNEXPECTED_ERROR":
            return RejectedFileReason.FILE_UNEXPECTED_ERROR;
        case 1:
        case "INPUT_VALIDATION":
            return RejectedFileReason.INPUT_VALIDATION;
        case -1:
        case "UNRECOGNIZED":
        default:
            return RejectedFileReason.UNRECOGNIZED;
    }
}
export function rejectedFileReasonToJSON(object) {
    switch (object) {
        case RejectedFileReason.FILE_UNEXPECTED_ERROR:
            return "FILE_UNEXPECTED_ERROR";
        case RejectedFileReason.INPUT_VALIDATION:
            return "INPUT_VALIDATION";
        case RejectedFileReason.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
export var RejectedEventReason;
(function (RejectedEventReason) {
    RejectedEventReason[RejectedEventReason["GENERIC_EVENT_REJECTED"] = 0] = "GENERIC_EVENT_REJECTED";
    RejectedEventReason[RejectedEventReason["EVENT_VALIDATION"] = 1] = "EVENT_VALIDATION";
    RejectedEventReason[RejectedEventReason["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(RejectedEventReason || (RejectedEventReason = {}));
export function rejectedEventReasonFromJSON(object) {
    switch (object) {
        case 0:
        case "GENERIC_EVENT_REJECTED":
            return RejectedEventReason.GENERIC_EVENT_REJECTED;
        case 1:
        case "EVENT_VALIDATION":
            return RejectedEventReason.EVENT_VALIDATION;
        case -1:
        case "UNRECOGNIZED":
        default:
            return RejectedEventReason.UNRECOGNIZED;
    }
}
export function rejectedEventReasonToJSON(object) {
    switch (object) {
        case RejectedEventReason.GENERIC_EVENT_REJECTED:
            return "GENERIC_EVENT_REJECTED";
        case RejectedEventReason.EVENT_VALIDATION:
            return "EVENT_VALIDATION";
        case RejectedEventReason.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
function createBaseBatchPrepareFileUpload() {
    return { groups: [] };
}
export const BatchPrepareFileUpload = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.groups) {
            PrepareFileUploadGroup.encode(v, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseBatchPrepareFileUpload();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.groups.push(PrepareFileUploadGroup.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            groups: globalThis.Array.isArray(object?.groups)
                ? object.groups.map((e) => PrepareFileUploadGroup.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.groups?.length) {
            obj.groups = message.groups.map((e) => PrepareFileUploadGroup.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return BatchPrepareFileUpload.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBatchPrepareFileUpload();
        message.groups = object.groups?.map((e) => PrepareFileUploadGroup.fromPartial(e)) || [];
        return message;
    },
};
function createBasePrepareFileUploadGroup() {
    return { files: [] };
}
export const PrepareFileUploadGroup = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.files) {
            PrepareFileUpload.encode(v, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePrepareFileUploadGroup();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.files.push(PrepareFileUpload.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => PrepareFileUpload.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.files?.length) {
            obj.files = message.files.map((e) => PrepareFileUpload.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return PrepareFileUploadGroup.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePrepareFileUploadGroup();
        message.files = object.files?.map((e) => PrepareFileUpload.fromPartial(e)) || [];
        return message;
    },
};
function createBasePrepareFileUpload() {
    return { checksum: "", mimeType: "", size: 0, filename: "", classification: 0 };
}
export const PrepareFileUpload = {
    encode(message, writer = new BinaryWriter()) {
        if (message.checksum !== "") {
            writer.uint32(10).string(message.checksum);
        }
        if (message.mimeType !== "") {
            writer.uint32(18).string(message.mimeType);
        }
        if (message.size !== 0) {
            writer.uint32(24).int64(message.size);
        }
        if (message.filename !== "") {
            writer.uint32(34).string(message.filename);
        }
        if (message.classification !== 0) {
            writer.uint32(40).int32(message.classification);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePrepareFileUpload();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.checksum = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.mimeType = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.size = longToNumber(reader.int64());
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.filename = reader.string();
                    continue;
                }
                case 5: {
                    if (tag !== 40) {
                        break;
                    }
                    message.classification = reader.int32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            checksum: isSet(object.checksum) ? globalThis.String(object.checksum) : "",
            mimeType: isSet(object.mimeType) ? globalThis.String(object.mimeType) : "",
            size: isSet(object.size) ? globalThis.Number(object.size) : 0,
            filename: isSet(object.filename) ? globalThis.String(object.filename) : "",
            classification: isSet(object.classification) ? prepareFileUploadClassFromJSON(object.classification) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.checksum !== "") {
            obj.checksum = message.checksum;
        }
        if (message.mimeType !== "") {
            obj.mimeType = message.mimeType;
        }
        if (message.size !== 0) {
            obj.size = Math.round(message.size);
        }
        if (message.filename !== "") {
            obj.filename = message.filename;
        }
        if (message.classification !== 0) {
            obj.classification = prepareFileUploadClassToJSON(message.classification);
        }
        return obj;
    },
    create(base) {
        return PrepareFileUpload.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePrepareFileUpload();
        message.checksum = object.checksum ?? "";
        message.mimeType = object.mimeType ?? "";
        message.size = object.size ?? 0;
        message.filename = object.filename ?? "";
        message.classification = object.classification ?? 0;
        return message;
    },
};
function createBaseBatchFileUploadResult() {
    return { groups: [] };
}
export const BatchFileUploadResult = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.groups) {
            FileUploadGroupResult.encode(v, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseBatchFileUploadResult();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.groups.push(FileUploadGroupResult.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            groups: globalThis.Array.isArray(object?.groups)
                ? object.groups.map((e) => FileUploadGroupResult.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.groups?.length) {
            obj.groups = message.groups.map((e) => FileUploadGroupResult.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return BatchFileUploadResult.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBatchFileUploadResult();
        message.groups = object.groups?.map((e) => FileUploadGroupResult.fromPartial(e)) || [];
        return message;
    },
};
function createBaseFileUploadGroupResult() {
    return { rejected: undefined, files: [] };
}
export const FileUploadGroupResult = {
    encode(message, writer = new BinaryWriter()) {
        if (message.rejected !== undefined) {
            RejectedFileGroup.encode(message.rejected, writer.uint32(10).fork()).join();
        }
        for (const v of message.files) {
            FileUploadResult.encode(v, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseFileUploadGroupResult();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.rejected = RejectedFileGroup.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.files.push(FileUploadResult.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            rejected: isSet(object.rejected) ? RejectedFileGroup.fromJSON(object.rejected) : undefined,
            files: globalThis.Array.isArray(object?.files) ? object.files.map((e) => FileUploadResult.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.rejected !== undefined) {
            obj.rejected = RejectedFileGroup.toJSON(message.rejected);
        }
        if (message.files?.length) {
            obj.files = message.files.map((e) => FileUploadResult.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return FileUploadGroupResult.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseFileUploadGroupResult();
        message.rejected = (object.rejected !== undefined && object.rejected !== null)
            ? RejectedFileGroup.fromPartial(object.rejected)
            : undefined;
        message.files = object.files?.map((e) => FileUploadResult.fromPartial(e)) || [];
        return message;
    },
};
function createBaseRejectedFileGroup() {
    return { reason: 0 };
}
export const RejectedFileGroup = {
    encode(message, writer = new BinaryWriter()) {
        if (message.reason !== 0) {
            writer.uint32(8).int32(message.reason);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRejectedFileGroup();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.reason = reader.int32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { reason: isSet(object.reason) ? rejectedFileGroupReasonFromJSON(object.reason) : 0 };
    },
    toJSON(message) {
        const obj = {};
        if (message.reason !== 0) {
            obj.reason = rejectedFileGroupReasonToJSON(message.reason);
        }
        return obj;
    },
    create(base) {
        return RejectedFileGroup.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRejectedFileGroup();
        message.reason = object.reason ?? 0;
        return message;
    },
};
function createBaseFileUploadResult() {
    return { accepted: undefined, rejected: undefined };
}
export const FileUploadResult = {
    encode(message, writer = new BinaryWriter()) {
        if (message.accepted !== undefined) {
            AcceptedFile.encode(message.accepted, writer.uint32(10).fork()).join();
        }
        if (message.rejected !== undefined) {
            RejectedFile.encode(message.rejected, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseFileUploadResult();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.accepted = AcceptedFile.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.rejected = RejectedFile.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            accepted: isSet(object.accepted) ? AcceptedFile.fromJSON(object.accepted) : undefined,
            rejected: isSet(object.rejected) ? RejectedFile.fromJSON(object.rejected) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.accepted !== undefined) {
            obj.accepted = AcceptedFile.toJSON(message.accepted);
        }
        if (message.rejected !== undefined) {
            obj.rejected = RejectedFile.toJSON(message.rejected);
        }
        return obj;
    },
    create(base) {
        return FileUploadResult.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseFileUploadResult();
        message.accepted = (object.accepted !== undefined && object.accepted !== null)
            ? AcceptedFile.fromPartial(object.accepted)
            : undefined;
        message.rejected = (object.rejected !== undefined && object.rejected !== null)
            ? RejectedFile.fromPartial(object.rejected)
            : undefined;
        return message;
    },
};
function createBaseAcceptedFile() {
    return { uploadUrl: "", id: "" };
}
export const AcceptedFile = {
    encode(message, writer = new BinaryWriter()) {
        if (message.uploadUrl !== "") {
            writer.uint32(10).string(message.uploadUrl);
        }
        if (message.id !== "") {
            writer.uint32(18).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAcceptedFile();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.uploadUrl = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.id = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            uploadUrl: isSet(object.uploadUrl) ? globalThis.String(object.uploadUrl) : "",
            id: isSet(object.id) ? globalThis.String(object.id) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.uploadUrl !== "") {
            obj.uploadUrl = message.uploadUrl;
        }
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return AcceptedFile.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAcceptedFile();
        message.uploadUrl = object.uploadUrl ?? "";
        message.id = object.id ?? "";
        return message;
    },
};
function createBaseRejectedFile() {
    return { reason: 0, message: "" };
}
export const RejectedFile = {
    encode(message, writer = new BinaryWriter()) {
        if (message.reason !== 0) {
            writer.uint32(8).int32(message.reason);
        }
        if (message.message !== "") {
            writer.uint32(18).string(message.message);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRejectedFile();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.reason = reader.int32();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.message = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            reason: isSet(object.reason) ? rejectedFileReasonFromJSON(object.reason) : 0,
            message: isSet(object.message) ? globalThis.String(object.message) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.reason !== 0) {
            obj.reason = rejectedFileReasonToJSON(message.reason);
        }
        if (message.message !== "") {
            obj.message = message.message;
        }
        return obj;
    },
    create(base) {
        return RejectedFile.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRejectedFile();
        message.reason = object.reason ?? 0;
        message.message = object.message ?? "";
        return message;
    },
};
function createBaseBatchUploadEvents() {
    return { events: [] };
}
export const BatchUploadEvents = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.events) {
            Event.encode(v, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseBatchUploadEvents();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.events.push(Event.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { events: globalThis.Array.isArray(object?.events) ? object.events.map((e) => Event.fromJSON(e)) : [] };
    },
    toJSON(message) {
        const obj = {};
        if (message.events?.length) {
            obj.events = message.events.map((e) => Event.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return BatchUploadEvents.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBatchUploadEvents();
        message.events = object.events?.map((e) => Event.fromPartial(e)) || [];
        return message;
    },
};
function createBaseEvent() {
    return {
        createdAt: 0,
        name: "",
        tags: [],
        extras: {},
        sourceSerialNumber: undefined,
        sourceAppId: undefined,
        sourceAppIdentifier: undefined,
        associateFiles: [],
    };
}
export const Event = {
    encode(message, writer = new BinaryWriter()) {
        if (message.createdAt !== 0) {
            writer.uint32(8).int64(message.createdAt);
        }
        if (message.name !== "") {
            writer.uint32(18).string(message.name);
        }
        for (const v of message.tags) {
            writer.uint32(26).string(v);
        }
        globalThis.Object.entries(message.extras).forEach(([key, value]) => {
            Event_ExtrasEntry.encode({ key: key, value }, writer.uint32(34).fork()).join();
        });
        if (message.sourceSerialNumber !== undefined) {
            writer.uint32(42).string(message.sourceSerialNumber);
        }
        if (message.sourceAppId !== undefined) {
            writer.uint32(50).string(message.sourceAppId);
        }
        if (message.sourceAppIdentifier !== undefined) {
            writer.uint32(58).string(message.sourceAppIdentifier);
        }
        for (const v of message.associateFiles) {
            AssociateFile.encode(v, writer.uint32(66).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.createdAt = longToNumber(reader.int64());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.name = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.tags.push(reader.string());
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    const entry4 = Event_ExtrasEntry.decode(reader, reader.uint32());
                    if (entry4.value !== undefined) {
                        message.extras[entry4.key] = entry4.value;
                    }
                    continue;
                }
                case 5: {
                    if (tag !== 42) {
                        break;
                    }
                    message.sourceSerialNumber = reader.string();
                    continue;
                }
                case 6: {
                    if (tag !== 50) {
                        break;
                    }
                    message.sourceAppId = reader.string();
                    continue;
                }
                case 7: {
                    if (tag !== 58) {
                        break;
                    }
                    message.sourceAppIdentifier = reader.string();
                    continue;
                }
                case 8: {
                    if (tag !== 66) {
                        break;
                    }
                    message.associateFiles.push(AssociateFile.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            createdAt: isSet(object.createdAt) ? globalThis.Number(object.createdAt) : 0,
            name: isSet(object.name) ? globalThis.String(object.name) : "",
            tags: globalThis.Array.isArray(object?.tags) ? object.tags.map((e) => globalThis.String(e)) : [],
            extras: isObject(object.extras)
                ? globalThis.Object.entries(object.extras).reduce((acc, [key, value]) => {
                    acc[key] = globalThis.String(value);
                    return acc;
                }, {})
                : {},
            sourceSerialNumber: isSet(object.sourceSerialNumber) ? globalThis.String(object.sourceSerialNumber) : undefined,
            sourceAppId: isSet(object.sourceAppId) ? globalThis.String(object.sourceAppId) : undefined,
            sourceAppIdentifier: isSet(object.sourceAppIdentifier)
                ? globalThis.String(object.sourceAppIdentifier)
                : undefined,
            associateFiles: globalThis.Array.isArray(object?.associateFiles)
                ? object.associateFiles.map((e) => AssociateFile.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.createdAt !== 0) {
            obj.createdAt = Math.round(message.createdAt);
        }
        if (message.name !== "") {
            obj.name = message.name;
        }
        if (message.tags?.length) {
            obj.tags = message.tags;
        }
        if (message.extras) {
            const entries = globalThis.Object.entries(message.extras);
            if (entries.length > 0) {
                obj.extras = {};
                entries.forEach(([k, v]) => {
                    obj.extras[k] = v;
                });
            }
        }
        if (message.sourceSerialNumber !== undefined) {
            obj.sourceSerialNumber = message.sourceSerialNumber;
        }
        if (message.sourceAppId !== undefined) {
            obj.sourceAppId = message.sourceAppId;
        }
        if (message.sourceAppIdentifier !== undefined) {
            obj.sourceAppIdentifier = message.sourceAppIdentifier;
        }
        if (message.associateFiles?.length) {
            obj.associateFiles = message.associateFiles.map((e) => AssociateFile.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return Event.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEvent();
        message.createdAt = object.createdAt ?? 0;
        message.name = object.name ?? "";
        message.tags = object.tags?.map((e) => e) || [];
        message.extras = globalThis.Object.entries(object.extras ?? {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = globalThis.String(value);
            }
            return acc;
        }, {});
        message.sourceSerialNumber = object.sourceSerialNumber ?? undefined;
        message.sourceAppId = object.sourceAppId ?? undefined;
        message.sourceAppIdentifier = object.sourceAppIdentifier ?? undefined;
        message.associateFiles = object.associateFiles?.map((e) => AssociateFile.fromPartial(e)) || [];
        return message;
    },
};
function createBaseEvent_ExtrasEntry() {
    return { key: "", value: "" };
}
export const Event_ExtrasEntry = {
    encode(message, writer = new BinaryWriter()) {
        if (message.key !== "") {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== "") {
            writer.uint32(18).string(message.value);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEvent_ExtrasEntry();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.key = reader.string();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.value = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            key: isSet(object.key) ? globalThis.String(object.key) : "",
            value: isSet(object.value) ? globalThis.String(object.value) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.key !== "") {
            obj.key = message.key;
        }
        if (message.value !== "") {
            obj.value = message.value;
        }
        return obj;
    },
    create(base) {
        return Event_ExtrasEntry.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEvent_ExtrasEntry();
        message.key = object.key ?? "";
        message.value = object.value ?? "";
        return message;
    },
};
function createBaseAssociateFile() {
    return { id: "" };
}
export const AssociateFile = {
    encode(message, writer = new BinaryWriter()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAssociateFile();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    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) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return AssociateFile.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAssociateFile();
        message.id = object.id ?? "";
        return message;
    },
};
function createBaseBatchUploadEventsResult() {
    return { events: [] };
}
export const BatchUploadEventsResult = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.events) {
            EventResult.encode(v, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseBatchUploadEventsResult();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.events.push(EventResult.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            events: globalThis.Array.isArray(object?.events) ? object.events.map((e) => EventResult.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.events?.length) {
            obj.events = message.events.map((e) => EventResult.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return BatchUploadEventsResult.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseBatchUploadEventsResult();
        message.events = object.events?.map((e) => EventResult.fromPartial(e)) || [];
        return message;
    },
};
function createBaseEventResult() {
    return { accepted: undefined, rejected: undefined };
}
export const EventResult = {
    encode(message, writer = new BinaryWriter()) {
        if (message.accepted !== undefined) {
            AcceptedEvent.encode(message.accepted, writer.uint32(10).fork()).join();
        }
        if (message.rejected !== undefined) {
            RejectedEvent.encode(message.rejected, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEventResult();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.accepted = AcceptedEvent.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.rejected = RejectedEvent.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            accepted: isSet(object.accepted) ? AcceptedEvent.fromJSON(object.accepted) : undefined,
            rejected: isSet(object.rejected) ? RejectedEvent.fromJSON(object.rejected) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.accepted !== undefined) {
            obj.accepted = AcceptedEvent.toJSON(message.accepted);
        }
        if (message.rejected !== undefined) {
            obj.rejected = RejectedEvent.toJSON(message.rejected);
        }
        return obj;
    },
    create(base) {
        return EventResult.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEventResult();
        message.accepted = (object.accepted !== undefined && object.accepted !== null)
            ? AcceptedEvent.fromPartial(object.accepted)
            : undefined;
        message.rejected = (object.rejected !== undefined && object.rejected !== null)
            ? RejectedEvent.fromPartial(object.rejected)
            : undefined;
        return message;
    },
};
function createBaseAcceptedEvent() {
    return { id: "" };
}
export const AcceptedEvent = {
    encode(message, writer = new BinaryWriter()) {
        if (message.id !== "") {
            writer.uint32(10).string(message.id);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseAcceptedEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.id = reader.string();
                    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) : "" };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== "") {
            obj.id = message.id;
        }
        return obj;
    },
    create(base) {
        return AcceptedEvent.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseAcceptedEvent();
        message.id = object.id ?? "";
        return message;
    },
};
function createBaseRejectedEvent() {
    return { reason: 0, message: "" };
}
export const RejectedEvent = {
    encode(message, writer = new BinaryWriter()) {
        if (message.reason !== 0) {
            writer.uint32(8).int32(message.reason);
        }
        if (message.message !== "") {
            writer.uint32(18).string(message.message);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRejectedEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.reason = reader.int32();
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.message = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            reason: isSet(object.reason) ? rejectedEventReasonFromJSON(object.reason) : 0,
            message: isSet(object.message) ? globalThis.String(object.message) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.reason !== 0) {
            obj.reason = rejectedEventReasonToJSON(message.reason);
        }
        if (message.message !== "") {
            obj.message = message.message;
        }
        return obj;
    },
    create(base) {
        return RejectedEvent.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRejectedEvent();
        message.reason = object.reason ?? 0;
        message.message = object.message ?? "";
        return message;
    },
};
function createBaseFileLimits() {
    return {
        maxFileSizeBytes: 0,
        remainingStorageBytes: 0,
        bytesPerHourRate: 0,
        uploadsPerHourRate: 0,
        groupsPerAllocation: 0,
        filesPerGroupInAllocation: 0,
    };
}
export const FileLimits = {
    encode(message, writer = new BinaryWriter()) {
        if (message.maxFileSizeBytes !== 0) {
            writer.uint32(8).uint64(message.maxFileSizeBytes);
        }
        if (message.remainingStorageBytes !== 0) {
            writer.uint32(16).uint64(message.remainingStorageBytes);
        }
        if (message.bytesPerHourRate !== 0) {
            writer.uint32(24).uint64(message.bytesPerHourRate);
        }
        if (message.uploadsPerHourRate !== 0) {
            writer.uint32(32).uint32(message.uploadsPerHourRate);
        }
        if (message.groupsPerAllocation !== 0) {
            writer.uint32(40).uint32(message.groupsPerAllocation);
        }
        if (message.filesPerGroupInAllocation !== 0) {
            writer.uint32(48).uint32(message.filesPerGroupInAllocation);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseFileLimits();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.maxFileSizeBytes = longToNumber(reader.uint64());
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.remainingStorageBytes = longToNumber(reader.uint64());
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.bytesPerHourRate = longToNumber(reader.uint64());
                    continue;
                }
                case 4: {
                    if (tag !== 32) {
                        break;
                    }
                    message.uploadsPerHourRate = reader.uint32();
                    continue;
                }
                case 5: {
                    if (tag !== 40) {
                        break;
                    }
                    message.groupsPerAllocation = reader.uint32();
                    continue;
                }
                case 6: {
                    if (tag !== 48) {
                        break;
                    }
                    message.filesPerGroupInAllocation = reader.uint32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            maxFileSizeBytes: isSet(object.maxFileSizeBytes) ? globalThis.Number(object.maxFileSizeBytes) : 0,
            remainingStorageBytes: isSet(object.remainingStorageBytes) ? globalThis.Number(object.remainingStorageBytes) : 0,
            bytesPerHourRate: isSet(object.bytesPerHourRate) ? globalThis.Number(object.bytesPerHourRate) : 0,
            uploadsPerHourRate: isSet(object.uploadsPerHourRate) ? globalThis.Number(object.uploadsPerHourRate) : 0,
            groupsPerAllocation: isSet(object.groupsPerAllocation) ? globalThis.Number(object.groupsPerAllocation) : 0,
            filesPerGroupInAllocation: isSet(object.filesPerGroupInAllocation)
                ? globalThis.Number(object.filesPerGroupInAllocation)
                : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.maxFileSizeBytes !== 0) {
            obj.maxFileSizeBytes = Math.round(message.maxFileSizeBytes);
        }
        if (message.remainingStorageBytes !== 0) {
            obj.remainingStorageBytes = Math.round(message.remainingStorageBytes);
        }
        if (message.bytesPerHourRate !== 0) {
            obj.bytesPerHourRate = Math.round(message.bytesPerHourRate);
        }
        if (message.uploadsPerHourRate !== 0) {
            obj.uploadsPerHourRate = Math.round(message.uploadsPerHourRate);
        }
        if (message.groupsPerAllocation !== 0) {
            obj.groupsPerAllocation = Math.round(message.groupsPerAllocation);
        }
        if (message.filesPerGroupInAllocation !== 0) {
            obj.filesPerGroupInAllocation = Math.round(message.filesPerGroupInAllocation);
        }
        return obj;
    },
    create(base) {
        return FileLimits.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseFileLimits();
        message.maxFileSizeBytes = object.maxFileSizeBytes ?? 0;
        message.remainingStorageBytes = object.remainingStorageBytes ?? 0;
        message.bytesPerHourRate = object.bytesPerHourRate ?? 0;
        message.uploadsPerHourRate = object.uploadsPerHourRate ?? 0;
        message.groupsPerAllocation = object.groupsPerAllocation ?? 0;
        message.filesPerGroupInAllocation = object.filesPerGroupInAllocation ?? 0;
        return message;
    },
};
function createBaseEventLimits() {
    return { eventsPerHourRate: 0, snapsPerHourRate: 0, eventsPerRequest: 0 };
}
export const EventLimits = {
    encode(message, writer = new BinaryWriter()) {
        if (message.eventsPerHourRate !== 0) {
            writer.uint32(8).uint32(message.eventsPerHourRate);
        }
        if (message.snapsPerHourRate !== 0) {
            writer.uint32(16).uint32(message.snapsPerHourRate);
        }
        if (message.eventsPerRequest !== 0) {
            writer.uint32(24).uint32(message.eventsPerRequest);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEventLimits();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.eventsPerHourRate = reader.uint32();
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.snapsPerHourRate = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.eventsPerRequest = reader.uint32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            eventsPerHourRate: isSet(object.eventsPerHourRate) ? globalThis.Number(object.eventsPerHourRate) : 0,
            snapsPerHourRate: isSet(object.snapsPerHourRate) ? globalThis.Number(object.snapsPerHourRate) : 0,
            eventsPerRequest: isSet(object.eventsPerRequest) ? globalThis.Number(object.eventsPerRequest) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.eventsPerHourRate !== 0) {
            obj.eventsPerHourRate = Math.round(message.eventsPerHourRate);
        }
        if (message.snapsPerHourRate !== 0) {
            obj.snapsPerHourRate = Math.round(message.snapsPerHourRate);
        }
        if (message.eventsPerRequest !== 0) {
            obj.eventsPerRequest = Math.round(message.eventsPerRequest);
        }
        return obj;
    },
    create(base) {
        return EventLimits.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEventLimits();
        message.eventsPerHourRate = object.eventsPerHourRate ?? 0;
        message.snapsPerHourRate = object.snapsPerHourRate ?? 0;
        message.eventsPerRequest = object.eventsPerRequest ?? 0;
        return message;
    },
};
function createBaseApiUsage() {
    return { files: undefined, events: undefined };
}
export const ApiUsage = {
    encode(message, writer = new BinaryWriter()) {
        if (message.files !== undefined) {
            FileLimits.encode(message.files, writer.uint32(10).fork()).join();
        }
        if (message.events !== undefined) {
            EventLimits.encode(message.events, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseApiUsage();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.files = FileLimits.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.events = EventLimits.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            files: isSet(object.files) ? FileLimits.fromJSON(object.files) : undefined,
            events: isSet(object.events) ? EventLimits.fromJSON(object.events) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.files !== undefined) {
            obj.files = FileLimits.toJSON(message.files);
        }
        if (message.events !== undefined) {
            obj.events = EventLimits.toJSON(message.events);
        }
        return obj;
    },
    create(base) {
        return ApiUsage.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseApiUsage();
        message.files = (object.files !== undefined && object.files !== null)
            ? FileLimits.fromPartial(object.files)
            : undefined;
        message.events = (object.events !== undefined && object.events !== null)
            ? EventLimits.fromPartial(object.events)
            : undefined;
        return message;
    },
};
function createBaseSnapAnnotations() {
    return { detections: undefined };
}
export const SnapAnnotations = {
    encode(message, writer = new BinaryWriter()) {
        if (message.detections !== undefined) {
            ImgDetections.encode(message.detections, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSnapAnnotations();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.detections = ImgDetections.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { detections: isSet(object.detections) ? ImgDetections.fromJSON(object.detections) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.detections !== undefined) {
            obj.detections = ImgDetections.toJSON(message.detections);
        }
        return obj;
    },
    create(base) {
        return SnapAnnotations.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSnapAnnotations();
        message.detections = (object.detections !== undefined && object.detections !== null)
            ? ImgDetections.fromPartial(object.detections)
            : undefined;
        return message;
    },
};
function longToNumber(int64) {
    const num = globalThis.Number(int64.toString());
    if (num > globalThis.Number.MAX_SAFE_INTEGER) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    if (num < globalThis.Number.MIN_SAFE_INTEGER) {
        throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
    }
    return num;
}
function isObject(value) {
    return typeof value === "object" && value !== null;
}
function isSet(value) {
    return value !== null && value !== undefined;
}
export const protobufName = "Event";
//# sourceMappingURL=Event.js.map