/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { Confirmation } from "./confirmation";
import { Operation } from "./operation";
import { Params } from "./params";
export const protobufPackage = "rarifyprotocol.rarimocore.rarimocore";
function createBaseGenesisState() {
    return { params: undefined, operationList: [], confirmationList: [] };
}
export const GenesisState = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.params !== undefined) {
            Params.encode(message.params, writer.uint32(10).fork()).ldelim();
        }
        for (const v of message.operationList) {
            Operation.encode(v, writer.uint32(18).fork()).ldelim();
        }
        for (const v of message.confirmationList) {
            Confirmation.encode(v, writer.uint32(26).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseGenesisState();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.params = Params.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.operationList.push(Operation.decode(reader, reader.uint32()));
                    break;
                case 3:
                    message.confirmationList.push(Confirmation.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
            operationList: Array.isArray(object?.operationList)
                ? object.operationList.map((e) => Operation.fromJSON(e))
                : [],
            confirmationList: Array.isArray(object?.confirmationList)
                ? object.confirmationList.map((e) => Confirmation.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
        if (message.operationList) {
            obj.operationList = message.operationList.map((e) => e ? Operation.toJSON(e) : undefined);
        }
        else {
            obj.operationList = [];
        }
        if (message.confirmationList) {
            obj.confirmationList = message.confirmationList.map((e) => e ? Confirmation.toJSON(e) : undefined);
        }
        else {
            obj.confirmationList = [];
        }
        return obj;
    },
    fromPartial(object) {
        const message = createBaseGenesisState();
        message.params = (object.params !== undefined && object.params !== null)
            ? Params.fromPartial(object.params)
            : undefined;
        message.operationList = object.operationList?.map((e) => Operation.fromPartial(e)) || [];
        message.confirmationList = object.confirmationList?.map((e) => Confirmation.fromPartial(e)) || [];
        return message;
    },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=genesis.js.map