

import React from 'react'
import LayoutModal from '../../Layout/Dashboard/LayoutModal'
import FormSocialMedia from './FormSocialMedia'
import { useAddSocialMedia } from '../../api/SocialMedia'
import { getDataToSend, getInitialValues, getValidationSchema } from './formUtil'
import { QueryStatusEnum } from '../../config/QueryStatus'
import { useTranslation } from 'react-i18next'

function AddSocialMediaModal() {
  const [t] = useTranslation()
  const {mutate , status} = useAddSocialMedia()
  const handelSubmit = (values:any )=>{
    console.log(values);
    values['is_active'] = values['is_active'] == 1 ? 1 :0
    // delete values['id']
    
    const dataToSend = getDataToSend(values)
    mutate(dataToSend)

    // Submit Value
  }
  return (
    <LayoutModal
     isAddModal={true}
     getInitialValues={getInitialValues()} 
     handleSubmit={handelSubmit} 
     status={status as QueryStatusEnum}
     headerText={t('Add') +t('SocialMedia')}
     getValidationSchema={getValidationSchema()}>

    <FormSocialMedia />
  </LayoutModal>
  )
}

export default AddSocialMediaModal

