import useTranslate from '~hooks/useTranslate/useTranslate';
import { getApiQueryParams } from '../../../helpers/sportstake';
import { generateCustomHeadings } from '../../../helpers/lotto';

export function getSportstakeFixtureProps({ module, serverData }) {
  const moduleName = module?.name;
  const query = getApiQueryParams(moduleName);
  module.module_title = useTranslate(`${moduleName}_title`, query.title);
  module.module_introduction = useTranslate(`${moduleName}_desc`, null);

  return {
    serverData: { ...serverData?.fixtures },
  };
}

export function getSportstakeResultProps({ module, serverData }) {
  const moduleName = module?.name;
  const query = getApiQueryParams(moduleName);
  module.module_title = useTranslate(`${moduleName}_title`, query.title);
  module.module_introduction = useTranslate(`${moduleName}_desc`, null);

  return {
    serverData: { ...serverData?.results },
  };
}

export function getLottoProps({ module, serverData }) {
  const moduleName = module?.name;
  module.module_title = useTranslate(`${moduleName}_title`, generateCustomHeadings(moduleName));
  module.module_introduction = useTranslate(`${moduleName}_desc`, null);

  return {
    serverData: serverData?.lotto?.data?.find((x) => x?.name === moduleName)?.result,
  };
}
