import React, { Dispatch, SetStateAction } from 'react'
import { TripOption } from '@/lib/types/fastboat'

interface TripProps {
  trip: TripOption
  setTrip: Dispatch<SetStateAction<TripOption>>
}

const SelectTrip: React.FC<TripProps> = (props) => {
  return (
    <div className="flex gap-2 bg-gray-100 p-2 rounded-full w-full md:max-w-fit">
      <button
        type="button"
        onClick={() => props.setTrip('ONE_WAY')}
        className={`px-4 text-sm sm:text-base py-2 rounded-full w-full cursor-pointer font-medium duration-300 transition-colors ease-in-out min-w-fit ${
          props.trip === 'ONE_WAY'
            ? 'bg-black text-white'
            : 'bg-gray-100 hover:bg-gray-50'
        }`}
      >
        ONE WAY
      </button>
      <button
        type="button"
        onClick={() => props.setTrip('RETURN')}
        className={`px-4 py-2 text-sm sm:text-base rounded-full w-full cursor-pointer font-medium transition-colors duration-300 ease-in-out min-w-fit ${
          props.trip === 'RETURN'
            ? 'bg-black text-white'
            : 'bg-gray-100 hover:bg-black hover:text-white'
        }`}
      >
        RETURN
      </button>
    </div>
  )
}

export default SelectTrip
