import { PostTargetType } from '../../../../../enums/postTargetType';
import { livestream, poll, post } from '../../../../../../core/assets/icons';
import { useBottomSheet } from '../../../../../../core/stores/slices/bottomSheetSlice';
import { FloatingActionButton } from '../../../../../components';
import MenuAction from '../../../../../elements/MenuAction';
import { useBehaviour } from '../../../../../providers/BehaviourProvider';
import { AmityPostComposerMode } from '../../../../../types';
import { useNavigation } from '@react-navigation/native';
import useAuth from '../../../../../../core/hooks/useAuth';
export function Action({
  userId
}) {
  const {
    openBottomSheet,
    closeBottomSheet
  } = useBottomSheet();
  const {
    AmityUserProfilePageBehavior
  } = useBehaviour();
  const navigation = useNavigation();
  const {
    client
  } = useAuth();
  if ((client === null || client === void 0 ? void 0 : client.userId) !== userId) return null;
  return /*#__PURE__*/React.createElement(FloatingActionButton, {
    onPress: () => {
      openBottomSheet({
        height: 240,
        content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MenuAction, {
          gap: "small",
          label: "Post",
          iconProps: {
            xml: post()
          },
          onPress: () => {
            closeBottomSheet();
            if (AmityUserProfilePageBehavior !== null && AmityUserProfilePageBehavior !== void 0 && AmityUserProfilePageBehavior.goToPostComposerPage) {
              var _AmityUserProfilePage;
              AmityUserProfilePageBehavior === null || AmityUserProfilePageBehavior === void 0 || (_AmityUserProfilePage = AmityUserProfilePageBehavior.goToPostComposerPage) === null || _AmityUserProfilePage === void 0 || _AmityUserProfilePage.call(AmityUserProfilePageBehavior, {
                mode: AmityPostComposerMode.CREATE,
                targetId: userId,
                targetType: PostTargetType.user
              });
            } else {
              navigation.navigate('CreatePost', {
                mode: AmityPostComposerMode.CREATE,
                targetId: userId,
                targetType: PostTargetType.user
              });
            }
          }
        }), /*#__PURE__*/React.createElement(MenuAction, {
          gap: "small",
          label: "Poll",
          iconProps: {
            xml: poll()
          },
          onPress: () => {
            closeBottomSheet();
            if (AmityUserProfilePageBehavior !== null && AmityUserProfilePageBehavior !== void 0 && AmityUserProfilePageBehavior.goToPollPostComposerPage) {
              var _AmityUserProfilePage2;
              AmityUserProfilePageBehavior === null || AmityUserProfilePageBehavior === void 0 || (_AmityUserProfilePage2 = AmityUserProfilePageBehavior.goToPollPostComposerPage) === null || _AmityUserProfilePage2 === void 0 || _AmityUserProfilePage2.call(AmityUserProfilePageBehavior, {
                targetId: userId,
                targetType: 'user'
              });
            } else {
              navigation.navigate('PollPostComposer', {
                targetId: userId,
                targetType: PostTargetType.user
              });
            }
          }
        }), /*#__PURE__*/React.createElement(MenuAction, {
          gap: "small",
          label: "Livestream",
          iconProps: {
            xml: livestream()
          },
          onPress: () => {
            closeBottomSheet();
            if (AmityUserProfilePageBehavior !== null && AmityUserProfilePageBehavior !== void 0 && AmityUserProfilePageBehavior.goToCreateLivestreamPage) {
              var _AmityUserProfilePage3;
              AmityUserProfilePageBehavior === null || AmityUserProfilePageBehavior === void 0 || (_AmityUserProfilePage3 = AmityUserProfilePageBehavior.goToCreateLivestreamPage) === null || _AmityUserProfilePage3 === void 0 || _AmityUserProfilePage3.call(AmityUserProfilePageBehavior, {
                targetId: userId,
                targetType: 'user',
                targetName: 'My timeline'
              });
            } else {
              navigation.navigate('CreateLivestream', {
                targetId: userId,
                targetType: PostTargetType.user,
                targetName: 'My timeline'
              });
            }
          }
        }))
      });
    }
  });
}
//# sourceMappingURL=Action.js.map