/* eslint-disable */
import { asset } from "./asset.js";
export const protobufPackage = "hive.protocol.buffers";
function createBaseproposal_pay() {
    return { proposal_id: 0, receiver: "", payer: "", payment: undefined };
}
export const proposal_pay = {
    fromJSON(object) {
        return {
            proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0,
            receiver: isSet(object.receiver) ? globalThis.String(object.receiver) : "",
            payer: isSet(object.payer) ? globalThis.String(object.payer) : "",
            payment: isSet(object.payment) ? asset.fromJSON(object.payment) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.proposal_id !== undefined) {
            obj.proposal_id = Math.round(message.proposal_id);
        }
        if (message.receiver !== undefined) {
            obj.receiver = message.receiver;
        }
        if (message.payer !== undefined) {
            obj.payer = message.payer;
        }
        if (message.payment !== undefined) {
            obj.payment = asset.toJSON(message.payment);
        }
        return obj;
    },
    create(base) {
        return proposal_pay.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseproposal_pay();
        message.proposal_id = object.proposal_id ?? 0;
        message.receiver = object.receiver ?? "";
        message.payer = object.payer ?? "";
        message.payment = (object.payment !== undefined && object.payment !== null)
            ? asset.fromPartial(object.payment)
            : undefined;
        return message;
    },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
