import { getBizConfig } from '../index';
import { convertTemplate } from '../utils/StringUtils';

const customMap = {
  // '/Role/render': Role,
  // '/AccountList/render': AccountList
};

const customWrapper = (domainLink, query) => {
  let finalDomainLink = domainLink[0] === '/' ? domainLink : '/' + domainLink;
  finalDomainLink = convertTemplate(finalDomainLink);
  if (query && query.other) {
    finalDomainLink += '/' + query.other;
  }
  if (customMap[finalDomainLink]) {
    return customMap[finalDomainLink];
  }
  return getBizConfig() && getBizConfig()[finalDomainLink];
};

export default customWrapper;
