import { postAuxEnd, getAuxEnd } from "./axiosCall";

// FUNCTION TO START BVN VALIDATION
export const validateBVN = (postData:any) => {
    let reqData = {
        ...postData
    }
    return postAuxEnd('/bvn', reqData)
}


// FUNCTION TO VERIFY OTP AND LOGIN
export const verifyOTP = (postData:any) => {
    let reqData = {
        ...postData
    }
    return postAuxEnd('/bvn/verify', reqData)
}

// FUNCTION TO APPLY FOR LOAN
export const applyForLoan = (postData:any) => {
    let reqData = {
        customer_uid: localStorage.getItem('uid'),
        ...postData
    }
    return postAuxEnd('/loan/apply', reqData)
}

// FUNCTION TO GET USER BY CUSTOMER UID
export const getUserByID = (uid:string) => {
    let reqData = {
        // customer_uid: localStorage.getItem('uid'),
    }
    return getAuxEnd(`/profile?uid=${uid}`, reqData)
}

// FUNCTION TO GET USER BY CUSTOMER UID
export const getUserPendingLoanList = (uid:string) => {
    let reqData = {
        // customer_uid: localStorage.getItem('uid'),
    }
    return getAuxEnd(`/dash?uid=${uid}`, reqData)
}

// FUNCTION TO GET LIST OF EMPLOYERS
export const getEmployersList = () => {
    let reqData = {
        // customer_uid: localStorage.getItem('uid'),
    }
    return getAuxEnd(`/employers`, reqData)
}

// FUNCTION TO GET USER EMPLOYER
export const getEmployer = () => {
    let reqData = {
        uid: localStorage.getItem('uid'),
    }
    return getAuxEnd(`/dash/employer?uid=${reqData?.uid}`, null)
}

// FUNCTION TO GET LOAN DETAILS
export const getLoanDetail = (postData:any) => {
    let reqData = {
        uid: localStorage.getItem('uid'),
        ...postData
    }
    return getAuxEnd(`/loan/loandetail?uid=${reqData?.uid}&application_uid=${reqData?.application_uid}`, null)
}

// FUNCTION TO GET PAYMENT DETAILS
export const getPaymentDetails = (postData:any) => {
    let reqData = {
        uid: localStorage.getItem('uid'),
        ...postData
    }
    return getAuxEnd(`/payment/status?uid=${reqData?.uid}&reference=${reqData?.reference}`, null)
}

// FUNCTION TO ADD CARD
export const addCard = (postData:any) => {
    let reqData = {
        uid: localStorage.getItem('uid'),
        ...postData
    }
    return postAuxEnd('/addcard', reqData)
}