import { DesignSystem } from '@ni/fast-foundation';
import { RichTextMention } from '../base';
import { MappingUserConfig } from './models/mapping-user-config';
import { template } from '../base/template';
import { iconAtTag } from '../../icons/at';
import { MappingUser } from '../../mapping/user';
import { RichTextMentionUsersValidator } from './models/rich-text-mention-users-validator';
import { richTextMentionUsersViewTag } from './view';
import { styles } from '../base/styles';
/**
 * Rich Text user mention configuration element which will have MappingMentionUser elements as children
 */
export class RichTextMentionUsers extends RichTextMention {
    getMentionInternalsOptions() {
        return {
            icon: iconAtTag,
            character: '@',
            viewElement: richTextMentionUsersViewTag,
            validator: new RichTextMentionUsersValidator()
        };
    }
    getObservedMappingProperty() {
        return ['key', 'displayName'];
    }
    createMappingConfig(mapping) {
        if (mapping instanceof MappingUser) {
            return new MappingUserConfig(mapping.key, mapping.displayName);
        }
        // Getting here would indicate a programming error, b/c validation will prevent
        // this function from running when there is an unsupported mapping.
        throw new Error('Unsupported mapping');
    }
}
const nimbleRichTextMentionUsers = RichTextMentionUsers.compose({
    baseName: 'rich-text-mention-users',
    template,
    styles
});
DesignSystem.getOrCreate()
    .withPrefix('nimble')
    .register(nimbleRichTextMentionUsers());
export const richTextMentionUsersTag = 'nimble-rich-text-mention-users';
//# sourceMappingURL=index.js.map