import { View, Text } from "@tarojs/components";
import { genNTRPRequirementText } from "@/utils/helper";
import styles from "./index.module.scss";

// 玩法要求
export default function GamePlayAndRequirement(props) {
  const {
    detail: { skill_level_min, skill_level_max, play_type, game_type },
  } = props;

  const requirements = [
    {
      title: "NTRP水平要求",
      desc: genNTRPRequirementText(skill_level_min, skill_level_max),
    },
    {
      title: "活动玩法",
      desc: play_type || "-",
    },
    {
      title: "人员构成",
      desc: game_type || "-",
    },
  ];
  return (
    <View className={styles["detail-page-content-gameplay-requirements"]}>
      {/* title */}
      <View className={styles["gameplay-requirements-title"]}>
        <Text>玩法要求</Text>
      </View>
      {/* requirements */}
      <View className={styles["gameplay-requirements"]}>
        {requirements.map((item, index) => (
          <View key={index} className={styles["gameplay-requirements-item"]}>
            <Text className={styles["gameplay-requirements-item-title"]}>
              {item.title}
            </Text>
            <Text className={styles["gameplay-requirements-item-desc"]}>
              {item.desc}
            </Text>
          </View>
        ))}
      </View>
    </View>
  );
}
