"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useUserProfile = useUserProfile;
var _react = require("react");
var _objects = require("../../../../hooks/objects");
var _types = require("../types");
var _styles = require("../styles");
var _useAuth = _interopRequireDefault(require("../../../../../core/hooks/useAuth"));
var _hooks = require("../../../../hooks");
var _enums = require("../../../../enums");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function useUserProfile(userId) {
  const styles = (0, _styles.useStyles)();
  const feedRef = (0, _react.useRef)(null);
  const scrollRef = (0, _react.useRef)(null);
  const {
    client
  } = (0, _useAuth.default)();
  const isMyProfile = (client === null || client === void 0 ? void 0 : client.userId) === userId;
  const {
    user,
    isLoading
  } = (0, _objects.useUser)({
    userId
  });
  const {
    followInfo
  } = (0, _objects.useFollowInfo)({
    userId,
    enabled: !isMyProfile
  });
  const isBlockedByMe = (followInfo === null || followInfo === void 0 ? void 0 : followInfo.status) === 'blocked';
  const [headerHeight, setHeaderHeight] = (0, _react.useState)(0);
  const [isTabSticky, setIsTabSticky] = (0, _react.useState)(false);
  const [activeTab, setActiveTab] = (0, _react.useState)(_types.UserProfileTab.Feed);
  const pageId = _enums.PageID.user_profile_page;
  const {
    accessibilityId
  } = (0, _hooks.useAmityPage)({
    pageId
  });
  const {
    accessibilityId: feedTabId
  } = (0, _hooks.useAmityElement)({
    pageId,
    componentId: _enums.ComponentID.WildCardComponent,
    elementId: _enums.ElementID.user_feed_tab_button
  });
  const {
    accessibilityId: imageTabId
  } = (0, _hooks.useAmityElement)({
    pageId,
    componentId: _enums.ComponentID.WildCardComponent,
    elementId: _enums.ElementID.user_image_feed_tab_button
  });
  const {
    accessibilityId: videoTabId
  } = (0, _hooks.useAmityElement)({
    pageId,
    componentId: _enums.ComponentID.WildCardComponent,
    elementId: _enums.ElementID.user_video_feed_tab_button
  });
  return {
    user,
    isUserLoading: isLoading,
    isBlockedByMe,
    activeTab,
    setActiveTab,
    styles,
    feedRef,
    scrollRef,
    headerHeight,
    setHeaderHeight,
    isTabSticky,
    setIsTabSticky,
    accessibilityId,
    feedTabId,
    imageTabId,
    videoTabId
  };
}
//# sourceMappingURL=useUserProfile.js.map