import { View, ViewStyle } from "react-native";
import { SelectButtonType } from "../../../App/common/constants";
import { styles } from "./SelectButtonStyles";

interface SelectButtonProps {
  selected?: boolean;
  type?: string;
  buttonStyle?: ViewStyle;
}

const RadioButton = ({ selected, buttonStyle }: SelectButtonProps) => {
  return (
    <View
      style={[
        styles.radioButton,
        buttonStyle,
        selected && styles.selectedRadioButton,
      ]}
    >
      {selected && <View style={styles.innerRadio} />}
    </View>
  );
};

const SelectButton = ({ selected, type, buttonStyle }: SelectButtonProps) => {
  switch (type) {
    case SelectButtonType.RADIO:
      return <RadioButton selected={selected} buttonStyle={buttonStyle} />;
    default:
      return <RadioButton selected={selected} buttonStyle={buttonStyle} />;
  }
};

export default SelectButton;
