"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _enums = require("../../../enums");
var _BehaviourProvider = require("../../../providers/BehaviourProvider");
var _native = require("@react-navigation/native");
var _TargetSelectionPage = _interopRequireDefault(require("../../../components/TargetSelectionPage/TargetSelectionPage"));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const AmityLivestreamPostTargetSelectionPage = () => {
  const {
    AmityLivestreamPostTargetSelectionPageBehavior
  } = (0, _BehaviourProvider.useBehaviour)();
  const navigation = (0, _native.useNavigation)();
  const onSelectFeed = ({
    targetId,
    targetType,
    targetName,
    community
  }) => {
    const context = {
      pop: 2,
      targetId,
      targetType,
      targetName: targetType === 'community' ? community === null || community === void 0 ? void 0 : community.displayName : targetName
    };
    if (AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage) {
      return AmityLivestreamPostTargetSelectionPageBehavior.goToCreateLivestreamPage(context);
    }
    navigation.navigate('CreateLivestream', context);
  };
  const onClickClose = () => {
    if (AmityLivestreamPostTargetSelectionPageBehavior !== null && AmityLivestreamPostTargetSelectionPageBehavior !== void 0 && AmityLivestreamPostTargetSelectionPageBehavior.onClickClose) {
      AmityLivestreamPostTargetSelectionPageBehavior.onClickClose();
    }
  };
  return /*#__PURE__*/_react.default.createElement(_TargetSelectionPage.default, {
    onSelectFeed: onSelectFeed,
    pageId: _enums.PageID.livestream_post_target_selection_page,
    onClickClose: onClickClose
  });
};
var _default = exports.default = /*#__PURE__*/_react.default.memo(AmityLivestreamPostTargetSelectionPage);
//# sourceMappingURL=TargetSelection.js.map