"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassifiersServiceClient = exports.ClassifiersServiceService = exports.ListClassifiersResponse = exports.ListClassifiersRequest = exports.protobufPackage = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const grpc_js_1 = require("@grpc/grpc-js");
const minimal_1 = __importDefault(require("protobufjs/minimal"));
const classifier_1 = require("../../../../yandex/cloud/speechsense/v1/classifier");
exports.protobufPackage = 'yandex.cloud.speechsense.v1';
const baseListClassifiersRequest = { projectId: '' };
exports.ListClassifiersRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.projectId !== '') {
            writer.uint32(10).string(message.projectId);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListClassifiersRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.projectId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseListClassifiersRequest);
        message.projectId =
            object.projectId !== undefined && object.projectId !== null
                ? String(object.projectId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.projectId !== undefined && (obj.projectId = message.projectId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListClassifiersRequest);
        message.projectId = (_a = object.projectId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseListClassifiersResponse = {};
exports.ListClassifiersResponse = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        for (const v of message.classifiers) {
            classifier_1.Classifier.encode(v, writer.uint32(10).fork()).ldelim();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = Object.assign({}, baseListClassifiersResponse);
        message.classifiers = [];
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.classifiers.push(classifier_1.Classifier.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        var _a;
        const message = Object.assign({}, baseListClassifiersResponse);
        message.classifiers = ((_a = object.classifiers) !== null && _a !== void 0 ? _a : []).map((e) => classifier_1.Classifier.fromJSON(e));
        return message;
    },
    toJSON(message) {
        const obj = {};
        if (message.classifiers) {
            obj.classifiers = message.classifiers.map((e) => e ? classifier_1.Classifier.toJSON(e) : undefined);
        }
        else {
            obj.classifiers = [];
        }
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseListClassifiersResponse);
        message.classifiers = ((_a = object.classifiers) === null || _a === void 0 ? void 0 : _a.map((e) => classifier_1.Classifier.fromPartial(e))) || [];
        return message;
    },
};
exports.ClassifiersServiceService = {
    /** Rpc for listing classifiers in a project */
    list: {
        path: '/yandex.cloud.speechsense.v1.ClassifiersService/List',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ListClassifiersRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ListClassifiersRequest.decode(value),
        responseSerialize: (value) => Buffer.from(exports.ListClassifiersResponse.encode(value).finish()),
        responseDeserialize: (value) => exports.ListClassifiersResponse.decode(value),
    },
};
exports.ClassifiersServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.ClassifiersServiceService, 'yandex.cloud.speechsense.v1.ClassifiersService');
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
