import { Any } from "../../../google/protobuf/any";
import { BaseAccount } from "./auth";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { GlobalDecoderRegistry } from "../../../registry";
function createBaseQueryLegacyAccount() {
    return {};
}
export const QueryLegacyAccount = {
    typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccount",
    aminoType: "cosmos-sdk/QueryLegacyAccount",
    is(o) {
        return o && o.$typeUrl === QueryLegacyAccount.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryLegacyAccount.typeUrl;
    },
    encode(_, writer = BinaryWriter.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryLegacyAccount();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseQueryLegacyAccount();
        return message;
    },
    fromAmino(_) {
        const message = createBaseQueryLegacyAccount();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return QueryLegacyAccount.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryLegacyAccount",
            value: QueryLegacyAccount.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryLegacyAccount.decode(message.value);
    },
    toProto(message) {
        return QueryLegacyAccount.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccount",
            value: QueryLegacyAccount.encode(message).finish()
        };
    }
};
GlobalDecoderRegistry.register(QueryLegacyAccount.typeUrl, QueryLegacyAccount);
GlobalDecoderRegistry.registerAminoProtoMapping(QueryLegacyAccount.aminoType, QueryLegacyAccount.typeUrl);
function createBaseQueryLegacyAccountResponse() {
    return {
        account: undefined,
        base: undefined
    };
}
export const QueryLegacyAccountResponse = {
    typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccountResponse",
    aminoType: "cosmos-sdk/QueryLegacyAccountResponse",
    is(o) {
        return o && o.$typeUrl === QueryLegacyAccountResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryLegacyAccountResponse.typeUrl;
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.account !== undefined) {
            Any.encode(message.account, writer.uint32(10).fork()).ldelim();
        }
        if (message.base !== undefined) {
            BaseAccount.encode(message.base, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryLegacyAccountResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.account = Any.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.base = BaseAccount.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryLegacyAccountResponse();
        message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined;
        message.base = object.base !== undefined && object.base !== null ? BaseAccount.fromPartial(object.base) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryLegacyAccountResponse();
        if (object.account !== undefined && object.account !== null) {
            message.account = Any.fromAmino(object.account);
        }
        if (object.base !== undefined && object.base !== null) {
            message.base = BaseAccount.fromAmino(object.base);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.account = message.account ? Any.toAmino(message.account) : undefined;
        obj.base = message.base ? BaseAccount.toAmino(message.base) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return QueryLegacyAccountResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryLegacyAccountResponse",
            value: QueryLegacyAccountResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryLegacyAccountResponse.decode(message.value);
    },
    toProto(message) {
        return QueryLegacyAccountResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccountResponse",
            value: QueryLegacyAccountResponse.encode(message).finish()
        };
    }
};
GlobalDecoderRegistry.register(QueryLegacyAccountResponse.typeUrl, QueryLegacyAccountResponse);
GlobalDecoderRegistry.registerAminoProtoMapping(QueryLegacyAccountResponse.aminoType, QueryLegacyAccountResponse.typeUrl);
