"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StoreKeyConfig = exports.Module = void 0;
const binary_1 = require("../../../../binary");
function createBaseModule() {
    return {
        appName: "",
        beginBlockers: [],
        endBlockers: [],
        initGenesis: [],
        exportGenesis: [],
        overrideStoreKeys: [],
        orderMigrations: [],
        precommiters: [],
        prepareCheckStaters: [],
        preBlockers: []
    };
}
exports.Module = {
    typeUrl: "/cosmos.app.runtime.v1alpha1.Module",
    aminoType: "cosmos-sdk/Module",
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.appName !== "") {
            writer.uint32(10).string(message.appName);
        }
        for (const v of message.beginBlockers) {
            writer.uint32(18).string(v);
        }
        for (const v of message.endBlockers) {
            writer.uint32(26).string(v);
        }
        for (const v of message.initGenesis) {
            writer.uint32(34).string(v);
        }
        for (const v of message.exportGenesis) {
            writer.uint32(42).string(v);
        }
        for (const v of message.overrideStoreKeys) {
            exports.StoreKeyConfig.encode(v, writer.uint32(50).fork()).ldelim();
        }
        for (const v of message.orderMigrations) {
            writer.uint32(58).string(v);
        }
        for (const v of message.precommiters) {
            writer.uint32(66).string(v);
        }
        for (const v of message.prepareCheckStaters) {
            writer.uint32(74).string(v);
        }
        for (const v of message.preBlockers) {
            writer.uint32(82).string(v);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseModule();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.appName = reader.string();
                    break;
                case 2:
                    message.beginBlockers.push(reader.string());
                    break;
                case 3:
                    message.endBlockers.push(reader.string());
                    break;
                case 4:
                    message.initGenesis.push(reader.string());
                    break;
                case 5:
                    message.exportGenesis.push(reader.string());
                    break;
                case 6:
                    message.overrideStoreKeys.push(exports.StoreKeyConfig.decode(reader, reader.uint32()));
                    break;
                case 7:
                    message.orderMigrations.push(reader.string());
                    break;
                case 8:
                    message.precommiters.push(reader.string());
                    break;
                case 9:
                    message.prepareCheckStaters.push(reader.string());
                    break;
                case 10:
                    message.preBlockers.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseModule();
        message.appName = object.appName ?? "";
        message.beginBlockers = object.beginBlockers?.map(e => e) || [];
        message.endBlockers = object.endBlockers?.map(e => e) || [];
        message.initGenesis = object.initGenesis?.map(e => e) || [];
        message.exportGenesis = object.exportGenesis?.map(e => e) || [];
        message.overrideStoreKeys = object.overrideStoreKeys?.map(e => exports.StoreKeyConfig.fromPartial(e)) || [];
        message.orderMigrations = object.orderMigrations?.map(e => e) || [];
        message.precommiters = object.precommiters?.map(e => e) || [];
        message.prepareCheckStaters = object.prepareCheckStaters?.map(e => e) || [];
        message.preBlockers = object.preBlockers?.map(e => e) || [];
        return message;
    },
    fromAmino(object) {
        return {
            appName: object.app_name,
            beginBlockers: Array.isArray(object?.begin_blockers) ? object.begin_blockers.map((e) => e) : [],
            endBlockers: Array.isArray(object?.end_blockers) ? object.end_blockers.map((e) => e) : [],
            initGenesis: Array.isArray(object?.init_genesis) ? object.init_genesis.map((e) => e) : [],
            exportGenesis: Array.isArray(object?.export_genesis) ? object.export_genesis.map((e) => e) : [],
            overrideStoreKeys: Array.isArray(object?.override_store_keys) ? object.override_store_keys.map((e) => exports.StoreKeyConfig.fromAmino(e)) : [],
            orderMigrations: Array.isArray(object?.order_migrations) ? object.order_migrations.map((e) => e) : [],
            precommiters: Array.isArray(object?.precommiters) ? object.precommiters.map((e) => e) : [],
            prepareCheckStaters: Array.isArray(object?.prepare_check_staters) ? object.prepare_check_staters.map((e) => e) : [],
            preBlockers: Array.isArray(object?.pre_blockers) ? object.pre_blockers.map((e) => e) : []
        };
    },
    toAmino(message) {
        const obj = {};
        obj.app_name = message.appName;
        if (message.beginBlockers) {
            obj.begin_blockers = message.beginBlockers.map(e => e);
        }
        else {
            obj.begin_blockers = [];
        }
        if (message.endBlockers) {
            obj.end_blockers = message.endBlockers.map(e => e);
        }
        else {
            obj.end_blockers = [];
        }
        if (message.initGenesis) {
            obj.init_genesis = message.initGenesis.map(e => e);
        }
        else {
            obj.init_genesis = [];
        }
        if (message.exportGenesis) {
            obj.export_genesis = message.exportGenesis.map(e => e);
        }
        else {
            obj.export_genesis = [];
        }
        if (message.overrideStoreKeys) {
            obj.override_store_keys = message.overrideStoreKeys.map(e => e ? exports.StoreKeyConfig.toAmino(e) : undefined);
        }
        else {
            obj.override_store_keys = [];
        }
        if (message.orderMigrations) {
            obj.order_migrations = message.orderMigrations.map(e => e);
        }
        else {
            obj.order_migrations = [];
        }
        if (message.precommiters) {
            obj.precommiters = message.precommiters.map(e => e);
        }
        else {
            obj.precommiters = [];
        }
        if (message.prepareCheckStaters) {
            obj.prepare_check_staters = message.prepareCheckStaters.map(e => e);
        }
        else {
            obj.prepare_check_staters = [];
        }
        if (message.preBlockers) {
            obj.pre_blockers = message.preBlockers.map(e => e);
        }
        else {
            obj.pre_blockers = [];
        }
        return obj;
    },
    fromAminoMsg(object) {
        return exports.Module.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/Module",
            value: exports.Module.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.Module.decode(message.value);
    },
    toProto(message) {
        return exports.Module.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.app.runtime.v1alpha1.Module",
            value: exports.Module.encode(message).finish()
        };
    }
};
function createBaseStoreKeyConfig() {
    return {
        moduleName: "",
        kvStoreKey: ""
    };
}
exports.StoreKeyConfig = {
    typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig",
    aminoType: "cosmos-sdk/StoreKeyConfig",
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.moduleName !== "") {
            writer.uint32(10).string(message.moduleName);
        }
        if (message.kvStoreKey !== "") {
            writer.uint32(18).string(message.kvStoreKey);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseStoreKeyConfig();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.moduleName = reader.string();
                    break;
                case 2:
                    message.kvStoreKey = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseStoreKeyConfig();
        message.moduleName = object.moduleName ?? "";
        message.kvStoreKey = object.kvStoreKey ?? "";
        return message;
    },
    fromAmino(object) {
        return {
            moduleName: object.module_name,
            kvStoreKey: object.kv_store_key
        };
    },
    toAmino(message) {
        const obj = {};
        obj.module_name = message.moduleName;
        obj.kv_store_key = message.kvStoreKey;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.StoreKeyConfig.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/StoreKeyConfig",
            value: exports.StoreKeyConfig.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.StoreKeyConfig.decode(message.value);
    },
    toProto(message) {
        return exports.StoreKeyConfig.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.app.runtime.v1alpha1.StoreKeyConfig",
            value: exports.StoreKeyConfig.encode(message).finish()
        };
    }
};
//# sourceMappingURL=module.js.map