import React, { useState } from 'react';
import { TenantSelectionSelect } from './select/index.js';
import { TenantSelectionOverview } from './Overview.js';
import { TenantSelectionLoadingState } from './Loading.js';
import { TenantSelectionContainer } from './Container.js';

var TenantSelection = function (_a) {
    var user = _a.user, _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, selectTenant = _a.selectTenant, language = _a.language;
    var _c = useState({
        showSelection: false,
        selectedTenant: null,
        persistSelection: true,
    }), tenantSelection = _c[0], setTenantSelection = _c[1];
    if (!user || !user.forceTenantSelection)
        return null;
    if (isLoading) {
        return (React.createElement(TenantSelectionContainer, { language: language },
            React.createElement(TenantSelectionLoadingState, null)));
    }
    if (tenantSelection.showSelection) {
        return (React.createElement(TenantSelectionContainer, { language: language },
            React.createElement(TenantSelectionSelect, { user: user, tenantSelection: tenantSelection, setTenantSelection: setTenantSelection })));
    }
    return (React.createElement(TenantSelectionContainer, { language: language },
        React.createElement(TenantSelectionOverview, { user: user, tenantSelection: tenantSelection, setTenantSelection: setTenantSelection, selectTenant: selectTenant })));
};

export { TenantSelection as default };
//# sourceMappingURL=index.js.map
