declare module 'tag-users/constants' {
  export const KEYS: {
    AT_SIGN: string;
    BACKSPACE: string;
    SPACE: string;
    ENTER: string;
    NO_TEXT: string;
  };

  export const COMPONENT_TYPES: {
    NORMAL_TEXT: 'NORMAL_TEXT';
    PROFILE_LINK: 'PROFILE_LINK';
  };
}

declare module 'tag-users' {
  export type ParagraphComponent = {
    text: string;
    [key: string]: any;
  };

  export function getParagraphs(
    body: string,
    bodyAttributes?: any,
  ): ParagraphComponent[][];

  export type SpyIfWritingTaggedUserParams = {
    text: string;
    tagUser: boolean;
    setTagUser: (value: boolean) => void;
    value: string;
    userSearch: string;
    setUserSearch: (value: string | ((prev: string) => string)) => void;
    taggedUsers: Array<{
      start: number;
      length: number;
      type: {
        user: {
          id: number;
        };
      };
    }>;
    onChangeText: (text: string) => void;
    messageBodyWithoutLastTag: string;
    setMessageBodyWithoutLastTag: (value: string) => void;
    setTagUserStartPosition: (value: number) => void;
    changeTaggedUserStartPosition: (
      userId: number,
      newStartPosition: number,
    ) => void;
    deleteTaggedUser: (userId: number) => void;
    selectedText: string;
    startPositionSelectedText: number;
    endPositionSelectedText: number;
    lastKey: string | null;
    browserFirefoxFlag: boolean;
  };

  export function spyIfWritingTaggedUser(
    params: SpyIfWritingTaggedUserParams,
  ): void;

  export type TagNewUserParams = {
    user: {
      id: number;
      firstName: string;
      lastName: string;
    };
    setTagUser: (value: boolean) => void;
    setUserSearch: (value: string) => void;
    taggedUsers: Array<{
      start: number;
      length: number;
      type: {
        user: {
          id: number;
        };
      };
    }>;
    onChangeText: (text: string) => void;
    messageBodyWithoutLastTag: string;
    setMessageBodyWithoutLastTag: (value: string) => void;
    tagUserStartPosition: number;
    addTaggedUser: (taggedUser: {
      start: number;
      length: number;
      type: {
        user: {
          id: number;
        };
      };
    }) => void;
    changeTaggedUserStartPosition: (
      userId: number,
      newStartPosition: number,
    ) => void;
    isWeb?: boolean;
  };

  export function tagNewUser(params: TagNewUserParams): void;
}
