"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InstanceServiceClient = exports.InstanceServiceService = exports.GetUserInfoRequest = exports.GetInstanceRequest = 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 instance_1 = require("../../../../../../yandex/cloud/marketplace/licensemanager/v1/instance");
const user_info_1 = require("../../../../../../yandex/cloud/marketplace/licensemanager/v1/user_info");
exports.protobufPackage = 'yandex.cloud.marketplace.licensemanager.saas.v1';
const baseGetInstanceRequest = { instanceId: '' };
exports.GetInstanceRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.instanceId !== '') {
            writer.uint32(10).string(message.instanceId);
        }
        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({}, baseGetInstanceRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.instanceId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetInstanceRequest);
        message.instanceId =
            object.instanceId !== undefined && object.instanceId !== null
                ? String(object.instanceId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.instanceId !== undefined && (obj.instanceId = message.instanceId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetInstanceRequest);
        message.instanceId = (_a = object.instanceId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
const baseGetUserInfoRequest = { instanceId: '' };
exports.GetUserInfoRequest = {
    encode(message, writer = minimal_1.default.Writer.create()) {
        if (message.instanceId !== '') {
            writer.uint32(10).string(message.instanceId);
        }
        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({}, baseGetUserInfoRequest);
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.instanceId = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        const message = Object.assign({}, baseGetUserInfoRequest);
        message.instanceId =
            object.instanceId !== undefined && object.instanceId !== null
                ? String(object.instanceId)
                : '';
        return message;
    },
    toJSON(message) {
        const obj = {};
        message.instanceId !== undefined && (obj.instanceId = message.instanceId);
        return obj;
    },
    fromPartial(object) {
        var _a;
        const message = Object.assign({}, baseGetUserInfoRequest);
        message.instanceId = (_a = object.instanceId) !== null && _a !== void 0 ? _a : '';
        return message;
    },
};
/** A set of methods for managing subscription instances. */
exports.InstanceServiceService = {
    /** Returns the specified subscription instance. */
    get: {
        path: '/yandex.cloud.marketplace.licensemanager.saas.v1.InstanceService/Get',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetInstanceRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetInstanceRequest.decode(value),
        responseSerialize: (value) => Buffer.from(instance_1.Instance.encode(value).finish()),
        responseDeserialize: (value) => instance_1.Instance.decode(value),
    },
    /** Returns information about legal person (Russia only) who owns this subscription instance. */
    getUserInfo: {
        path: '/yandex.cloud.marketplace.licensemanager.saas.v1.InstanceService/GetUserInfo',
        requestStream: false,
        responseStream: false,
        requestSerialize: (value) => Buffer.from(exports.GetUserInfoRequest.encode(value).finish()),
        requestDeserialize: (value) => exports.GetUserInfoRequest.decode(value),
        responseSerialize: (value) => Buffer.from(user_info_1.UserInfo.encode(value).finish()),
        responseDeserialize: (value) => user_info_1.UserInfo.decode(value),
    },
};
exports.InstanceServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.InstanceServiceService, 'yandex.cloud.marketplace.licensemanager.saas.v1.InstanceService');
if (minimal_1.default.util.Long !== long_1.default) {
    minimal_1.default.util.Long = long_1.default;
    minimal_1.default.configure();
}
