import { type FC } from 'react'
import type { FormikProps } from 'formik'
import { Checkbox } from '@/components/ui/checkbox'
import type { CreateFoodType } from '../types/Types'

type WeekDaysSectionProps = {
  formik: FormikProps<CreateFoodType>
}

const WeekDaysSection: FC<WeekDaysSectionProps> = ({ formik }) => {
  const weekDays = [
    { key: 'sat', label: 'شنبه' },
    { key: 'sun', label: 'یکشنبه' },
    { key: 'mon', label: 'دوشنبه' },
    { key: 'tue', label: 'سه‌شنبه' },
    { key: 'wed', label: 'چهارشنبه' },
    { key: 'thu', label: 'پنج‌شنبه' },
    { key: 'fri', label: 'جمعه' }
  ] as const

  return (
    <div className='mt-6'>
      <div className='text-sm mb-3'>روزهای هفته</div>
      <div className='flex gap-6 flex-wrap'>
        {weekDays.map((day) => (
          <div key={day.key} className='flex items-center gap-2'>
            <Checkbox
              checked={formik.values[day.key]}
              onCheckedChange={(checked) => formik.setFieldValue(day.key, checked)}
            />
            <label className='text-xs cursor-pointer'>{day.label}</label>
          </div>
        ))}
      </div>
    </div>
  )
}

export default WeekDaysSection

