"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.auth = void 0;
/**
 * Generated by the protoc-gen-ts.  DO NOT EDIT!
 * compiler version: 3.19.1
 * source: auth.proto
 * git: https://github.com/thesayyn/protoc-gen-ts */
const dependency_1 = __importStar(require("./permissionmessages"));
const pb_1 = __importStar(require("google-protobuf"));
const grpc_1 = __importStar(require("@grpc/grpc-js"));
var auth;
(function (auth) {
    var __LoginRequest_one_of_decls, __LoginResponse_one_of_decls, __GenerateApiTokenRequest_one_of_decls, __GenerateApiTokenResponse_one_of_decls, __RefreshApiTokenRequest_one_of_decls, __RefreshApiTokenResponse_one_of_decls;
    class _LoginRequest extends pb_1.Message {
        constructor(data) {
            super();
            __LoginRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __LoginRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") { }
        }
        static fromObject(data) {
            const message = new _LoginRequest({});
            return message;
        }
        toObject() {
            const data = {};
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _LoginRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _LoginRequest.deserialize(bytes);
        }
    }
    __LoginRequest_one_of_decls = new WeakMap();
    auth._LoginRequest = _LoginRequest;
    class _LoginResponse extends pb_1.Message {
        constructor(data) {
            super();
            __LoginResponse_one_of_decls.set(this, [[1, 2, 3, 4]]);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __LoginResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("direct_browser" in data && data.direct_browser != undefined) {
                    this.direct_browser = data.direct_browser;
                }
                if ("logged_in" in data && data.logged_in != undefined) {
                    this.logged_in = data.logged_in;
                }
                if ("message" in data && data.message != undefined) {
                    this.message = data.message;
                }
                if ("error" in data && data.error != undefined) {
                    this.error = data.error;
                }
            }
        }
        get direct_browser() {
            return pb_1.Message.getWrapperField(this, _LoginResponse.DirectBrowser, 1);
        }
        set direct_browser(value) {
            pb_1.Message.setOneofWrapperField(this, 1, __classPrivateFieldGet(this, __LoginResponse_one_of_decls, "f")[0], value);
        }
        get has_direct_browser() {
            return pb_1.Message.getField(this, 1) != null;
        }
        get logged_in() {
            return pb_1.Message.getWrapperField(this, _LoginResponse.LoggedIn, 2);
        }
        set logged_in(value) {
            pb_1.Message.setOneofWrapperField(this, 2, __classPrivateFieldGet(this, __LoginResponse_one_of_decls, "f")[0], value);
        }
        get has_logged_in() {
            return pb_1.Message.getField(this, 2) != null;
        }
        get message() {
            return pb_1.Message.getWrapperField(this, _LoginResponse.Message, 3);
        }
        set message(value) {
            pb_1.Message.setOneofWrapperField(this, 3, __classPrivateFieldGet(this, __LoginResponse_one_of_decls, "f")[0], value);
        }
        get has_message() {
            return pb_1.Message.getField(this, 3) != null;
        }
        get error() {
            return pb_1.Message.getWrapperField(this, _LoginResponse.Error, 4);
        }
        set error(value) {
            pb_1.Message.setOneofWrapperField(this, 4, __classPrivateFieldGet(this, __LoginResponse_one_of_decls, "f")[0], value);
        }
        get has_error() {
            return pb_1.Message.getField(this, 4) != null;
        }
        get state() {
            const cases = {
                0: "none",
                1: "direct_browser",
                2: "logged_in",
                3: "message",
                4: "error"
            };
            return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4])];
        }
        static fromObject(data) {
            const message = new _LoginResponse({});
            if (data.direct_browser != null) {
                message.direct_browser = _LoginResponse.DirectBrowser.fromObject(data.direct_browser);
            }
            if (data.logged_in != null) {
                message.logged_in = _LoginResponse.LoggedIn.fromObject(data.logged_in);
            }
            if (data.message != null) {
                message.message = _LoginResponse.Message.fromObject(data.message);
            }
            if (data.error != null) {
                message.error = _LoginResponse.Error.fromObject(data.error);
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.direct_browser != null) {
                data.direct_browser = this.direct_browser.toObject();
            }
            if (this.logged_in != null) {
                data.logged_in = this.logged_in.toObject();
            }
            if (this.message != null) {
                data.message = this.message.toObject();
            }
            if (this.error != null) {
                data.error = this.error.toObject();
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.has_direct_browser)
                writer.writeMessage(1, this.direct_browser, () => this.direct_browser.serialize(writer));
            if (this.has_logged_in)
                writer.writeMessage(2, this.logged_in, () => this.logged_in.serialize(writer));
            if (this.has_message)
                writer.writeMessage(3, this.message, () => this.message.serialize(writer));
            if (this.has_error)
                writer.writeMessage(4, this.error, () => this.error.serialize(writer));
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _LoginResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.direct_browser, () => message.direct_browser = _LoginResponse.DirectBrowser.deserialize(reader));
                        break;
                    case 2:
                        reader.readMessage(message.logged_in, () => message.logged_in = _LoginResponse.LoggedIn.deserialize(reader));
                        break;
                    case 3:
                        reader.readMessage(message.message, () => message.message = _LoginResponse.Message.deserialize(reader));
                        break;
                    case 4:
                        reader.readMessage(message.error, () => message.error = _LoginResponse.Error.deserialize(reader));
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _LoginResponse.deserialize(bytes);
        }
    }
    __LoginResponse_one_of_decls = new WeakMap();
    auth._LoginResponse = _LoginResponse;
    (function (_LoginResponse) {
        var _LoggedIn_one_of_decls, _Error_one_of_decls, _DirectBrowser_one_of_decls, _Message_one_of_decls;
        class LoggedIn extends pb_1.Message {
            constructor(data) {
                super();
                _LoggedIn_one_of_decls.set(this, []);
                pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _LoggedIn_one_of_decls, "f"));
                if (!Array.isArray(data) && typeof data == "object") {
                    if ("session_token" in data && data.session_token != undefined) {
                        this.session_token = data.session_token;
                    }
                    if ("valid_for_seconds" in data && data.valid_for_seconds != undefined) {
                        this.valid_for_seconds = data.valid_for_seconds;
                    }
                }
            }
            get session_token() {
                return pb_1.Message.getFieldWithDefault(this, 1, "");
            }
            set session_token(value) {
                pb_1.Message.setField(this, 1, value);
            }
            get valid_for_seconds() {
                return pb_1.Message.getFieldWithDefault(this, 2, 0);
            }
            set valid_for_seconds(value) {
                pb_1.Message.setField(this, 2, value);
            }
            static fromObject(data) {
                const message = new LoggedIn({});
                if (data.session_token != null) {
                    message.session_token = data.session_token;
                }
                if (data.valid_for_seconds != null) {
                    message.valid_for_seconds = data.valid_for_seconds;
                }
                return message;
            }
            toObject() {
                const data = {};
                if (this.session_token != null) {
                    data.session_token = this.session_token;
                }
                if (this.valid_for_seconds != null) {
                    data.valid_for_seconds = this.valid_for_seconds;
                }
                return data;
            }
            serialize(w) {
                const writer = w || new pb_1.BinaryWriter();
                if (this.session_token.length)
                    writer.writeString(1, this.session_token);
                if (this.valid_for_seconds != 0)
                    writer.writeUint32(2, this.valid_for_seconds);
                if (!w)
                    return writer.getResultBuffer();
            }
            static deserialize(bytes) {
                const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new LoggedIn();
                while (reader.nextField()) {
                    if (reader.isEndGroup())
                        break;
                    switch (reader.getFieldNumber()) {
                        case 1:
                            message.session_token = reader.readString();
                            break;
                        case 2:
                            message.valid_for_seconds = reader.readUint32();
                            break;
                        default: reader.skipField();
                    }
                }
                return message;
            }
            serializeBinary() {
                return this.serialize();
            }
            static deserializeBinary(bytes) {
                return LoggedIn.deserialize(bytes);
            }
        }
        _LoggedIn_one_of_decls = new WeakMap();
        _LoginResponse.LoggedIn = LoggedIn;
        class Error extends pb_1.Message {
            constructor(data) {
                super();
                _Error_one_of_decls.set(this, []);
                pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Error_one_of_decls, "f"));
                if (!Array.isArray(data) && typeof data == "object") {
                    if ("description" in data && data.description != undefined) {
                        this.description = data.description;
                    }
                }
            }
            get description() {
                return pb_1.Message.getFieldWithDefault(this, 1, "");
            }
            set description(value) {
                pb_1.Message.setField(this, 1, value);
            }
            static fromObject(data) {
                const message = new Error({});
                if (data.description != null) {
                    message.description = data.description;
                }
                return message;
            }
            toObject() {
                const data = {};
                if (this.description != null) {
                    data.description = this.description;
                }
                return data;
            }
            serialize(w) {
                const writer = w || new pb_1.BinaryWriter();
                if (this.description.length)
                    writer.writeString(1, this.description);
                if (!w)
                    return writer.getResultBuffer();
            }
            static deserialize(bytes) {
                const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Error();
                while (reader.nextField()) {
                    if (reader.isEndGroup())
                        break;
                    switch (reader.getFieldNumber()) {
                        case 1:
                            message.description = reader.readString();
                            break;
                        default: reader.skipField();
                    }
                }
                return message;
            }
            serializeBinary() {
                return this.serialize();
            }
            static deserializeBinary(bytes) {
                return Error.deserialize(bytes);
            }
        }
        _Error_one_of_decls = new WeakMap();
        _LoginResponse.Error = Error;
        class DirectBrowser extends pb_1.Message {
            constructor(data) {
                super();
                _DirectBrowser_one_of_decls.set(this, []);
                pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _DirectBrowser_one_of_decls, "f"));
                if (!Array.isArray(data) && typeof data == "object") {
                    if ("url" in data && data.url != undefined) {
                        this.url = data.url;
                    }
                }
            }
            get url() {
                return pb_1.Message.getFieldWithDefault(this, 1, "");
            }
            set url(value) {
                pb_1.Message.setField(this, 1, value);
            }
            static fromObject(data) {
                const message = new DirectBrowser({});
                if (data.url != null) {
                    message.url = data.url;
                }
                return message;
            }
            toObject() {
                const data = {};
                if (this.url != null) {
                    data.url = this.url;
                }
                return data;
            }
            serialize(w) {
                const writer = w || new pb_1.BinaryWriter();
                if (this.url.length)
                    writer.writeString(1, this.url);
                if (!w)
                    return writer.getResultBuffer();
            }
            static deserialize(bytes) {
                const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new DirectBrowser();
                while (reader.nextField()) {
                    if (reader.isEndGroup())
                        break;
                    switch (reader.getFieldNumber()) {
                        case 1:
                            message.url = reader.readString();
                            break;
                        default: reader.skipField();
                    }
                }
                return message;
            }
            serializeBinary() {
                return this.serialize();
            }
            static deserializeBinary(bytes) {
                return DirectBrowser.deserialize(bytes);
            }
        }
        _DirectBrowser_one_of_decls = new WeakMap();
        _LoginResponse.DirectBrowser = DirectBrowser;
        class Message extends pb_1.Message {
            constructor(data) {
                super();
                _Message_one_of_decls.set(this, []);
                pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Message_one_of_decls, "f"));
                if (!Array.isArray(data) && typeof data == "object") {
                    if ("text" in data && data.text != undefined) {
                        this.text = data.text;
                    }
                }
            }
            get text() {
                return pb_1.Message.getFieldWithDefault(this, 1, "");
            }
            set text(value) {
                pb_1.Message.setField(this, 1, value);
            }
            static fromObject(data) {
                const message = new Message({});
                if (data.text != null) {
                    message.text = data.text;
                }
                return message;
            }
            toObject() {
                const data = {};
                if (this.text != null) {
                    data.text = this.text;
                }
                return data;
            }
            serialize(w) {
                const writer = w || new pb_1.BinaryWriter();
                if (this.text.length)
                    writer.writeString(1, this.text);
                if (!w)
                    return writer.getResultBuffer();
            }
            static deserialize(bytes) {
                const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Message();
                while (reader.nextField()) {
                    if (reader.isEndGroup())
                        break;
                    switch (reader.getFieldNumber()) {
                        case 1:
                            message.text = reader.readString();
                            break;
                        default: reader.skipField();
                    }
                }
                return message;
            }
            serializeBinary() {
                return this.serialize();
            }
            static deserializeBinary(bytes) {
                return Message.deserialize(bytes);
            }
        }
        _Message_one_of_decls = new WeakMap();
        _LoginResponse.Message = Message;
    })(_LoginResponse = auth._LoginResponse || (auth._LoginResponse = {}));
    class _GenerateApiTokenRequest extends pb_1.Message {
        constructor(data) {
            super();
            __GenerateApiTokenRequest_one_of_decls.set(this, [[1, 2]]);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __GenerateApiTokenRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("never" in data && data.never != undefined) {
                    this.never = data.never;
                }
                if ("expires" in data && data.expires != undefined) {
                    this.expires = data.expires;
                }
                if ("auth_token" in data && data.auth_token != undefined) {
                    this.auth_token = data.auth_token;
                }
                if ("permissions" in data && data.permissions != undefined) {
                    this.permissions = data.permissions;
                }
                if ("token_id" in data && data.token_id != undefined) {
                    this.token_id = data.token_id;
                }
                if ("description" in data && data.description != undefined) {
                    this.description = data.description;
                }
            }
        }
        get never() {
            return pb_1.Message.getWrapperField(this, _GenerateApiTokenRequest.Never, 1);
        }
        set never(value) {
            pb_1.Message.setOneofWrapperField(this, 1, __classPrivateFieldGet(this, __GenerateApiTokenRequest_one_of_decls, "f")[0], value);
        }
        get has_never() {
            return pb_1.Message.getField(this, 1) != null;
        }
        get expires() {
            return pb_1.Message.getWrapperField(this, _GenerateApiTokenRequest.Expires, 2);
        }
        set expires(value) {
            pb_1.Message.setOneofWrapperField(this, 2, __classPrivateFieldGet(this, __GenerateApiTokenRequest_one_of_decls, "f")[0], value);
        }
        get has_expires() {
            return pb_1.Message.getField(this, 2) != null;
        }
        get auth_token() {
            return pb_1.Message.getFieldWithDefault(this, 3, "");
        }
        set auth_token(value) {
            pb_1.Message.setField(this, 3, value);
        }
        get permissions() {
            return pb_1.Message.getWrapperField(this, dependency_1.permission_messages.Permissions, 4);
        }
        set permissions(value) {
            pb_1.Message.setWrapperField(this, 4, value);
        }
        get has_permissions() {
            return pb_1.Message.getField(this, 4) != null;
        }
        get token_id() {
            return pb_1.Message.getFieldWithDefault(this, 5, "");
        }
        set token_id(value) {
            pb_1.Message.setField(this, 5, value);
        }
        get description() {
            return pb_1.Message.getFieldWithDefault(this, 6, "");
        }
        set description(value) {
            pb_1.Message.setField(this, 6, value);
        }
        get expiry() {
            const cases = {
                0: "none",
                1: "never",
                2: "expires"
            };
            return cases[pb_1.Message.computeOneofCase(this, [1, 2])];
        }
        static fromObject(data) {
            const message = new _GenerateApiTokenRequest({});
            if (data.never != null) {
                message.never = _GenerateApiTokenRequest.Never.fromObject(data.never);
            }
            if (data.expires != null) {
                message.expires = _GenerateApiTokenRequest.Expires.fromObject(data.expires);
            }
            if (data.auth_token != null) {
                message.auth_token = data.auth_token;
            }
            if (data.permissions != null) {
                message.permissions = dependency_1.permission_messages.Permissions.fromObject(data.permissions);
            }
            if (data.token_id != null) {
                message.token_id = data.token_id;
            }
            if (data.description != null) {
                message.description = data.description;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.never != null) {
                data.never = this.never.toObject();
            }
            if (this.expires != null) {
                data.expires = this.expires.toObject();
            }
            if (this.auth_token != null) {
                data.auth_token = this.auth_token;
            }
            if (this.permissions != null) {
                data.permissions = this.permissions.toObject();
            }
            if (this.token_id != null) {
                data.token_id = this.token_id;
            }
            if (this.description != null) {
                data.description = this.description;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.has_never)
                writer.writeMessage(1, this.never, () => this.never.serialize(writer));
            if (this.has_expires)
                writer.writeMessage(2, this.expires, () => this.expires.serialize(writer));
            if (this.auth_token.length)
                writer.writeString(3, this.auth_token);
            if (this.has_permissions)
                writer.writeMessage(4, this.permissions, () => this.permissions.serialize(writer));
            if (this.token_id.length)
                writer.writeString(5, this.token_id);
            if (this.description.length)
                writer.writeString(6, this.description);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GenerateApiTokenRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        reader.readMessage(message.never, () => message.never = _GenerateApiTokenRequest.Never.deserialize(reader));
                        break;
                    case 2:
                        reader.readMessage(message.expires, () => message.expires = _GenerateApiTokenRequest.Expires.deserialize(reader));
                        break;
                    case 3:
                        message.auth_token = reader.readString();
                        break;
                    case 4:
                        reader.readMessage(message.permissions, () => message.permissions = dependency_1.permission_messages.Permissions.deserialize(reader));
                        break;
                    case 5:
                        message.token_id = reader.readString();
                        break;
                    case 6:
                        message.description = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GenerateApiTokenRequest.deserialize(bytes);
        }
    }
    __GenerateApiTokenRequest_one_of_decls = new WeakMap();
    auth._GenerateApiTokenRequest = _GenerateApiTokenRequest;
    (function (_GenerateApiTokenRequest) {
        var _Never_one_of_decls, _Expires_one_of_decls;
        class Never extends pb_1.Message {
            constructor(data) {
                super();
                _Never_one_of_decls.set(this, []);
                pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Never_one_of_decls, "f"));
                if (!Array.isArray(data) && typeof data == "object") { }
            }
            static fromObject(data) {
                const message = new Never({});
                return message;
            }
            toObject() {
                const data = {};
                return data;
            }
            serialize(w) {
                const writer = w || new pb_1.BinaryWriter();
                if (!w)
                    return writer.getResultBuffer();
            }
            static deserialize(bytes) {
                const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Never();
                while (reader.nextField()) {
                    if (reader.isEndGroup())
                        break;
                    switch (reader.getFieldNumber()) {
                        default: reader.skipField();
                    }
                }
                return message;
            }
            serializeBinary() {
                return this.serialize();
            }
            static deserializeBinary(bytes) {
                return Never.deserialize(bytes);
            }
        }
        _Never_one_of_decls = new WeakMap();
        _GenerateApiTokenRequest.Never = Never;
        class Expires extends pb_1.Message {
            constructor(data) {
                super();
                _Expires_one_of_decls.set(this, []);
                pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, _Expires_one_of_decls, "f"));
                if (!Array.isArray(data) && typeof data == "object") {
                    if ("valid_for_seconds" in data && data.valid_for_seconds != undefined) {
                        this.valid_for_seconds = data.valid_for_seconds;
                    }
                }
            }
            get valid_for_seconds() {
                return pb_1.Message.getFieldWithDefault(this, 1, 0);
            }
            set valid_for_seconds(value) {
                pb_1.Message.setField(this, 1, value);
            }
            static fromObject(data) {
                const message = new Expires({});
                if (data.valid_for_seconds != null) {
                    message.valid_for_seconds = data.valid_for_seconds;
                }
                return message;
            }
            toObject() {
                const data = {};
                if (this.valid_for_seconds != null) {
                    data.valid_for_seconds = this.valid_for_seconds;
                }
                return data;
            }
            serialize(w) {
                const writer = w || new pb_1.BinaryWriter();
                if (this.valid_for_seconds != 0)
                    writer.writeUint32(1, this.valid_for_seconds);
                if (!w)
                    return writer.getResultBuffer();
            }
            static deserialize(bytes) {
                const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new Expires();
                while (reader.nextField()) {
                    if (reader.isEndGroup())
                        break;
                    switch (reader.getFieldNumber()) {
                        case 1:
                            message.valid_for_seconds = reader.readUint32();
                            break;
                        default: reader.skipField();
                    }
                }
                return message;
            }
            serializeBinary() {
                return this.serialize();
            }
            static deserializeBinary(bytes) {
                return Expires.deserialize(bytes);
            }
        }
        _Expires_one_of_decls = new WeakMap();
        _GenerateApiTokenRequest.Expires = Expires;
    })(_GenerateApiTokenRequest = auth._GenerateApiTokenRequest || (auth._GenerateApiTokenRequest = {}));
    class _GenerateApiTokenResponse extends pb_1.Message {
        constructor(data) {
            super();
            __GenerateApiTokenResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __GenerateApiTokenResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("api_key" in data && data.api_key != undefined) {
                    this.api_key = data.api_key;
                }
                if ("refresh_token" in data && data.refresh_token != undefined) {
                    this.refresh_token = data.refresh_token;
                }
                if ("endpoint" in data && data.endpoint != undefined) {
                    this.endpoint = data.endpoint;
                }
                if ("valid_until" in data && data.valid_until != undefined) {
                    this.valid_until = data.valid_until;
                }
            }
        }
        get api_key() {
            return pb_1.Message.getFieldWithDefault(this, 1, "");
        }
        set api_key(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get refresh_token() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set refresh_token(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get endpoint() {
            return pb_1.Message.getFieldWithDefault(this, 3, "");
        }
        set endpoint(value) {
            pb_1.Message.setField(this, 3, value);
        }
        get valid_until() {
            return pb_1.Message.getFieldWithDefault(this, 4, 0);
        }
        set valid_until(value) {
            pb_1.Message.setField(this, 4, value);
        }
        static fromObject(data) {
            const message = new _GenerateApiTokenResponse({});
            if (data.api_key != null) {
                message.api_key = data.api_key;
            }
            if (data.refresh_token != null) {
                message.refresh_token = data.refresh_token;
            }
            if (data.endpoint != null) {
                message.endpoint = data.endpoint;
            }
            if (data.valid_until != null) {
                message.valid_until = data.valid_until;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.api_key != null) {
                data.api_key = this.api_key;
            }
            if (this.refresh_token != null) {
                data.refresh_token = this.refresh_token;
            }
            if (this.endpoint != null) {
                data.endpoint = this.endpoint;
            }
            if (this.valid_until != null) {
                data.valid_until = this.valid_until;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.api_key.length)
                writer.writeString(1, this.api_key);
            if (this.refresh_token.length)
                writer.writeString(2, this.refresh_token);
            if (this.endpoint.length)
                writer.writeString(3, this.endpoint);
            if (this.valid_until != 0)
                writer.writeUint64(4, this.valid_until);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _GenerateApiTokenResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.api_key = reader.readString();
                        break;
                    case 2:
                        message.refresh_token = reader.readString();
                        break;
                    case 3:
                        message.endpoint = reader.readString();
                        break;
                    case 4:
                        message.valid_until = reader.readUint64();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _GenerateApiTokenResponse.deserialize(bytes);
        }
    }
    __GenerateApiTokenResponse_one_of_decls = new WeakMap();
    auth._GenerateApiTokenResponse = _GenerateApiTokenResponse;
    class _RefreshApiTokenRequest extends pb_1.Message {
        constructor(data) {
            super();
            __RefreshApiTokenRequest_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __RefreshApiTokenRequest_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("api_key" in data && data.api_key != undefined) {
                    this.api_key = data.api_key;
                }
                if ("refresh_token" in data && data.refresh_token != undefined) {
                    this.refresh_token = data.refresh_token;
                }
            }
        }
        get api_key() {
            return pb_1.Message.getFieldWithDefault(this, 1, "");
        }
        set api_key(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get refresh_token() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set refresh_token(value) {
            pb_1.Message.setField(this, 2, value);
        }
        static fromObject(data) {
            const message = new _RefreshApiTokenRequest({});
            if (data.api_key != null) {
                message.api_key = data.api_key;
            }
            if (data.refresh_token != null) {
                message.refresh_token = data.refresh_token;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.api_key != null) {
                data.api_key = this.api_key;
            }
            if (this.refresh_token != null) {
                data.refresh_token = this.refresh_token;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.api_key.length)
                writer.writeString(1, this.api_key);
            if (this.refresh_token.length)
                writer.writeString(2, this.refresh_token);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _RefreshApiTokenRequest();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.api_key = reader.readString();
                        break;
                    case 2:
                        message.refresh_token = reader.readString();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _RefreshApiTokenRequest.deserialize(bytes);
        }
    }
    __RefreshApiTokenRequest_one_of_decls = new WeakMap();
    auth._RefreshApiTokenRequest = _RefreshApiTokenRequest;
    class _RefreshApiTokenResponse extends pb_1.Message {
        constructor(data) {
            super();
            __RefreshApiTokenResponse_one_of_decls.set(this, []);
            pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], __classPrivateFieldGet(this, __RefreshApiTokenResponse_one_of_decls, "f"));
            if (!Array.isArray(data) && typeof data == "object") {
                if ("api_key" in data && data.api_key != undefined) {
                    this.api_key = data.api_key;
                }
                if ("refresh_token" in data && data.refresh_token != undefined) {
                    this.refresh_token = data.refresh_token;
                }
                if ("endpoint" in data && data.endpoint != undefined) {
                    this.endpoint = data.endpoint;
                }
                if ("valid_until" in data && data.valid_until != undefined) {
                    this.valid_until = data.valid_until;
                }
            }
        }
        get api_key() {
            return pb_1.Message.getFieldWithDefault(this, 1, "");
        }
        set api_key(value) {
            pb_1.Message.setField(this, 1, value);
        }
        get refresh_token() {
            return pb_1.Message.getFieldWithDefault(this, 2, "");
        }
        set refresh_token(value) {
            pb_1.Message.setField(this, 2, value);
        }
        get endpoint() {
            return pb_1.Message.getFieldWithDefault(this, 3, "");
        }
        set endpoint(value) {
            pb_1.Message.setField(this, 3, value);
        }
        get valid_until() {
            return pb_1.Message.getFieldWithDefault(this, 4, 0);
        }
        set valid_until(value) {
            pb_1.Message.setField(this, 4, value);
        }
        static fromObject(data) {
            const message = new _RefreshApiTokenResponse({});
            if (data.api_key != null) {
                message.api_key = data.api_key;
            }
            if (data.refresh_token != null) {
                message.refresh_token = data.refresh_token;
            }
            if (data.endpoint != null) {
                message.endpoint = data.endpoint;
            }
            if (data.valid_until != null) {
                message.valid_until = data.valid_until;
            }
            return message;
        }
        toObject() {
            const data = {};
            if (this.api_key != null) {
                data.api_key = this.api_key;
            }
            if (this.refresh_token != null) {
                data.refresh_token = this.refresh_token;
            }
            if (this.endpoint != null) {
                data.endpoint = this.endpoint;
            }
            if (this.valid_until != null) {
                data.valid_until = this.valid_until;
            }
            return data;
        }
        serialize(w) {
            const writer = w || new pb_1.BinaryWriter();
            if (this.api_key.length)
                writer.writeString(1, this.api_key);
            if (this.refresh_token.length)
                writer.writeString(2, this.refresh_token);
            if (this.endpoint.length)
                writer.writeString(3, this.endpoint);
            if (this.valid_until != 0)
                writer.writeUint64(4, this.valid_until);
            if (!w)
                return writer.getResultBuffer();
        }
        static deserialize(bytes) {
            const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), message = new _RefreshApiTokenResponse();
            while (reader.nextField()) {
                if (reader.isEndGroup())
                    break;
                switch (reader.getFieldNumber()) {
                    case 1:
                        message.api_key = reader.readString();
                        break;
                    case 2:
                        message.refresh_token = reader.readString();
                        break;
                    case 3:
                        message.endpoint = reader.readString();
                        break;
                    case 4:
                        message.valid_until = reader.readUint64();
                        break;
                    default: reader.skipField();
                }
            }
            return message;
        }
        serializeBinary() {
            return this.serialize();
        }
        static deserializeBinary(bytes) {
            return _RefreshApiTokenResponse.deserialize(bytes);
        }
    }
    __RefreshApiTokenResponse_one_of_decls = new WeakMap();
    auth._RefreshApiTokenResponse = _RefreshApiTokenResponse;
    class UnimplementedAuthService {
    }
    UnimplementedAuthService.definition = {
        Login: {
            path: "/auth.Auth/Login",
            requestStream: false,
            responseStream: true,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _LoginRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _LoginResponse.deserialize(new Uint8Array(bytes))
        },
        GenerateApiToken: {
            path: "/auth.Auth/GenerateApiToken",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _GenerateApiTokenRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _GenerateApiTokenResponse.deserialize(new Uint8Array(bytes))
        },
        RefreshApiToken: {
            path: "/auth.Auth/RefreshApiToken",
            requestStream: false,
            responseStream: false,
            requestSerialize: (message) => Buffer.from(message.serialize()),
            requestDeserialize: (bytes) => _RefreshApiTokenRequest.deserialize(new Uint8Array(bytes)),
            responseSerialize: (message) => Buffer.from(message.serialize()),
            responseDeserialize: (bytes) => _RefreshApiTokenResponse.deserialize(new Uint8Array(bytes))
        }
    };
    auth.UnimplementedAuthService = UnimplementedAuthService;
    class AuthClient extends grpc_1.makeGenericClientConstructor(UnimplementedAuthService.definition, "Auth", {}) {
        constructor(address, credentials, options) {
            super(address, credentials, options);
            this.Login = (message, metadata, options) => {
                return super.Login(message, metadata, options);
            };
            this.GenerateApiToken = (message, metadata, options, callback) => {
                return super.GenerateApiToken(message, metadata, options, callback);
            };
            this.RefreshApiToken = (message, metadata, options, callback) => {
                return super.RefreshApiToken(message, metadata, options, callback);
            };
        }
    }
    auth.AuthClient = AuthClient;
})(auth = exports.auth || (exports.auth = {}));
