//@ts-nocheck
import { BinaryReader, BinaryWriter } from '../../../../binary.js';
import { isSet } from '../../../../helpers.js';
import {} from '../../../../json-safe.js';
function createBaseModule() {
    return {
        maxMetadataLen: BigInt(0),
        authority: '',
    };
}
export const Module = {
    typeUrl: '/cosmos.gov.module.v1.Module',
    encode(message, writer = BinaryWriter.create()) {
        if (message.maxMetadataLen !== BigInt(0)) {
            writer.uint32(8).uint64(message.maxMetadataLen);
        }
        if (message.authority !== '') {
            writer.uint32(18).string(message.authority);
        }
        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 = createBaseModule();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.maxMetadataLen = reader.uint64();
                    break;
                case 2:
                    message.authority = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            maxMetadataLen: isSet(object.maxMetadataLen)
                ? BigInt(object.maxMetadataLen.toString())
                : BigInt(0),
            authority: isSet(object.authority) ? String(object.authority) : '',
        };
    },
    toJSON(message) {
        const obj = {};
        message.maxMetadataLen !== undefined &&
            (obj.maxMetadataLen = (message.maxMetadataLen || BigInt(0)).toString());
        message.authority !== undefined && (obj.authority = message.authority);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseModule();
        message.maxMetadataLen =
            object.maxMetadataLen !== undefined && object.maxMetadataLen !== null
                ? BigInt(object.maxMetadataLen.toString())
                : BigInt(0);
        message.authority = object.authority ?? '';
        return message;
    },
    fromProtoMsg(message) {
        return Module.decode(message.value);
    },
    toProto(message) {
        return Module.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/cosmos.gov.module.v1.Module',
            value: Module.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=module.js.map