"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.capitalize = capitalize;
exports.serializeCommunity = exports.isValidImageType = exports.isPinnedPost = exports.getFileUrlWithSize = void 0;
var _tsSdkReactNative = require("@amityco/ts-sdk-react-native");
const isValidImageType = mimeType => {
  if (!mimeType) return false;
  const validTypes = ['image/png', 'image/jpeg', 'image/jpg'];
  return validTypes.includes(mimeType.toLowerCase());
};
exports.isValidImageType = isValidImageType;
const getFileUrlWithSize = (fileUrl, size = 'medium') => _tsSdkReactNative.FileRepository.fileUrlWithSize(fileUrl, size);
exports.getFileUrlWithSize = getFileUrlWithSize;
function capitalize(value) {
  return value.charAt(0).toUpperCase() + value.slice(1);
}
const isPinnedPost = post => {
  return post.pinnedAt !== undefined;
};

/**
 * Strips non-serializable properties (functions, class instances) from an
 * Amity.Community SDK object before passing it as a React Navigation param.
 * React Navigation warns when navigation state contains non-serializable
 * values; SDK objects can contain methods such as `createInvitations`.
 */
exports.isPinnedPost = isPinnedPost;
const serializeCommunity = community => {
  if (!community) return undefined;
  return {
    communityId: community.communityId,
    displayName: community.displayName,
    isPublic: community.isPublic,
    isJoined: community.isJoined,
    isOfficial: community.isOfficial,
    postSetting: community.postSetting,
    allowCommentInStory: community.allowCommentInStory,
    avatarFileId: community.avatarFileId,
    description: community.description,
    membersCount: community.membersCount,
    postsCount: community.postsCount,
    needApprovalOnPostCreation: community.needApprovalOnPostCreation
  };
};
exports.serializeCommunity = serializeCommunity;
//# sourceMappingURL=index.js.map