import React from "react";
import { PreferencePriceGroupProps } from "./interface";
import { Switch } from "@atomintl/aui-next";
import "./index.css";

const PreferencePriceGroup: React.FC<PreferencePriceGroupProps> = props => {
  const { options } = props;

  return (
    <>
      {options.map((item, index) => (
        <div key={index} className="nts-preference-price">
          <label className="nts-preference-price-label">{item.label}</label>
          <Switch
            checked={!!item.checked}
            disabled={item.disabled || false}
            onChange={event => props.onChange?.(event?.target?.checked, item.key)}
          />
        </div>
      ))}
    </>
  );
};

PreferencePriceGroup.defaultProps = {};

export { PreferencePriceGroupProps } from "./interface";

export default PreferencePriceGroup;
