import { UmsAPI } from '../../../../shared/helper/http-api'
import {
  EP_LOGIN, EP_SIGNUP, EP_USER_PROFILE, EP_VALIDATE_URL,
  EP_FORGOT_PASSWORD, EP_TENANT_PROFILE, EP_GET_COUNTRIES, EP_GET_INDUSTRIES, EP_RESEND_LINK,
  EP_RESET_PASSWORD, EP_AGREE_TERMS, EP_GET_TERMS
} from '../../../../shared/config/endpoints/authentication'

export const loginService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_LOGIN, data)
  return response
}

export const signupService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_SIGNUP, data)
  return response
}

export const userProfileService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_USER_PROFILE, data)
  return response
}

export const userValidateUrlService = async (data: string): Promise<any> => {
  const response = await UmsAPI.post(EP_VALIDATE_URL + data)
  return response
}

export const forgotPasswordService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_FORGOT_PASSWORD, data)
  return response
}

export const tenantProfileService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_TENANT_PROFILE, data)
  return response
}

export const updateTenantProfileService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(`${EP_TENANT_PROFILE}`, data)
  return response
}

export const useGetCountriesService = async (): Promise<any> => {
  const response = await UmsAPI.get(EP_GET_COUNTRIES)
  return response.data
}

export const useGetIndustriesService = async (): Promise<any> => {
  const response = await UmsAPI.get(EP_GET_INDUSTRIES)
  return response.data
}

export const resetPasswordService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_RESET_PASSWORD, data)
  return response
}

export const resendLinkService = async (data: any): Promise<any> => {
  const response = await UmsAPI.post(EP_RESEND_LINK, data)
  return response
}

export const useTermsService = async (data: any): Promise<any> => {
  console.log('in api call ', data)
  const response = await UmsAPI.post(EP_AGREE_TERMS, data)
  console.log('response', response.data)
  return response
}

export const useGetTermsService = async (): Promise<any> => {
  const response = await UmsAPI.get(EP_GET_TERMS)
  return response.data
}
