"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/price.proto
Object.defineProperty(exports, "__esModule", { value: true });
exports.protoMetadata = exports.Price = exports.protobufPackage = void 0;
/* eslint-disable */
const wire_1 = require("@bufbuild/protobuf/wire");
const currency_1 = require("./currency");
const options_1 = require("./options");
exports.protobufPackage = "io.restorecommerce.price";
function createBasePrice() {
    return {};
}
exports.Price = {
    encode(message, writer = new wire_1.BinaryWriter()) {
        if (message.regular_price !== undefined) {
            writer.uint32(9).double(message.regular_price);
        }
        if (message.sale !== undefined) {
            writer.uint32(16).bool(message.sale);
        }
        if (message.sale_price !== undefined) {
            writer.uint32(25).double(message.sale_price);
        }
        if (message.currency_id !== undefined) {
            writer.uint32(34).string(message.currency_id);
        }
        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 = createBasePrice();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 9) {
                        break;
                    }
                    message.regular_price = reader.double();
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.sale = reader.bool();
                    continue;
                }
                case 3: {
                    if (tag !== 25) {
                        break;
                    }
                    message.sale_price = reader.double();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.currency_id = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            regular_price: isSet(object.regularPrice)
                ? globalThis.Number(object.regularPrice)
                : isSet(object.regular_price)
                    ? globalThis.Number(object.regular_price)
                    : undefined,
            sale: isSet(object.sale) ? globalThis.Boolean(object.sale) : undefined,
            sale_price: isSet(object.salePrice)
                ? globalThis.Number(object.salePrice)
                : isSet(object.sale_price)
                    ? globalThis.Number(object.sale_price)
                    : undefined,
            currency_id: isSet(object.currencyId)
                ? globalThis.String(object.currencyId)
                : isSet(object.currency_id)
                    ? globalThis.String(object.currency_id)
                    : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.regular_price !== undefined) {
            obj.regularPrice = message.regular_price;
        }
        if (message.sale !== undefined) {
            obj.sale = message.sale;
        }
        if (message.sale_price !== undefined) {
            obj.salePrice = message.sale_price;
        }
        if (message.currency_id !== undefined) {
            obj.currencyId = message.currency_id;
        }
        return obj;
    },
    create(base) {
        return exports.Price.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePrice();
        message.regular_price = object.regular_price ?? undefined;
        message.sale = object.sale ?? undefined;
        message.sale_price = object.sale_price ?? undefined;
        message.currency_id = object.currency_id ?? undefined;
        return message;
    },
};
exports.protoMetadata = {
    fileDescriptor: {
        "name": "io/restorecommerce/price.proto",
        "package": "io.restorecommerce.price",
        "dependency": ["io/restorecommerce/options.proto", "io/restorecommerce/currency.proto"],
        "publicDependency": [],
        "weakDependency": [],
        "optionDependency": [],
        "messageType": [{
                "name": "Price",
                "field": [{
                        "name": "regular_price",
                        "number": 1,
                        "label": 1,
                        "type": 1,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 0,
                        "jsonName": "regularPrice",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "sale",
                        "number": 2,
                        "label": 1,
                        "type": 8,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 1,
                        "jsonName": "sale",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "sale_price",
                        "number": 3,
                        "label": 1,
                        "type": 1,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 2,
                        "jsonName": "salePrice",
                        "options": undefined,
                        "proto3Optional": true,
                    }, {
                        "name": "currency_id",
                        "number": 4,
                        "label": 1,
                        "type": 9,
                        "typeName": "",
                        "extendee": "",
                        "defaultValue": "",
                        "oneofIndex": 3,
                        "jsonName": "currencyId",
                        "options": {
                            "ctype": 0,
                            "packed": false,
                            "jstype": 0,
                            "lazy": false,
                            "unverifiedLazy": false,
                            "deprecated": false,
                            "weak": false,
                            "debugRedact": false,
                            "retention": 0,
                            "targets": [],
                            "editionDefaults": [],
                            "features": undefined,
                            "featureSupport": undefined,
                            "uninterpretedOption": [],
                        },
                        "proto3Optional": true,
                    }],
                "extension": [],
                "nestedType": [],
                "enumType": [],
                "extensionRange": [],
                "oneofDecl": [{ "name": "_regular_price", "options": undefined }, { "name": "_sale", "options": undefined }, {
                        "name": "_sale_price",
                        "options": undefined,
                    }, { "name": "_currency_id", "options": undefined }],
                "options": undefined,
                "reservedRange": [],
                "reservedName": [],
                "visibility": 0,
            }],
        "enumType": [],
        "service": [],
        "extension": [],
        "options": undefined,
        "sourceCodeInfo": {
            "location": [{
                    "path": [3, 0],
                    "span": [5, 0, 42],
                    "leadingComments": " Used by resolvers\n",
                    "trailingComments": "",
                    "leadingDetachedComments": [],
                }],
        },
        "syntax": "proto3",
        "edition": 0,
    },
    references: { ".io.restorecommerce.price.Price": exports.Price },
    dependencies: [options_1.protoMetadata, currency_1.protoMetadata],
    options: {
        messages: {
            "Price": {
                fields: {
                    "currency_id": {
                        "resolver": options_1.Resolver.decode(Buffer.from("CiUuaW8ucmVzdG9yZWNvbW1lcmNlLmN1cnJlbmN5LkN1cnJlbmN5EgttYXN0ZXJfZGF0YRoIY3VycmVuY3kiBFJlYWQqCGN1cnJlbmN5", "base64")),
                    },
                },
            },
        },
    },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=price.js.map