"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Op = void 0;
const binary_1 = require("../../../binary");
function createBaseOp() {
    return {
        seed: BigInt(0),
        actor: "",
        keyLength: BigInt(0),
        valueLength: BigInt(0),
        iterations: 0,
        delete: false,
        exists: false
    };
}
/**
 * Op is a message describing a benchmark operation.
 * @name Op
 * @package cosmos.benchmark.v1
 * @see proto type: cosmos.benchmark.v1.Op
 */
exports.Op = {
    typeUrl: "/cosmos.benchmark.v1.Op",
    aminoType: "cosmos-sdk/Op",
    is(o) {
        return o && (o.$typeUrl === exports.Op.typeUrl || typeof o.seed === "bigint" && typeof o.actor === "string" && typeof o.keyLength === "bigint" && typeof o.valueLength === "bigint" && typeof o.iterations === "number" && typeof o.delete === "boolean" && typeof o.exists === "boolean");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.Op.typeUrl || typeof o.seed === "bigint" && typeof o.actor === "string" && typeof o.key_length === "bigint" && typeof o.value_length === "bigint" && typeof o.iterations === "number" && typeof o.delete === "boolean" && typeof o.exists === "boolean");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.seed !== BigInt(0)) {
            writer.uint32(8).uint64(message.seed);
        }
        if (message.actor !== "") {
            writer.uint32(18).string(message.actor);
        }
        if (message.keyLength !== BigInt(0)) {
            writer.uint32(24).uint64(message.keyLength);
        }
        if (message.valueLength !== BigInt(0)) {
            writer.uint32(32).uint64(message.valueLength);
        }
        if (message.iterations !== 0) {
            writer.uint32(40).uint32(message.iterations);
        }
        if (message.delete === true) {
            writer.uint32(48).bool(message.delete);
        }
        if (message.exists === true) {
            writer.uint32(56).bool(message.exists);
        }
        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 = createBaseOp();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.seed = reader.uint64();
                    break;
                case 2:
                    message.actor = reader.string();
                    break;
                case 3:
                    message.keyLength = reader.uint64();
                    break;
                case 4:
                    message.valueLength = reader.uint64();
                    break;
                case 5:
                    message.iterations = reader.uint32();
                    break;
                case 6:
                    message.delete = reader.bool();
                    break;
                case 7:
                    message.exists = reader.bool();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseOp();
        message.seed = object.seed !== undefined && object.seed !== null ? BigInt(object.seed.toString()) : BigInt(0);
        message.actor = object.actor ?? "";
        message.keyLength = object.keyLength !== undefined && object.keyLength !== null ? BigInt(object.keyLength.toString()) : BigInt(0);
        message.valueLength = object.valueLength !== undefined && object.valueLength !== null ? BigInt(object.valueLength.toString()) : BigInt(0);
        message.iterations = object.iterations ?? 0;
        message.delete = object.delete ?? false;
        message.exists = object.exists ?? false;
        return message;
    },
    fromAmino(object) {
        const message = createBaseOp();
        if (object.seed !== undefined && object.seed !== null) {
            message.seed = BigInt(object.seed);
        }
        if (object.actor !== undefined && object.actor !== null) {
            message.actor = object.actor;
        }
        if (object.key_length !== undefined && object.key_length !== null) {
            message.keyLength = BigInt(object.key_length);
        }
        if (object.value_length !== undefined && object.value_length !== null) {
            message.valueLength = BigInt(object.value_length);
        }
        if (object.iterations !== undefined && object.iterations !== null) {
            message.iterations = object.iterations;
        }
        if (object.delete !== undefined && object.delete !== null) {
            message.delete = object.delete;
        }
        if (object.exists !== undefined && object.exists !== null) {
            message.exists = object.exists;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.seed = message.seed !== BigInt(0) ? message.seed?.toString() : undefined;
        obj.actor = message.actor === "" ? undefined : message.actor;
        obj.key_length = message.keyLength !== BigInt(0) ? message.keyLength?.toString() : undefined;
        obj.value_length = message.valueLength !== BigInt(0) ? message.valueLength?.toString() : undefined;
        obj.iterations = message.iterations === 0 ? undefined : message.iterations;
        obj.delete = message.delete === false ? undefined : message.delete;
        obj.exists = message.exists === false ? undefined : message.exists;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.Op.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/Op",
            value: exports.Op.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.Op.decode(message.value);
    },
    toProto(message) {
        return exports.Op.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.benchmark.v1.Op",
            value: exports.Op.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
