//@ts-nocheck
import { Duration, } from '../../../../google/protobuf/duration.js';
import { BinaryReader, BinaryWriter } from '../../../../binary.js';
import { isSet } from '../../../../helpers.js';
import {} from '../../../../json-safe.js';
function createBaseModule() {
    return {
        maxExecutionPeriod: Duration.fromPartial({}),
        maxMetadataLen: BigInt(0),
    };
}
export const Module = {
    typeUrl: '/cosmos.group.module.v1.Module',
    encode(message, writer = BinaryWriter.create()) {
        if (message.maxExecutionPeriod !== undefined) {
            Duration.encode(message.maxExecutionPeriod, writer.uint32(10).fork()).ldelim();
        }
        if (message.maxMetadataLen !== BigInt(0)) {
            writer.uint32(16).uint64(message.maxMetadataLen);
        }
        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.maxExecutionPeriod = Duration.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.maxMetadataLen = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            maxExecutionPeriod: isSet(object.maxExecutionPeriod)
                ? Duration.fromJSON(object.maxExecutionPeriod)
                : undefined,
            maxMetadataLen: isSet(object.maxMetadataLen)
                ? BigInt(object.maxMetadataLen.toString())
                : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.maxExecutionPeriod !== undefined &&
            (obj.maxExecutionPeriod = message.maxExecutionPeriod
                ? Duration.toJSON(message.maxExecutionPeriod)
                : undefined);
        message.maxMetadataLen !== undefined &&
            (obj.maxMetadataLen = (message.maxMetadataLen || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseModule();
        message.maxExecutionPeriod =
            object.maxExecutionPeriod !== undefined &&
                object.maxExecutionPeriod !== null
                ? Duration.fromPartial(object.maxExecutionPeriod)
                : undefined;
        message.maxMetadataLen =
            object.maxMetadataLen !== undefined && object.maxMetadataLen !== null
                ? BigInt(object.maxMetadataLen.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return Module.decode(message.value);
    },
    toProto(message) {
        return Module.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/cosmos.group.module.v1.Module',
            value: Module.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=module.js.map