
import React, { useEffect } from 'react'
import { Col, Row } from 'reactstrap';
import ValidationField from '../../../Components/ValidationField/ValidationField';
import { useGetUsers } from '../../../api/users';
import { useFormikContext } from 'formik';

function Form() {
  const useFormatToSelect = (Data : any) => {
    const format = (data :any) => {
      if (!data) return [];
      return data.map((item :any) => ({
        value: item?.id,
        label: item?.name,
      }));
    };
  
    return format(Data);
  };
  const { data: user } = useGetUsers()

  const SelectData = useFormatToSelect(user?.data)



  return (
    <Row xs={1} sm={1} md={1} lg={2} xl={2}>
    <Col>

    <ValidationField name="id" label='user' placeholder='user' type="Search" option={SelectData} searchBy={"name"}  />

    <ValidationField name="whatsApp"  />

    </Col>
    <Col>

    <ValidationField name="subject" />
    <ValidationField name="message"   type='TextArea'/>

    </Col>


   
  </Row>
  )
}

export default Form


