import ChoiceSetting from "@/components/settings/ChoiceSetting";
import SettingsCard from "@/components/settings/SettingsCard";
import SwitchSetting from "@/components/settings/SwitchSetting";
import { __ } from "@wordpress/i18n";
import { COOKIE_DAYS } from "../constants";

/**
 * General › Shoppers and storage. "Only logged-in shoppers" is Pro and
 * lives in the Rules tab.
 */
const StorageSection = () => (
  <SettingsCard
    title={__("Shoppers and storage", "product-comparison-for-woocommerce")}
    description={__(
      "How long a shopper's list is kept.",
      "product-comparison-for-woocommerce",
    )}
  >
    <SwitchSetting
      path="general.merge_on_login"
      title={__(
        "Keep the list after login",
        "product-comparison-for-woocommerce",
      )}
      description={__(
        "A guest's products move into their account.",
        "product-comparison-for-woocommerce",
      )}
    />
    <SwitchSetting
      path="general.hide_on_cart_checkout"
      title={__(
        "Hide on cart and checkout",
        "product-comparison-for-woocommerce",
      )}
      description={__(
        "Keeps checkout focused.",
        "product-comparison-for-woocommerce",
      )}
    />
    <ChoiceSetting
      path="general.cookie_days"
      title={__(
        "Keep a guest's list for",
        "product-comparison-for-woocommerce",
      )}
      description={__(
        "Stored in a signed cookie. No database writes for guests.",
        "product-comparison-for-woocommerce",
      )}
      options={COOKIE_DAYS}
    />
  </SettingsCard>
);

export default StorageSection;
