import { useQueryClient } from 'react-query'

import { querieKeys } from 'config'

import type { MatchScore } from 'requests'

import { useMatchPageStore } from 'features/MatchPage/store'

export const useVideoBounds = () => {
  const { profile: matchProfile } = useMatchPageStore()

  const client = useQueryClient()

  const matchScore = client.getQueryData<MatchScore>(querieKeys.matchScore)

  const videoBounds = matchScore?.video_bounds || matchProfile?.video_bounds

  return videoBounds
}
