"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildLocalSessionLoginData = exports.buildRdpSessionLoginData = void 0;
const config_1 = require("../config");
const get_position_1 = require("./get-position");
/**
 * Build login message object for Platform Session RDP streaming connection
 *
 * @param params Parameters for Platform Session authentication for streaming connection
 */
function buildRdpSessionLoginData(params) {
    const { dacs = {}, accessToken, userName } = params;
    return {
        applicationId: dacs.applicationId,
        position: dacs.position || (0, get_position_1.getPosition)(),
        authenticationToken: accessToken,
        name: dacs.userName || userName,
        nameType: 'AuthnToken',
    };
}
exports.buildRdpSessionLoginData = buildRdpSessionLoginData;
/**
 * Build login message object for Platform Session local streaming connection
 */
function buildLocalSessionLoginData(dacs = {}) {
    const trepDacsConfig = config_1.config.get('sessions').platform['default-session']['realtime-distribution-system'].dacs;
    return {
        applicationId: dacs.applicationId || trepDacsConfig['application-id'],
        position: dacs.position || trepDacsConfig.position,
        name: dacs.userName || trepDacsConfig.username,
    };
}
exports.buildLocalSessionLoginData = buildLocalSessionLoginData;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyZWFtLWxvZ2luLXJlcXVlc3QtY29udmVydGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3V0aWwvc3RyZWFtLWxvZ2luLXJlcXVlc3QtY29udmVydGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBLHNDQUFtQztBQUduQyxpREFBNkM7QUFFN0M7Ozs7R0FJRztBQUNILFNBQWdCLHdCQUF3QixDQUFDLE1BQXFCO0lBQzFELE1BQU0sRUFBRSxJQUFJLEdBQUcsRUFBRSxFQUFFLFdBQVcsRUFBRSxRQUFRLEVBQUUsR0FBRyxNQUFNLENBQUM7SUFFcEQsT0FBTztRQUNILGFBQWEsRUFBRSxJQUFJLENBQUMsYUFBYTtRQUNqQyxRQUFRLEVBQUUsSUFBSSxDQUFDLFFBQVEsSUF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