import { apiClient } from '@/shared/api/client'
import type { ApiResponse } from '@/shared/types/types'
import type { RealnameStatusValue } from '@/types/status'

export interface RealnameStatus {
  status: RealnameStatusValue
  provider?: string
  provider_order_no?: string
  masked_name?: string
  masked_id_no?: string
  verified_at?: string
  fail_reason?: string
}

export async function startRealname(name: string, idNo: string) {
  const { data } = await apiClient.post<ApiResponse<RealnameStatus>>('/realname/start', {
    name,
    id_no: idNo,
  })
  return data.data
}

export async function getRealnameStatus() {
  const { data } = await apiClient.get<ApiResponse<RealnameStatus>>('/realname/status')
  return data.data
}
