import '@material/web/icon/icon.js';
import '@operato/i18n/ox-i18n.js';
import { html } from 'lit-html';
import { navigate, store } from '@operato/shell';
import { ADD_MORENDA } from '@things-factory/more-base/client';
import { hasPrivilege } from '@things-factory/auth-base/dist-client';
export * from './components/role-selector.js';
export * from './components/domain-switch.js';
export * from './components/invite-user.js';
export async function setAuthManagementMenus(options) {
    const { role = true, appliance = true, application = true, user = true, authProvider = true, domain = true, attribute = true } = options || {};
    if (await hasPrivilege({ privilege: 'mutation', category: 'user', domainOwnerGranted: true, superUserGranted: true })) {
        role &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>how_to_reg</md-icon> `,
                    name: html ` <ox-i18n msgid="text.role_management"></ox-i18n> `,
                    action: () => {
                        navigate('roles');
                    }
                }
            });
        appliance &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>devices</md-icon> `,
                    name: html ` <ox-i18n msgid="text.appliance"></ox-i18n> `,
                    action: () => {
                        navigate('appliance-home');
                    }
                }
            });
        application &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>apps</md-icon> `,
                    name: html ` <ox-i18n msgid="text.application management"></ox-i18n> `,
                    action: () => {
                        navigate('applications');
                    }
                }
            });
        user &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>people</md-icon> `,
                    name: html ` <ox-i18n msgid="text.user management"></ox-i18n> `,
                    action: () => {
                        navigate('users');
                    }
                }
            });
        authProvider &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>id_card</md-icon> `,
                    name: html ` <ox-i18n msgid="text.auth-provider management"></ox-i18n> `,
                    action: () => {
                        navigate('auth-providers');
                    }
                }
            });
    }
    if (await hasPrivilege({ superUserGranted: true })) {
        domain &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>business</md-icon> `,
                    name: html ` <ox-i18n msgid="text.domain management"></ox-i18n> `,
                    action: () => {
                        navigate('domains');
                    }
                }
            });
        attribute &&
            store.dispatch({
                type: ADD_MORENDA,
                morenda: {
                    icon: html ` <md-icon>dataset</md-icon> `,
                    name: html ` <ox-i18n msgid="text.attribute management"></ox-i18n> `,
                    action: () => {
                        navigate('attributes');
                    }
                }
            });
    }
}
//# sourceMappingURL=index.js.map