import { useCallback } from 'react';
import { FileRepository } from '@amityco/ts-sdk-react-native';
import { ImageSizeState } from '../enums/imageSizeState';
import { defaultAvatarUri, defaultCommunityAvatarUri } from '../../core/assets/index';
export const useFile = () => {
  const getImage = useCallback(async ({
    fileId,
    imageSize = ImageSizeState.medium,
    type = 'user'
  }) => {
    if (!fileId) return type === 'community' ? defaultCommunityAvatarUri : defaultAvatarUri;
    const file = await FileRepository.getFile(fileId);
    if (!file) return type === 'community' ? defaultCommunityAvatarUri : defaultAvatarUri;
    const newImageUrl = FileRepository.fileUrlWithSize(file.data.fileUrl, imageSize) ?? (type === 'community' ? defaultCommunityAvatarUri : defaultAvatarUri);
    return newImageUrl;
  }, []);
  return {
    getImage
  };
};
//# sourceMappingURL=useFile.js.map