const Routes = {
  'patient_file': /* 建档页 */ '/register',
  'tongueface_upload': /*拍照页*/ '/camera',
  'tongueface_upload_result': /* [虚拟] 拍照结果页 */ '/camera/result',
  'tongueface_analysis': /* 问卷页 */ '/questionnaire',
  'tongueface_analysis_result': /* 舌面象分析报告页 */ '/report/analysis',
  'health_analysis': /* 健康报告页 */ '/report',

  'screen': '/screen',
} as const;

export function fromFlowData(options: string[]): Map<string, string> {
  const ref = new Map<string, string>();
  const length = options.length;

  // 修正虚拟路由
  const k1 = 'tongueface_upload';
  const k2 = 'tongueface_upload_result';
  if ( !options.includes(k2) && options[ length - 1 ] === k1 ) options.push(k2);

  options.unshift('/screen');
  options.push('screen');

  for ( let i = 1; i < options.length; i++ ) {
    const route = options[ i ] = getPath(options[ i ]);
    ref.set(options[ i - 1 ], route);
  }
  return ref;
}


export function getPath(value?: string) {
  return Routes[ value as keyof typeof Routes ];
}
