"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/property.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.protoMetadata = exports.PropertyObj = exports.Property = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
exports.protobufPackage = "io.restorecommerce.property";
function createBaseProperty() {
    return {};
}
exports.Property = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.id !== undefined) {
            writer.uint32(10).string(message.id);
        }
        if (message.value !== undefined) {
            writer.uint32(18).string(message.value);
        }
        if (message.unit_code !== undefined) {
            writer.uint32(26).string(message.unit_code);
        }
        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 = createBaseProperty();
        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.value = reader.string();
                    continue;
                }
                case 3: {
                    if (tag !== 26) {
                        break;
                    }
                    message.unit_code = 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,
            value: isSet(object.value) ? globalThis.String(object.value) : undefined,
            unit_code: isSet(object.unitCode)
                ? globalThis.String(object.unitCode)
                : isSet(object.unit_code)
                    ? globalThis.String(object.unit_code)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.id !== undefined) {
            obj.id = message.id;
        }
        if (message.value !== undefined) {
            obj.value = message.value;
        }
        if (message.unit_code !== undefined) {
            obj.unitCode = message.unit_code;
        }
        return obj;
    },
    create(base) {
        return exports.Property.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseProperty();
        message.id = object.id ?? undefined;
        message.value = object.value ?? undefined;
        message.unit_code = object.unit_code ?? undefined;
        return message;
    },
};
function createBasePropertyObj() {
    return {};
}
exports.PropertyObj = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.properties !== undefined) {
            exports.Property.encode(message.properties, 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 = createBasePropertyObj();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.properties = exports.Property.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return { properties: isSet(object.properties) ? exports.Property.fromJSON(object.properties) : undefined };
    },
    toJSON(message) {
        const obj = {};
        if (message.properties !== undefined) {
            obj.properties = exports.Property.toJSON(message.properties);
        }
        return obj;
    },
    create(base) {
        return exports.PropertyObj.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePropertyObj();
        message.properties = (object.properties !== undefined && object.properties !== null)
            ? exports.Property.fromPartial(object.properties)
            : undefined;
        return message;
    },
};
exports.protoMetadata = {
    fileDescriptor: {
        "name": "io/restorecommerce/property.proto",
        "package": "io.restorecommerce.property",
        "dependency": [],
        "publicDependency": [],
        "weakDependency": [],
        "optionDependency": [],
        "messageType": [{
                "name": "Property",
                "field": [{
                        "name": "id",
                        "number": 1,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "id",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "value",
                        "number": 2,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "value",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "unit_code",
                        "number": 3,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "unitCode",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_id", "options": undefined }, { "name": "_value", "options": undefined }, {
                        "name": "_unit_code",
                        "options": undefined,
                    }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }, {
                "name": "PropertyObj",
                "field": [{
                        "name": "properties",
                        "number": 1,
                        "label": 1,
                        "type": 11,
                        "typeName": ".io.restorecommerce.property.Property",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "properties",
                        "options": undefined,
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_properties", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }],
        "enumType": [],
        "service": [],
        "extension": [],
        "options": undefined,
        "sourceCodeInfo": { "location": [] },
        "syntax": "proto3",
        "edition": 0,
    },
    references: {
        ".io.restorecommerce.property.Property": exports.Property,
        ".io.restorecommerce.property.PropertyObj": exports.PropertyObj,
    },
    dependencies: [],
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=property.js.map