/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { Info } from "./info";
import { Item } from "./item";
import { Params } from "./params";
export const protobufPackage = "rarifyprotocol.rarimocore.tokenmanager";
function createBaseGenesisState() {
    return { params: undefined, itemList: [], infoList: [] };
}
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.itemList) {
            Item.encode(v, writer.uint32(18).fork()).ldelim();
        }
        for (const v of message.infoList) {
            Info.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.itemList.push(Item.decode(reader, reader.uint32()));
                    break;
                case 3:
                    message.infoList.push(Info.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,
            itemList: Array.isArray(object?.itemList) ? object.itemList.map((e) => Item.fromJSON(e)) : [],
            infoList: Array.isArray(object?.infoList) ? object.infoList.map((e) => Info.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
        if (message.itemList) {
            obj.itemList = message.itemList.map((e) => e ? Item.toJSON(e) : undefined);
        }
        else {
            obj.itemList = [];
        }
        if (message.infoList) {
            obj.infoList = message.infoList.map((e) => e ? Info.toJSON(e) : undefined);
        }
        else {
            obj.infoList = [];
        }
        return obj;
    },
    fromPartial(object) {
        const message = createBaseGenesisState();
        message.params = (object.params !== undefined && object.params !== null)
            ? Params.fromPartial(object.params)
            : undefined;
        message.itemList = object.itemList?.map((e) => Item.fromPartial(e)) || [];
        message.infoList = object.infoList?.map((e) => Info.fromPartial(e)) || [];
        return message;
    },
};
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=genesis.js.map