'use client'

import { IBaseResponse, CustomUseQueryOptions } from '@/@core/types/api'
import { useCustomQuery } from '@/hooks/api'
import { IEntityProfile } from '@/types/data/profile/profile.interface'
import { request } from '@/utils'

export const ENTITY_PROFILE_QUERY_KEY = 'entity-profile'

export const useGetEntityProfile = (options?: CustomUseQueryOptions<IBaseResponse<IEntityProfile>>) => {
  const queryKey = [ENTITY_PROFILE_QUERY_KEY]

  const profile = useCustomQuery<IBaseResponse<IEntityProfile>>(
    queryKey,
    () => request({ url: '/entity/profile', method: 'GET' }),
    options
  )

  return profile
}
