import { BinaryReader, BinaryWriter } from "../../../../binary";
import { GlobalDecoderRegistry } from "../../../../registry";
function createBaseModule() {
    return {
        genesisParams: undefined
    };
}
/**
 * Module is the config object of the benchmark module.
 * @name Module
 * @package cosmos.benchmark.module.v1
 * @see proto type: cosmos.benchmark.module.v1.Module
 */
export const Module = {
    typeUrl: "/cosmos.benchmark.module.v1.Module",
    aminoType: "cosmos-sdk/Module",
    is(o) {
        return o && o.$typeUrl === Module.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === Module.typeUrl;
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.genesisParams !== undefined) {
            GeneratorParams.encode(message.genesisParams, writer.uint32(10).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 = createBaseModule();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.genesisParams = GeneratorParams.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseModule();
        message.genesisParams = object.genesisParams !== undefined && object.genesisParams !== null ? GeneratorParams.fromPartial(object.genesisParams) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseModule();
        if (object.genesis_params !== undefined && object.genesis_params !== null) {
            message.genesisParams = GeneratorParams.fromAmino(object.genesis_params);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.genesis_params = message.genesisParams ? GeneratorParams.toAmino(message.genesisParams) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return Module.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/Module",
            value: Module.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return Module.decode(message.value);
    },
    toProto(message) {
        return Module.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.benchmark.module.v1.Module",
            value: Module.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(Module.typeUrl)) {
            return;
        }
        GeneratorParams.registerTypeUrl();
    }
};
function createBaseGeneratorParams() {
    return {
        seed: BigInt(0),
        bucketCount: BigInt(0),
        keyMean: BigInt(0),
        keyStdDev: BigInt(0),
        valueMean: BigInt(0),
        valueStdDev: BigInt(0),
        genesisCount: BigInt(0),
        insertWeight: 0,
        updateWeight: 0,
        getWeight: 0,
        deleteWeight: 0
    };
}
/**
 * GenesisParams defines the genesis parameters for the benchmark module.
 * @name GeneratorParams
 * @package cosmos.benchmark.module.v1
 * @see proto type: cosmos.benchmark.module.v1.GeneratorParams
 */
export const GeneratorParams = {
    typeUrl: "/cosmos.benchmark.module.v1.GeneratorParams",
    aminoType: "cosmos-sdk/GeneratorParams",
    is(o) {
        return o && (o.$typeUrl === GeneratorParams.typeUrl || typeof o.seed === "bigint" && typeof o.bucketCount === "bigint" && typeof o.keyMean === "bigint" && typeof o.keyStdDev === "bigint" && typeof o.valueMean === "bigint" && typeof o.valueStdDev === "bigint" && typeof o.genesisCount === "bigint" && typeof o.insertWeight === "number" && typeof o.updateWeight === "number" && typeof o.getWeight === "number" && typeof o.deleteWeight === "number");
    },
    isAmino(o) {
        return o && (o.$typeUrl === GeneratorParams.typeUrl || typeof o.seed === "bigint" && typeof o.bucket_count === "bigint" && typeof o.key_mean === "bigint" && typeof o.key_std_dev === "bigint" && typeof o.value_mean === "bigint" && typeof o.value_std_dev === "bigint" && typeof o.genesis_count === "bigint" && typeof o.insert_weight === "number" && typeof o.update_weight === "number" && typeof o.get_weight === "number" && typeof o.delete_weight === "number");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.seed !== BigInt(0)) {
            writer.uint32(8).uint64(message.seed);
        }
        if (message.bucketCount !== BigInt(0)) {
            writer.uint32(16).uint64(message.bucketCount);
        }
        if (message.keyMean !== BigInt(0)) {
            writer.uint32(24).uint64(message.keyMean);
        }
        if (message.keyStdDev !== BigInt(0)) {
            writer.uint32(32).uint64(message.keyStdDev);
        }
        if (message.valueMean !== BigInt(0)) {
            writer.uint32(48).uint64(message.valueMean);
        }
        if (message.valueStdDev !== BigInt(0)) {
            writer.uint32(56).uint64(message.valueStdDev);
        }
        if (message.genesisCount !== BigInt(0)) {
            writer.uint32(64).uint64(message.genesisCount);
        }
        if (message.insertWeight !== 0) {
            writer.uint32(77).float(message.insertWeight);
        }
        if (message.updateWeight !== 0) {
            writer.uint32(85).float(message.updateWeight);
        }
        if (message.getWeight !== 0) {
            writer.uint32(101).float(message.getWeight);
        }
        if (message.deleteWeight !== 0) {
            writer.uint32(93).float(message.deleteWeight);
        }
        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 = createBaseGeneratorParams();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.seed = reader.uint64();
                    break;
                case 2:
                    message.bucketCount = reader.uint64();
                    break;
                case 3:
                    message.keyMean = reader.uint64();
                    break;
                case 4:
                    message.keyStdDev = reader.uint64();
                    break;
                case 6:
                    message.valueMean = reader.uint64();
                    break;
                case 7:
                    message.valueStdDev = reader.uint64();
                    break;
                case 8:
                    message.genesisCount = reader.uint64();
                    break;
                case 9:
                    message.insertWeight = reader.float();
                    break;
                case 10:
                    message.updateWeight = reader.float();
                    break;
                case 12:
                    message.getWeight = reader.float();
                    break;
                case 11:
                    message.deleteWeight = reader.float();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseGeneratorParams();
        message.seed = object.seed !== undefined && object.seed !== null ? BigInt(object.seed.toString()) : BigInt(0);
        message.bucketCount = object.bucketCount !== undefined && object.bucketCount !== null ? BigInt(object.bucketCount.toString()) : BigInt(0);
        message.keyMean = object.keyMean !== undefined && object.keyMean !== null ? BigInt(object.keyMean.toString()) : BigInt(0);
        message.keyStdDev = object.keyStdDev !== undefined && object.keyStdDev !== null ? BigInt(object.keyStdDev.toString()) : BigInt(0);
        message.valueMean = object.valueMean !== undefined && object.valueMean !== null ? BigInt(object.valueMean.toString()) : BigInt(0);
        message.valueStdDev = object.valueStdDev !== undefined && object.valueStdDev !== null ? BigInt(object.valueStdDev.toString()) : BigInt(0);
        message.genesisCount = object.genesisCount !== undefined && object.genesisCount !== null ? BigInt(object.genesisCount.toString()) : BigInt(0);
        message.insertWeight = object.insertWeight ?? 0;
        message.updateWeight = object.updateWeight ?? 0;
        message.getWeight = object.getWeight ?? 0;
        message.deleteWeight = object.deleteWeight ?? 0;
        return message;
    },
    fromAmino(object) {
        const message = createBaseGeneratorParams();
        if (object.seed !== undefined && object.seed !== null) {
            message.seed = BigInt(object.seed);
        }
        if (object.bucket_count !== undefined && object.bucket_count !== null) {
            message.bucketCount = BigInt(object.bucket_count);
        }
        if (object.key_mean !== undefined && object.key_mean !== null) {
            message.keyMean = BigInt(object.key_mean);
        }
        if (object.key_std_dev !== undefined && object.key_std_dev !== null) {
            message.keyStdDev = BigInt(object.key_std_dev);
        }
        if (object.value_mean !== undefined && object.value_mean !== null) {
            message.valueMean = BigInt(object.value_mean);
        }
        if (object.value_std_dev !== undefined && object.value_std_dev !== null) {
            message.valueStdDev = BigInt(object.value_std_dev);
        }
        if (object.genesis_count !== undefined && object.genesis_count !== null) {
            message.genesisCount = BigInt(object.genesis_count);
        }
        if (object.insert_weight !== undefined && object.insert_weight !== null) {
            message.insertWeight = object.insert_weight;
        }
        if (object.update_weight !== undefined && object.update_weight !== null) {
            message.updateWeight = object.update_weight;
        }
        if (object.get_weight !== undefined && object.get_weight !== null) {
            message.getWeight = object.get_weight;
        }
        if (object.delete_weight !== undefined && object.delete_weight !== null) {
            message.deleteWeight = object.delete_weight;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.seed = message.seed !== BigInt(0) ? message.seed?.toString() : undefined;
        obj.bucket_count = message.bucketCount !== BigInt(0) ? message.bucketCount?.toString() : undefined;
        obj.key_mean = message.keyMean !== BigInt(0) ? message.keyMean?.toString() : undefined;
        obj.key_std_dev = message.keyStdDev !== BigInt(0) ? message.keyStdDev?.toString() : undefined;
        obj.value_mean = message.valueMean !== BigInt(0) ? message.valueMean?.toString() : undefined;
        obj.value_std_dev = message.valueStdDev !== BigInt(0) ? message.valueStdDev?.toString() : undefined;
        obj.genesis_count = message.genesisCount !== BigInt(0) ? message.genesisCount?.toString() : undefined;
        obj.insert_weight = message.insertWeight === 0 ? undefined : message.insertWeight;
        obj.update_weight = message.updateWeight === 0 ? undefined : message.updateWeight;
        obj.get_weight = message.getWeight === 0 ? undefined : message.getWeight;
        obj.delete_weight = message.deleteWeight === 0 ? undefined : message.deleteWeight;
        return obj;
    },
    fromAminoMsg(object) {
        return GeneratorParams.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/GeneratorParams",
            value: GeneratorParams.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return GeneratorParams.decode(message.value);
    },
    toProto(message) {
        return GeneratorParams.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.benchmark.module.v1.GeneratorParams",
            value: GeneratorParams.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
