import { Switch as RNSwitch, type ViewStyle } from 'react-native'
import { GREEN, TEXT } from '@/src/shared/constants/colors'

export interface NativeSwitchProps {
  value: boolean
  onValueChange?: (value: boolean) => void
  color?: string
  disabled?: boolean
  style?: ViewStyle
  testID?: string
}

export function NativeSwitch(props: NativeSwitchProps) {
  const { value, onValueChange, color, disabled, style } = props
  return (
    <RNSwitch
      value={value}
      onValueChange={onValueChange}
      trackColor={{ false: TEXT.DISABLED, true: color ?? GREEN[500] }}
      thumbColor={TEXT.PRIMARY}
      disabled={disabled}
      style={style}
    />
  )
}
