import api from './axios';

// For More Details: docs.faceki.com

export const submitKYCRequest = async (body: FormData) => {
  try {

    const response = await api.post(
      `/api/v3/kyc_verification/requestbylink`,
      body,
      {
        headers: {
          'Content-Type': 'multipart/form-data',
        },
      },
    );

    return response?.data;
  } catch (err) {
    const error = err as unknown as Error;
    console.log(error, error.name, error.message);
    throw err;
  }
};

export const getWorkflowInfoByLink = async (verificationUrl:string) =>
{
  try {
    const response = await api.get(`/api/v3/workflows/rulesbylink`, {
      params:{
        link: verificationUrl
      },
      headers: {
        Accept: 'application/json',
      },
    });

    return response?.data;
  } catch (err) {
    console.log('getKYCRulesAPI', err);
    throw err;
  }

}