import SettingRow from "@/components/settings/SettingRow";
import SwitchSetting from "@/components/settings/SwitchSetting";
import { Switch } from "@/components/ui/switch";
import { IS_PRO } from "@/lib/env";
import { PRO_BEHAVIOURS } from "../constants";

/**
 * Pro rows of Table behaviour. Rows with a settings `path` are real
 * switches (locked in Free); the rest are previews of features to come.
 */
const ProBehaviours = () =>
  PRO_BEHAVIOURS.map((item) =>
    item.path ? (
      <SwitchSetting
        key={item.key}
        path={item.path}
        pro
        title={item.title}
        description={item.description}
      />
    ) : (
      <SettingRow
        key={item.key}
        id={`pcfw-pro-${item.key}`}
        title={item.title}
        description={item.description}
        pro
        locked={!IS_PRO}
      >
        <Switch
          aria-labelledby={`pcfw-pro-${item.key}`}
          checked={false}
          disabled={!IS_PRO}
        />
      </SettingRow>
    ),
  );

export default ProBehaviours;
