import { TeamStatItem } from 'requests'
import { StatsLexicType } from './getStatsLexic'

type StatsItemType = StatsLexicType & {
  paramId: number,
}
export const getStatItemById = ({
  matchProfile,
  paramId,
  stats,
}: StatsItemType) => {
  if (!matchProfile) return null

  return stats[matchProfile?.team2.id]
    .find(({ param1 }: TeamStatItem) => param1.id === paramId) || null
}
