'use client'

import { request } from '@/utils'
import { IBaseResponse } from '@/@core/types/api'
import { IEntityProfile } from '@/types/data/profile/profile.interface'
import { useCustomMutation } from '@/hooks/api'

type UpdateOrderTypesPayload = {
  accepts_dine_in: boolean
  accepts_takeaway: boolean
  accepts_delivery: boolean
}

export const useUpdateOrderTypes = () => {
  return useCustomMutation<UpdateOrderTypesPayload, IBaseResponse<IEntityProfile>>(
    ['profile-update-order-types'],
    async payload => {
      const res = await request({
        url: '/entity/update-order-types',
        method: 'POST',
        data: payload
      })
      return res.data
    }
  )
}
