"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatasetServiceClient = exports.DatasetServiceService = exports.DeactivateDatasetRequest = exports.ActivateDatasetRequest = 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 operation_1 = require("../../../../yandex/cloud/operation/operation");
exports.protobufPackage = 'yandex.cloud.datasphere.v2';
const baseActivateDatasetRequest = { datasetId: '', projectId: '' };
exports.ActivateDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.projectId !== '') {
            writer.uint32(18).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({}, baseActivateDatasetRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.projectId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseActivateDatasetRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.projectId =
            object.projectId !== undefined && object.projectId !== null
                ? String(object.projectId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.projectId !== undefined && (obj.projectId = message.projectId);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseActivateDatasetRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.projectId = (_b = object.projectId) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
const baseDeactivateDatasetRequest = { datasetId: '', projectId: '' };
exports.DeactivateDatasetRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.datasetId !== '') {
            writer.uint32(10).string(message.datasetId);
        }
        if (message.projectId !== '') {
            writer.uint32(18).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({}, baseDeactivateDatasetRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.datasetId = reader.string();
                    break;
                case 2:
                    message.projectId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseDeactivateDatasetRequest);
        message.datasetId =
            object.datasetId !== undefined && object.datasetId !== null
                ? String(object.datasetId)
                : '';
        message.projectId =
            object.projectId !== undefined && object.projectId !== null
                ? String(object.projectId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.datasetId !== undefined && (obj.datasetId = message.datasetId);
        message.projectId !== undefined && (obj.projectId = message.projectId);
        return obj;
    },
    fromPartial(object) {
        var _a, _b;
        const message = Object.assign({}, baseDeactivateDatasetRequest);
        message.datasetId = (_a = object.datasetId) !== null && _a !== void 0 ? _a : '';
        message.projectId = (_b = object.projectId) !== null && _b !== void 0 ? _b : '';
        return message;
    },
};
/** A set of methods for managing Datasets. */
exports.DatasetServiceService = {
    /** Activates shared dataset for project */
    activate: {
        path: '/yandex.cloud.datasphere.v2.DatasetService/Activate',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.ActivateDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.ActivateDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
    /** Deactivates shared dataset for project */
    deactivate: {
        path: '/yandex.cloud.datasphere.v2.DatasetService/Deactivate',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.DeactivateDatasetRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.DeactivateDatasetRequest.decode(value),
        responseSerialize: (value) => Buffer.from(operation_1.Operation.encode(value).finish()),
        responseDeserialize: (value) => operation_1.Operation.decode(value),
    },
};
exports.DatasetServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.DatasetServiceService, 'yandex.cloud.datasphere.v2.DatasetService');
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
