import type { ShareAppMessageReturn } from '@tarojs/taro';

import { PageUrl } from '@/constants/app';

import { getJumpUrl } from './route';

const imageUrl = 'https://neighbourhood.cn/share_d.jpg';

const getRandomCount = () => {
  const date = new Date();
  const year = date.getFullYear();
  const month = date.getMonth();
  const day = date.getDate();
  const seed = (year + month + day) * day;
  return (seed % 300) + 500;
};

export const getCommonShareMessage = (useCapture: boolean = true): ShareAppMessageReturn => {
  return {
    title: `昨天新增了${getRandomCount()}条主播通告，宝子快来看看`,
    path: getJumpUrl(PageUrl.Job),
    imageUrl: useCapture ? undefined : imageUrl,
  };
};
