/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination";
import { Confirmation } from "./confirmation";
import { Operation } from "./operation";
import { Params } from "./params";
export const protobufPackage = "rarifyprotocol.rarimocore.rarimocore";
function createBaseQueryParamsRequest() {
    return {};
}
export const QueryParamsRequest = {
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryParamsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseQueryParamsRequest();
        return message;
    },
};
function createBaseQueryParamsResponse() {
    return { params: undefined };
}
export const QueryParamsResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.params !== undefined) {
            Params.encode(message.params, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryParamsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.params = Params.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryParamsResponse();
        message.params = (object.params !== undefined && object.params !== null)
            ? Params.fromPartial(object.params)
            : undefined;
        return message;
    },
};
function createBaseQueryGetOperationRequest() {
    return { index: "" };
}
export const QueryGetOperationRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.index !== "") {
            writer.uint32(10).string(message.index);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetOperationRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.index = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { index: isSet(object.index) ? String(object.index) : "" };
    },
    toJSON(message) {
        const obj = {};
        message.index !== undefined && (obj.index = message.index);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetOperationRequest();
        message.index = object.index ?? "";
        return message;
    },
};
function createBaseQueryGetOperationResponse() {
    return { operation: undefined };
}
export const QueryGetOperationResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.operation !== undefined) {
            Operation.encode(message.operation, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetOperationResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.operation = Operation.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { operation: isSet(object.operation) ? Operation.fromJSON(object.operation) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.operation !== undefined
            && (obj.operation = message.operation ? Operation.toJSON(message.operation) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetOperationResponse();
        message.operation = (object.operation !== undefined && object.operation !== null)
            ? Operation.fromPartial(object.operation)
            : undefined;
        return message;
    },
};
function createBaseQueryAllOperationRequest() {
    return { pagination: undefined };
}
export const QueryAllOperationRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.pagination !== undefined) {
            PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllOperationRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pagination = PageRequest.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllOperationRequest();
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageRequest.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
function createBaseQueryAllOperationResponse() {
    return { operation: [], pagination: undefined };
}
export const QueryAllOperationResponse = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.operation) {
            Operation.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.pagination !== undefined) {
            PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllOperationResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.operation.push(Operation.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.pagination = PageResponse.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            operation: Array.isArray(object?.operation) ? object.operation.map((e) => Operation.fromJSON(e)) : [],
            pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.operation) {
            obj.operation = message.operation.map((e) => e ? Operation.toJSON(e) : undefined);
        }
        else {
            obj.operation = [];
        }
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllOperationResponse();
        message.operation = object.operation?.map((e) => Operation.fromPartial(e)) || [];
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageResponse.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
function createBaseQueryGetConfirmationRequest() {
    return { root: "" };
}
export const QueryGetConfirmationRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.root !== "") {
            writer.uint32(10).string(message.root);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetConfirmationRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.root = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { root: isSet(object.root) ? String(object.root) : "" };
    },
    toJSON(message) {
        const obj = {};
        message.root !== undefined && (obj.root = message.root);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetConfirmationRequest();
        message.root = object.root ?? "";
        return message;
    },
};
function createBaseQueryGetConfirmationResponse() {
    return { confirmation: undefined };
}
export const QueryGetConfirmationResponse = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.confirmation !== undefined) {
            Confirmation.encode(message.confirmation, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryGetConfirmationResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.confirmation = Confirmation.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { confirmation: isSet(object.confirmation) ? Confirmation.fromJSON(object.confirmation) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.confirmation !== undefined
            && (obj.confirmation = message.confirmation ? Confirmation.toJSON(message.confirmation) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryGetConfirmationResponse();
        message.confirmation = (object.confirmation !== undefined && object.confirmation !== null)
            ? Confirmation.fromPartial(object.confirmation)
            : undefined;
        return message;
    },
};
function createBaseQueryAllConfirmationRequest() {
    return { pagination: undefined };
}
export const QueryAllConfirmationRequest = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.pagination !== undefined) {
            PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllConfirmationRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pagination = PageRequest.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined };
    },
    toJSON(message) {
        const obj = {};
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllConfirmationRequest();
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageRequest.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
function createBaseQueryAllConfirmationResponse() {
    return { confirmation: [], pagination: undefined };
}
export const QueryAllConfirmationResponse = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.confirmation) {
            Confirmation.encode(v, writer.uint32(10).fork()).ldelim();
        }
        if (message.pagination !== undefined) {
            PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseQueryAllConfirmationResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.confirmation.push(Confirmation.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.pagination = PageResponse.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            confirmation: Array.isArray(object?.confirmation)
                ? object.confirmation.map((e) => Confirmation.fromJSON(e))
                : [],
            pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.confirmation) {
            obj.confirmation = message.confirmation.map((e) => e ? Confirmation.toJSON(e) : undefined);
        }
        else {
            obj.confirmation = [];
        }
        message.pagination !== undefined
            && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseQueryAllConfirmationResponse();
        message.confirmation = object.confirmation?.map((e) => Confirmation.fromPartial(e)) || [];
        message.pagination = (object.pagination !== undefined && object.pagination !== null)
            ? PageResponse.fromPartial(object.pagination)
            : undefined;
        return message;
    },
};
export class QueryClientImpl {
    rpc;
    constructor(rpc) {
        this.rpc = rpc;
        this.Params = this.Params.bind(this);
        this.Operation = this.Operation.bind(this);
        this.OperationAll = this.OperationAll.bind(this);
        this.Confirmation = this.Confirmation.bind(this);
        this.ConfirmationAll = this.ConfirmationAll.bind(this);
    }
    Params(request) {
        const data = QueryParamsRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Query", "Params", data);
        return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data)));
    }
    Operation(request) {
        const data = QueryGetOperationRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Query", "Operation", data);
        return promise.then((data) => QueryGetOperationResponse.decode(new _m0.Reader(data)));
    }
    OperationAll(request) {
        const data = QueryAllOperationRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Query", "OperationAll", data);
        return promise.then((data) => QueryAllOperationResponse.decode(new _m0.Reader(data)));
    }
    Confirmation(request) {
        const data = QueryGetConfirmationRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Query", "Confirmation", data);
        return promise.then((data) => QueryGetConfirmationResponse.decode(new _m0.Reader(data)));
    }
    ConfirmationAll(request) {
        const data = QueryAllConfirmationRequest.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Query", "ConfirmationAll", data);
        return promise.then((data) => QueryAllConfirmationResponse.decode(new _m0.Reader(data)));
    }
}
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=query.js.map