"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PositionalArgDescriptor = exports.FlagOptions = exports.RpcCommandOptions = exports.RpcCommandOptions_FlagOptionsEntry = exports.ServiceCommandDescriptor = exports.ServiceCommandDescriptor_SubCommandsEntry = exports.ModuleOptions = void 0;
const binary_1 = require("../../../binary");
const registry_1 = require("../../../registry");
const helpers_1 = require("../../../helpers");
function createBaseModuleOptions() {
    return {
        tx: undefined,
        query: undefined
    };
}
/**
 * ModuleOptions describes the CLI options for a Cosmos SDK module.
 * @name ModuleOptions
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.ModuleOptions
 */
exports.ModuleOptions = {
    typeUrl: "/cosmos.autocli.v1.ModuleOptions",
    aminoType: "cosmos-sdk/ModuleOptions",
    is(o) {
        return o && o.$typeUrl === exports.ModuleOptions.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.ModuleOptions.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.tx !== undefined) {
            exports.ServiceCommandDescriptor.encode(message.tx, writer.uint32(10).fork()).ldelim();
        }
        if (message.query !== undefined) {
            exports.ServiceCommandDescriptor.encode(message.query, writer.uint32(18).fork()).ldelim();
        }
        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 = createBaseModuleOptions();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.tx = exports.ServiceCommandDescriptor.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.query = exports.ServiceCommandDescriptor.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseModuleOptions();
        message.tx = object.tx !== undefined && object.tx !== null ? exports.ServiceCommandDescriptor.fromPartial(object.tx) : undefined;
        message.query = object.query !== undefined && object.query !== null ? exports.ServiceCommandDescriptor.fromPartial(object.query) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseModuleOptions();
        if (object.tx !== undefined && object.tx !== null) {
            message.tx = exports.ServiceCommandDescriptor.fromAmino(object.tx);
        }
        if (object.query !== undefined && object.query !== null) {
            message.query = exports.ServiceCommandDescriptor.fromAmino(object.query);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.tx = message.tx ? exports.ServiceCommandDescriptor.toAmino(message.tx) : undefined;
        obj.query = message.query ? exports.ServiceCommandDescriptor.toAmino(message.query) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.ModuleOptions.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/ModuleOptions",
            value: exports.ModuleOptions.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.ModuleOptions.decode(message.value);
    },
    toProto(message) {
        return exports.ModuleOptions.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.autocli.v1.ModuleOptions",
            value: exports.ModuleOptions.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.ModuleOptions.typeUrl)) {
            return;
        }
        exports.ServiceCommandDescriptor.registerTypeUrl();
    }
};
function createBaseServiceCommandDescriptor_SubCommandsEntry() {
    return {
        key: "",
        value: undefined
    };
}
/**
 * @name ServiceCommandDescriptor_SubCommandsEntry
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.undefined
 */
exports.ServiceCommandDescriptor_SubCommandsEntry = {
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.key !== "") {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== undefined) {
            exports.ServiceCommandDescriptor.encode(message.value, writer.uint32(18).fork()).ldelim();
        }
        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 = createBaseServiceCommandDescriptor_SubCommandsEntry();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = exports.ServiceCommandDescriptor.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseServiceCommandDescriptor_SubCommandsEntry();
        message.key = object.key ?? "";
        message.value = object.value !== undefined && object.value !== null ? exports.ServiceCommandDescriptor.fromPartial(object.value) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseServiceCommandDescriptor_SubCommandsEntry();
        if (object.key !== undefined && object.key !== null) {
            message.key = object.key;
        }
        if (object.value !== undefined && object.value !== null) {
            message.value = exports.ServiceCommandDescriptor.fromAmino(object.value);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.key = message.key === "" ? undefined : message.key;
        obj.value = message.value ? exports.ServiceCommandDescriptor.toAmino(message.value) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.ServiceCommandDescriptor_SubCommandsEntry.fromAmino(object.value);
    },
    fromProtoMsg(message) {
        return exports.ServiceCommandDescriptor_SubCommandsEntry.decode(message.value);
    },
    toProto(message) {
        return exports.ServiceCommandDescriptor_SubCommandsEntry.encode(message).finish();
    },
    registerTypeUrl() {
        exports.ServiceCommandDescriptor.registerTypeUrl();
    }
};
function createBaseServiceCommandDescriptor() {
    return {
        service: "",
        rpcCommandOptions: [],
        subCommands: {},
        enhanceCustomCommand: false,
        short: ""
    };
}
/**
 * ServiceCommandDescriptor describes a CLI command based on a protobuf service.
 * @name ServiceCommandDescriptor
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.ServiceCommandDescriptor
 */
exports.ServiceCommandDescriptor = {
    typeUrl: "/cosmos.autocli.v1.ServiceCommandDescriptor",
    aminoType: "cosmos-sdk/ServiceCommandDescriptor",
    is(o) {
        return o && (o.$typeUrl === exports.ServiceCommandDescriptor.typeUrl || typeof o.service === "string" && Array.isArray(o.rpcCommandOptions) && (!o.rpcCommandOptions.length || exports.RpcCommandOptions.is(o.rpcCommandOptions[0])) && (0, helpers_1.isSet)(o.subCommands) && typeof o.enhanceCustomCommand === "boolean" && typeof o.short === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.ServiceCommandDescriptor.typeUrl || typeof o.service === "string" && Array.isArray(o.rpc_command_options) && (!o.rpc_command_options.length || exports.RpcCommandOptions.isAmino(o.rpc_command_options[0])) && (0, helpers_1.isSet)(o.sub_commands) && typeof o.enhance_custom_command === "boolean" && typeof o.short === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.service !== "") {
            writer.uint32(10).string(message.service);
        }
        for (const v of message.rpcCommandOptions) {
            exports.RpcCommandOptions.encode(v, writer.uint32(18).fork()).ldelim();
        }
        Object.entries(message.subCommands).forEach(([key, value]) => {
            exports.ServiceCommandDescriptor_SubCommandsEntry.encode({
                key: key,
                value
            }, writer.uint32(26).fork()).ldelim();
        });
        if (message.enhanceCustomCommand === true) {
            writer.uint32(32).bool(message.enhanceCustomCommand);
        }
        if (message.short !== "") {
            writer.uint32(42).string(message.short);
        }
        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 = createBaseServiceCommandDescriptor();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.service = reader.string();
                    break;
                case 2:
                    message.rpcCommandOptions.push(exports.RpcCommandOptions.decode(reader, reader.uint32()));
                    break;
                case 3:
                    const entry3 = exports.ServiceCommandDescriptor_SubCommandsEntry.decode(reader, reader.uint32());
                    if (entry3.value !== undefined) {
                        message.subCommands[entry3.key] = entry3.value;
                    }
                    break;
                case 4:
                    message.enhanceCustomCommand = reader.bool();
                    break;
                case 5:
                    message.short = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseServiceCommandDescriptor();
        message.service = object.service ?? "";
        message.rpcCommandOptions = object.rpcCommandOptions?.map(e => exports.RpcCommandOptions.fromPartial(e)) || [];
        message.subCommands = Object.entries(object.subCommands ?? {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = exports.ServiceCommandDescriptor.fromPartial(value);
            }
            return acc;
        }, {});
        message.enhanceCustomCommand = object.enhanceCustomCommand ?? false;
        message.short = object.short ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseServiceCommandDescriptor();
        if (object.service !== undefined && object.service !== null) {
            message.service = object.service;
        }
        message.rpcCommandOptions = object.rpc_command_options?.map(e => exports.RpcCommandOptions.fromAmino(e)) || [];
        message.subCommands = Object.entries(object.sub_commands ?? {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = exports.ServiceCommandDescriptor.fromAmino(value);
            }
            return acc;
        }, {});
        if (object.enhance_custom_command !== undefined && object.enhance_custom_command !== null) {
            message.enhanceCustomCommand = object.enhance_custom_command;
        }
        if (object.short !== undefined && object.short !== null) {
            message.short = object.short;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.service = message.service === "" ? undefined : message.service;
        if (message.rpcCommandOptions) {
            obj.rpc_command_options = message.rpcCommandOptions.map(e => e ? exports.RpcCommandOptions.toAmino(e) : undefined);
        }
        else {
            obj.rpc_command_options = message.rpcCommandOptions;
        }
        obj.sub_commands = {};
        if (message.subCommands) {
            Object.entries(message.subCommands).forEach(([k, v]) => {
                obj.sub_commands[k] = exports.ServiceCommandDescriptor.toAmino(v);
            });
        }
        obj.enhance_custom_command = message.enhanceCustomCommand === false ? undefined : message.enhanceCustomCommand;
        obj.short = message.short === "" ? undefined : message.short;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.ServiceCommandDescriptor.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/ServiceCommandDescriptor",
            value: exports.ServiceCommandDescriptor.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.ServiceCommandDescriptor.decode(message.value);
    },
    toProto(message) {
        return exports.ServiceCommandDescriptor.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.autocli.v1.ServiceCommandDescriptor",
            value: exports.ServiceCommandDescriptor.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.ServiceCommandDescriptor.typeUrl)) {
            return;
        }
        exports.RpcCommandOptions.registerTypeUrl();
        exports.ServiceCommandDescriptor.registerTypeUrl();
    }
};
function createBaseRpcCommandOptions_FlagOptionsEntry() {
    return {
        key: "",
        value: undefined
    };
}
/**
 * @name RpcCommandOptions_FlagOptionsEntry
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.undefined
 */
exports.RpcCommandOptions_FlagOptionsEntry = {
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.key !== "") {
            writer.uint32(10).string(message.key);
        }
        if (message.value !== undefined) {
            exports.FlagOptions.encode(message.value, writer.uint32(18).fork()).ldelim();
        }
        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 = createBaseRpcCommandOptions_FlagOptionsEntry();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.key = reader.string();
                    break;
                case 2:
                    message.value = exports.FlagOptions.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseRpcCommandOptions_FlagOptionsEntry();
        message.key = object.key ?? "";
        message.value = object.value !== undefined && object.value !== null ? exports.FlagOptions.fromPartial(object.value) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseRpcCommandOptions_FlagOptionsEntry();
        if (object.key !== undefined && object.key !== null) {
            message.key = object.key;
        }
        if (object.value !== undefined && object.value !== null) {
            message.value = exports.FlagOptions.fromAmino(object.value);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.key = message.key === "" ? undefined : message.key;
        obj.value = message.value ? exports.FlagOptions.toAmino(message.value) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.RpcCommandOptions_FlagOptionsEntry.fromAmino(object.value);
    },
    fromProtoMsg(message) {
        return exports.RpcCommandOptions_FlagOptionsEntry.decode(message.value);
    },
    toProto(message) {
        return exports.RpcCommandOptions_FlagOptionsEntry.encode(message).finish();
    },
    registerTypeUrl() {
        exports.FlagOptions.registerTypeUrl();
    }
};
function createBaseRpcCommandOptions() {
    return {
        rpcMethod: "",
        use: "",
        long: "",
        short: "",
        example: "",
        alias: [],
        suggestFor: [],
        deprecated: "",
        version: "",
        flagOptions: {},
        positionalArgs: [],
        skip: false,
        govProposal: false
    };
}
/**
 * RpcCommandOptions specifies options for commands generated from protobuf
 * rpc methods.
 * @name RpcCommandOptions
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.RpcCommandOptions
 */
exports.RpcCommandOptions = {
    typeUrl: "/cosmos.autocli.v1.RpcCommandOptions",
    aminoType: "cosmos-sdk/RpcCommandOptions",
    is(o) {
        return o && (o.$typeUrl === exports.RpcCommandOptions.typeUrl || typeof o.rpcMethod === "string" && typeof o.use === "string" && typeof o.long === "string" && typeof o.short === "string" && typeof o.example === "string" && Array.isArray(o.alias) && (!o.alias.length || typeof o.alias[0] === "string") && Array.isArray(o.suggestFor) && (!o.suggestFor.length || typeof o.suggestFor[0] === "string") && typeof o.deprecated === "string" && typeof o.version === "string" && (0, helpers_1.isSet)(o.flagOptions) && Array.isArray(o.positionalArgs) && (!o.positionalArgs.length || exports.PositionalArgDescriptor.is(o.positionalArgs[0])) && typeof o.skip === "boolean" && typeof o.govProposal === "boolean");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.RpcCommandOptions.typeUrl || typeof o.rpc_method === "string" && typeof o.use === "string" && typeof o.long === "string" && typeof o.short === "string" && typeof o.example === "string" && Array.isArray(o.alias) && (!o.alias.length || typeof o.alias[0] === "string") && Array.isArray(o.suggest_for) && (!o.suggest_for.length || typeof o.suggest_for[0] === "string") && typeof o.deprecated === "string" && typeof o.version === "string" && (0, helpers_1.isSet)(o.flag_options) && Array.isArray(o.positional_args) && (!o.positional_args.length || exports.PositionalArgDescriptor.isAmino(o.positional_args[0])) && typeof o.skip === "boolean" && typeof o.gov_proposal === "boolean");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.rpcMethod !== "") {
            writer.uint32(10).string(message.rpcMethod);
        }
        if (message.use !== "") {
            writer.uint32(18).string(message.use);
        }
        if (message.long !== "") {
            writer.uint32(26).string(message.long);
        }
        if (message.short !== "") {
            writer.uint32(34).string(message.short);
        }
        if (message.example !== "") {
            writer.uint32(42).string(message.example);
        }
        for (const v of message.alias) {
            writer.uint32(50).string(v);
        }
        for (const v of message.suggestFor) {
            writer.uint32(58).string(v);
        }
        if (message.deprecated !== "") {
            writer.uint32(66).string(message.deprecated);
        }
        if (message.version !== "") {
            writer.uint32(74).string(message.version);
        }
        Object.entries(message.flagOptions).forEach(([key, value]) => {
            exports.RpcCommandOptions_FlagOptionsEntry.encode({
                key: key,
                value
            }, writer.uint32(82).fork()).ldelim();
        });
        for (const v of message.positionalArgs) {
            exports.PositionalArgDescriptor.encode(v, writer.uint32(90).fork()).ldelim();
        }
        if (message.skip === true) {
            writer.uint32(96).bool(message.skip);
        }
        if (message.govProposal === true) {
            writer.uint32(104).bool(message.govProposal);
        }
        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 = createBaseRpcCommandOptions();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.rpcMethod = reader.string();
                    break;
                case 2:
                    message.use = reader.string();
                    break;
                case 3:
                    message.long = reader.string();
                    break;
                case 4:
                    message.short = reader.string();
                    break;
                case 5:
                    message.example = reader.string();
                    break;
                case 6:
                    message.alias.push(reader.string());
                    break;
                case 7:
                    message.suggestFor.push(reader.string());
                    break;
                case 8:
                    message.deprecated = reader.string();
                    break;
                case 9:
                    message.version = reader.string();
                    break;
                case 10:
                    const entry10 = exports.RpcCommandOptions_FlagOptionsEntry.decode(reader, reader.uint32());
                    if (entry10.value !== undefined) {
                        message.flagOptions[entry10.key] = entry10.value;
                    }
                    break;
                case 11:
                    message.positionalArgs.push(exports.PositionalArgDescriptor.decode(reader, reader.uint32()));
                    break;
                case 12:
                    message.skip = reader.bool();
                    break;
                case 13:
                    message.govProposal = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseRpcCommandOptions();
        message.rpcMethod = object.rpcMethod ?? "";
        message.use = object.use ?? "";
        message.long = object.long ?? "";
        message.short = object.short ?? "";
        message.example = object.example ?? "";
        message.alias = object.alias?.map(e => e) || [];
        message.suggestFor = object.suggestFor?.map(e => e) || [];
        message.deprecated = object.deprecated ?? "";
        message.version = object.version ?? "";
        message.flagOptions = Object.entries(object.flagOptions ?? {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = exports.FlagOptions.fromPartial(value);
            }
            return acc;
        }, {});
        message.positionalArgs = object.positionalArgs?.map(e => exports.PositionalArgDescriptor.fromPartial(e)) || [];
        message.skip = object.skip ?? false;
        message.govProposal = object.govProposal ?? false;
        return message;
    },
    fromAmino(object) {
        const message = createBaseRpcCommandOptions();
        if (object.rpc_method !== undefined && object.rpc_method !== null) {
            message.rpcMethod = object.rpc_method;
        }
        if (object.use !== undefined && object.use !== null) {
            message.use = object.use;
        }
        if (object.long !== undefined && object.long !== null) {
            message.long = object.long;
        }
        if (object.short !== undefined && object.short !== null) {
            message.short = object.short;
        }
        if (object.example !== undefined && object.example !== null) {
            message.example = object.example;
        }
        message.alias = object.alias?.map(e => e) || [];
        message.suggestFor = object.suggest_for?.map(e => e) || [];
        if (object.deprecated !== undefined && object.deprecated !== null) {
            message.deprecated = object.deprecated;
        }
        if (object.version !== undefined && object.version !== null) {
            message.version = object.version;
        }
        message.flagOptions = Object.entries(object.flag_options ?? {}).reduce((acc, [key, value]) => {
            if (value !== undefined) {
                acc[key] = exports.FlagOptions.fromAmino(value);
            }
            return acc;
        }, {});
        message.positionalArgs = object.positional_args?.map(e => exports.PositionalArgDescriptor.fromAmino(e)) || [];
        if (object.skip !== undefined && object.skip !== null) {
            message.skip = object.skip;
        }
        if (object.gov_proposal !== undefined && object.gov_proposal !== null) {
            message.govProposal = object.gov_proposal;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.rpc_method = message.rpcMethod === "" ? undefined : message.rpcMethod;
        obj.use = message.use === "" ? undefined : message.use;
        obj.long = message.long === "" ? undefined : message.long;
        obj.short = message.short === "" ? undefined : message.short;
        obj.example = message.example === "" ? undefined : message.example;
        if (message.alias) {
            obj.alias = message.alias.map(e => e);
        }
        else {
            obj.alias = message.alias;
        }
        if (message.suggestFor) {
            obj.suggest_for = message.suggestFor.map(e => e);
        }
        else {
            obj.suggest_for = message.suggestFor;
        }
        obj.deprecated = message.deprecated === "" ? undefined : message.deprecated;
        obj.version = message.version === "" ? undefined : message.version;
        obj.flag_options = {};
        if (message.flagOptions) {
            Object.entries(message.flagOptions).forEach(([k, v]) => {
                obj.flag_options[k] = exports.FlagOptions.toAmino(v);
            });
        }
        if (message.positionalArgs) {
            obj.positional_args = message.positionalArgs.map(e => e ? exports.PositionalArgDescriptor.toAmino(e) : undefined);
        }
        else {
            obj.positional_args = message.positionalArgs;
        }
        obj.skip = message.skip === false ? undefined : message.skip;
        obj.gov_proposal = message.govProposal === false ? undefined : message.govProposal;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.RpcCommandOptions.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/RpcCommandOptions",
            value: exports.RpcCommandOptions.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.RpcCommandOptions.decode(message.value);
    },
    toProto(message) {
        return exports.RpcCommandOptions.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.autocli.v1.RpcCommandOptions",
            value: exports.RpcCommandOptions.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.RpcCommandOptions.typeUrl)) {
            return;
        }
        exports.FlagOptions.registerTypeUrl();
        exports.PositionalArgDescriptor.registerTypeUrl();
    }
};
function createBaseFlagOptions() {
    return {
        name: "",
        shorthand: "",
        usage: "",
        defaultValue: "",
        deprecated: "",
        shorthandDeprecated: "",
        hidden: false
    };
}
/**
 * FlagOptions are options for flags generated from rpc request fields.
 * By default, all request fields are configured as flags based on the
 * kebab-case name of the field. Fields can be turned into positional arguments
 * instead by using RpcCommandOptions.positional_args.
 * @name FlagOptions
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.FlagOptions
 */
exports.FlagOptions = {
    typeUrl: "/cosmos.autocli.v1.FlagOptions",
    aminoType: "cosmos-sdk/FlagOptions",
    is(o) {
        return o && (o.$typeUrl === exports.FlagOptions.typeUrl || typeof o.name === "string" && typeof o.shorthand === "string" && typeof o.usage === "string" && typeof o.defaultValue === "string" && typeof o.deprecated === "string" && typeof o.shorthandDeprecated === "string" && typeof o.hidden === "boolean");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.FlagOptions.typeUrl || typeof o.name === "string" && typeof o.shorthand === "string" && typeof o.usage === "string" && typeof o.default_value === "string" && typeof o.deprecated === "string" && typeof o.shorthand_deprecated === "string" && typeof o.hidden === "boolean");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.name !== "") {
            writer.uint32(10).string(message.name);
        }
        if (message.shorthand !== "") {
            writer.uint32(18).string(message.shorthand);
        }
        if (message.usage !== "") {
            writer.uint32(26).string(message.usage);
        }
        if (message.defaultValue !== "") {
            writer.uint32(34).string(message.defaultValue);
        }
        if (message.deprecated !== "") {
            writer.uint32(50).string(message.deprecated);
        }
        if (message.shorthandDeprecated !== "") {
            writer.uint32(58).string(message.shorthandDeprecated);
        }
        if (message.hidden === true) {
            writer.uint32(64).bool(message.hidden);
        }
        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 = createBaseFlagOptions();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.name = reader.string();
                    break;
                case 2:
                    message.shorthand = reader.string();
                    break;
                case 3:
                    message.usage = reader.string();
                    break;
                case 4:
                    message.defaultValue = reader.string();
                    break;
                case 6:
                    message.deprecated = reader.string();
                    break;
                case 7:
                    message.shorthandDeprecated = reader.string();
                    break;
                case 8:
                    message.hidden = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseFlagOptions();
        message.name = object.name ?? "";
        message.shorthand = object.shorthand ?? "";
        message.usage = object.usage ?? "";
        message.defaultValue = object.defaultValue ?? "";
        message.deprecated = object.deprecated ?? "";
        message.shorthandDeprecated = object.shorthandDeprecated ?? "";
        message.hidden = object.hidden ?? false;
        return message;
    },
    fromAmino(object) {
        const message = createBaseFlagOptions();
        if (object.name !== undefined && object.name !== null) {
            message.name = object.name;
        }
        if (object.shorthand !== undefined && object.shorthand !== null) {
            message.shorthand = object.shorthand;
        }
        if (object.usage !== undefined && object.usage !== null) {
            message.usage = object.usage;
        }
        if (object.default_value !== undefined && object.default_value !== null) {
            message.defaultValue = object.default_value;
        }
        if (object.deprecated !== undefined && object.deprecated !== null) {
            message.deprecated = object.deprecated;
        }
        if (object.shorthand_deprecated !== undefined && object.shorthand_deprecated !== null) {
            message.shorthandDeprecated = object.shorthand_deprecated;
        }
        if (object.hidden !== undefined && object.hidden !== null) {
            message.hidden = object.hidden;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.name = message.name === "" ? undefined : message.name;
        obj.shorthand = message.shorthand === "" ? undefined : message.shorthand;
        obj.usage = message.usage === "" ? undefined : message.usage;
        obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue;
        obj.deprecated = message.deprecated === "" ? undefined : message.deprecated;
        obj.shorthand_deprecated = message.shorthandDeprecated === "" ? undefined : message.shorthandDeprecated;
        obj.hidden = message.hidden === false ? undefined : message.hidden;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.FlagOptions.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/FlagOptions",
            value: exports.FlagOptions.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.FlagOptions.decode(message.value);
    },
    toProto(message) {
        return exports.FlagOptions.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.autocli.v1.FlagOptions",
            value: exports.FlagOptions.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBasePositionalArgDescriptor() {
    return {
        protoField: "",
        varargs: false,
        optional: false
    };
}
/**
 * PositionalArgDescriptor describes a positional argument.
 * @name PositionalArgDescriptor
 * @package cosmos.autocli.v1
 * @see proto type: cosmos.autocli.v1.PositionalArgDescriptor
 */
exports.PositionalArgDescriptor = {
    typeUrl: "/cosmos.autocli.v1.PositionalArgDescriptor",
    aminoType: "cosmos-sdk/PositionalArgDescriptor",
    is(o) {
        return o && (o.$typeUrl === exports.PositionalArgDescriptor.typeUrl || typeof o.protoField === "string" && typeof o.varargs === "boolean" && typeof o.optional === "boolean");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.PositionalArgDescriptor.typeUrl || typeof o.proto_field === "string" && typeof o.varargs === "boolean" && typeof o.optional === "boolean");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.protoField !== "") {
            writer.uint32(10).string(message.protoField);
        }
        if (message.varargs === true) {
            writer.uint32(16).bool(message.varargs);
        }
        if (message.optional === true) {
            writer.uint32(24).bool(message.optional);
        }
        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 = createBasePositionalArgDescriptor();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.protoField = reader.string();
                    break;
                case 2:
                    message.varargs = reader.bool();
                    break;
                case 3:
                    message.optional = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBasePositionalArgDescriptor();
        message.protoField = object.protoField ?? "";
        message.varargs = object.varargs ?? false;
        message.optional = object.optional ?? false;
        return message;
    },
    fromAmino(object) {
        const message = createBasePositionalArgDescriptor();
        if (object.proto_field !== undefined && object.proto_field !== null) {
            message.protoField = object.proto_field;
        }
        if (object.varargs !== undefined && object.varargs !== null) {
            message.varargs = object.varargs;
        }
        if (object.optional !== undefined && object.optional !== null) {
            message.optional = object.optional;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.proto_field = message.protoField === "" ? undefined : message.protoField;
        obj.varargs = message.varargs === false ? undefined : message.varargs;
        obj.optional = message.optional === false ? undefined : message.optional;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.PositionalArgDescriptor.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/PositionalArgDescriptor",
            value: exports.PositionalArgDescriptor.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.PositionalArgDescriptor.decode(message.value);
    },
    toProto(message) {
        return exports.PositionalArgDescriptor.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.autocli.v1.PositionalArgDescriptor",
            value: exports.PositionalArgDescriptor.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
