/* eslint-disable react/jsx-props-no-spreading */
import React, { FunctionComponent } from 'react';
import omit from 'lodash/omit';

import { StyledSwitch } from './styled-component';
import { useTheme } from '../Theme';
import { SwitchProps } from './types.d';

/**
 *
 * @param color -  "primaryColor" | "primaryLight" | "secondaryColor" | "white" | "lightGreen" | "gray" | "gray20" | "orange" | "purple" | "yellow" | "pink" | "green" | "blue"
 * @param customColor - only hex colors
 * @param circleColor - pallet colors
 * @returns
 */

export const Switch: FunctionComponent<SwitchProps> = (props) => {
  const { size = 'small', color = 'primaryColor', customColor, circleColor } = props;
  const theme = useTheme();
  return (
    <StyledSwitch
      $theme={theme}
      $size={size}
      $color={color}
      $customColor={customColor}
      $circleColor={circleColor}
      {...omit(props, 'size', 'color', 'customColor', 'circleColor')}
    />
  );
};
