"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class StateService {
    constructor() {
        this.defaultOpts = {
            logging: false,
            memberNodePath: '/api/',
            port: 80,
            walletNodePath: '/api/',
        };
        this.transport = 'socket';
        this.detected = false;
        this.detectResults = {};
        this.authed = false;
        this.restInitialised = false;
        this.socketsInitialised = false;
        this._opts = this.defaultOpts;
        this.TOKEN = null;
    }
    get opts() { return this._opts; }
    set opts(opts) {
        this._opts = this.validateOpts(opts);
    }
    validateOpts(opts) {
        let options = opts;
        if (options === undefined) {
            options = this.defaultOpts;
        }
        if (options.logging === undefined) {
            options.logging = this.defaultOpts.logging;
        }
        if (options.memberNodePath === undefined) {
            options.memberNodePath = this.defaultOpts.memberNodePath;
        }
        if (options.port === undefined) {
            options.port = this.defaultOpts.port;
        }
        if (options.walletNodePath === undefined) {
            options.walletNodePath = this.defaultOpts.walletNodePath;
        }
        return options;
    }
    get token() { return this.TOKEN; }
    set token(token) {
        this.TOKEN = token;
    }
}
exports.StateService = StateService;
