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