const stepMap = {
  identity: 'id_document',
  selfie: 'selfie',
  address: 'address_proof',
  enhanced: 'source_of_funds',
};

function normalizeVerificationType(value) {
  const type = String(value || '').trim().toLowerCase();

  if (!['identity', 'selfie', 'address', 'enhanced'].includes(type)) {
    return null;
  }

  return type;
}

function getSubmissionStepFromVerificationType(type) {
  return stepMap[type] || null;
}

module.exports = {
  normalizeVerificationType,
  getSubmissionStepFromVerificationType,
};