"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: io/restorecommerce/status.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.protoMetadata = exports.StatusListResponse = exports.OperationStatus = exports.OperationStatusObj = exports.Status = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
exports.protobufPackage = "io.restorecommerce.status";
function createBaseStatus() {
    return {};
}
exports.Status = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.id !== undefined) {
            writer.uint32(10).string(message.id);
        }
        if (message.code !== undefined) {
            writer.uint32(16).uint32(message.code);
        }
        if (message.message !== undefined) {
            writer.uint32(26).string(message.message);
        }
        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 = createBaseStatus();
        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 !== 16) {
                        break;
                    }
                    message.code = reader.uint32();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.message = 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) : undefined,
            code: isSet(object.code) ? globalThis.Number(object.code) : undefined,
            message: isSet(object.message) ? globalThis.String(object.message) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.code !== undefined) {
            obj.code = Math.round(message.code);
        }
        if (message.message !== undefined) {
            obj.message = message.message;
        }
        return obj;
    },
    create(base) {
        return exports.Status.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseStatus();
        message.id = object.id ?? undefined;
        message.code = object.code ?? undefined;
        message.message = object.message ?? undefined;
        return message;
    },
};
function createBaseOperationStatusObj() {
    return {};
}
exports.OperationStatusObj = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.operationStatus !== undefined) {
            exports.OperationStatus.encode(message.operationStatus, writer.uint32(10).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 = createBaseOperationStatusObj();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.operationStatus = exports.OperationStatus.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            operationStatus: isSet(object.operationStatus)
                ? exports.OperationStatus.fromJSON(object.operationStatus)
                : isSet(object.operation_status)
                    ? exports.OperationStatus.fromJSON(object.operation_status)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.operationStatus !== undefined) {
            obj.operationStatus = exports.OperationStatus.toJSON(message.operationStatus);
        }
        return obj;
    },
    create(base) {
        return exports.OperationStatusObj.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseOperationStatusObj();
        message.operationStatus = (object.operationStatus !== undefined && object.operationStatus !== null)
            ? exports.OperationStatus.fromPartial(object.operationStatus)
            : undefined;
        return message;
    },
};
function createBaseOperationStatus() {
    return {};
}
exports.OperationStatus = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.code !== undefined) {
            writer.uint32(8).uint32(message.code);
        }
        if (message.message !== undefined) {
            writer.uint32(18).string(message.message);
        }
        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 = createBaseOperationStatus();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.code = reader.uint32();
                    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 {
            code: isSet(object.code) ? globalThis.Number(object.code) : undefined,
            message: isSet(object.message) ? globalThis.String(object.message) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.code !== undefined) {
            obj.code = Math.round(message.code);
        }
        if (message.message !== undefined) {
            obj.message = message.message;
        }
        return obj;
    },
    create(base) {
        return exports.OperationStatus.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseOperationStatus();
        message.code = object.code ?? undefined;
        message.message = object.message ?? undefined;
        return message;
    },
};
function createBaseStatusListResponse() {
    return {};
}
exports.StatusListResponse = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.status !== undefined && message.status.length !== 0) {
            for (const v of message.status) {
                exports.Status.encode(v, writer.uint32(10).fork()).join();
            }
        }
        if (message.operationStatus !== undefined) {
            exports.OperationStatus.encode(message.operationStatus, 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 = createBaseStatusListResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    if (message.status === undefined) {
                        message.status = [];
                    }
                    const el = exports.Status.decode(reader, reader.uint32());
                    if (el !== undefined) {
                        message.status.push(el);
                    }
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.operationStatus = exports.OperationStatus.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            status: globalThis.Array.isArray(object?.status) ? object.status.map((e) => exports.Status.fromJSON(e)) : undefined,
            operationStatus: isSet(object.operationStatus)
                ? exports.OperationStatus.fromJSON(object.operationStatus)
                : isSet(object.operation_status)
                    ? exports.OperationStatus.fromJSON(object.operation_status)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.status?.length) {
            obj.status = message.status.map((e) => exports.Status.toJSON(e));
        }
        if (message.operationStatus !== undefined) {
            obj.operationStatus = exports.OperationStatus.toJSON(message.operationStatus);
        }
        return obj;
    },
    create(base) {
        return exports.StatusListResponse.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseStatusListResponse();
        message.status = object.status?.map((e) => exports.Status.fromPartial(e)) || undefined;
        message.operationStatus = (object.operationStatus !== undefined && object.operationStatus !== null)
            ? exports.OperationStatus.fromPartial(object.operationStatus)
            : undefined;
        return message;
    },
};
exports.protoMetadata = {
    fileDescriptor: {
        "name": "io/restorecommerce/status.proto",
        "package": "io.restorecommerce.status",
        "dependency": [],
        "publicDependency": [],
        "weakDependency": [],
        "optionDependency": [],
        "messageType": [{
                "name": "Status",
                "field": [{
                        "name": "id",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "id",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "code",
                        "number": 2,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "code",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "message",
                        "number": 3,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "message",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_id", "options": undefined }, { "name": "_code", "options": undefined }, {
                        "name": "_message",
                        "options": undefined,
                    }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "OperationStatusObj",
                "field": [{
                        "name": "operation_status",
                        "number": 1,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.OperationStatus",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "operationStatus",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_operation_status", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "OperationStatus",
                "field": [{
                        "name": "code",
                        "number": 1,
                        "label": 1,
                        "type": 13,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "code",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "message",
                        "number": 2,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "message",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_code", "options": undefined }, { "name": "_message", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "StatusListResponse",
                "field": [{
                        "name": "status",
                        "number": 1,
                        "label": 3,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.Status",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "status",
                        "options": undefined,
                        "proto3Optional": false,
                    }, {
                        "name": "operation_status",
                        "number": 2,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.status.OperationStatus",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "operationStatus",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_operation_status", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }],
        "enumType": [],
        "service": [],
        "extension": [],
        "options": undefined,
        "sourceCodeInfo": { "location": [] },
        "syntax": "proto3",
        "edition": 0,
    },
    references: {
        ".io.restorecommerce.status.Status": exports.Status,
        ".io.restorecommerce.status.OperationStatusObj": exports.OperationStatusObj,
        ".io.restorecommerce.status.OperationStatus": exports.OperationStatus,
        ".io.restorecommerce.status.StatusListResponse": exports.StatusListResponse,
    },
    dependencies: [],
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=status.js.map