import { ref } from 'vue'

const isOpen = ref(false)
const activeUserId = ref<number | null>(null)

export function useUserProfileModal() {
  const openUserProfile = (userId: number) => {
    if (!userId) return
    activeUserId.value = userId
    isOpen.value = true
  }

  const closeUserProfile = () => {
    isOpen.value = false
    activeUserId.value = null
  }

  return {
    isOpen,
    activeUserId,
    openUserProfile,
    closeUserProfile,
  }
}
