import React, { lazy } from 'react';
import { RouteProps } from 'react-router-dom';
import {authMenu, rowdayPagesMenu, homePagesMenu, streamspacePagesMenu} from '../menu';

const ENABLE_COMBINED_STREAM_PILOT = process.env.REACT_APP_ENABLE_COMBINED_STREAM_PILOT === '1';

	const AUTH = {
		SIGN_IN: lazy(() => import('../pages/auth/Login')),
		PAGE_404: lazy(() => import('../pages/auth/Page404')),
	};

	const HOME = {
		DASHBOARD: lazy(() => import('../pages/home/Index')),
	};

	const ROWDAY = {
		ONEBILLIONMINUTES: lazy(() => import('../pages/conference/Index')),
	};

	const STREAMSPACE = {
		GENERALSTREAM_COMBINED: lazy(() => import('../pages/streamspace/CombinedGeneralStream')),
		GENERALSTREAM: lazy(() => import('../pages/streamspace/Index')),
		GENERALSTREAM_WEBRTC: lazy(() => import('../pages/streamspace/GeneralStreamWebRTC')),
		MYSTREAM_COMBINED: lazy(() => import('../pages/streamspace/CombinedMyStream')),
		MYSTREAM: lazy(() => import('../pages/streamspace/mystream')),
		LANGUAGE_COMBINED: lazy(() => import('../pages/streamspace/CombinedLanguage')),
		LANGUAGE: lazy(() => import('../pages/streamspace/Language'))
	};

	const authRoutes: RouteProps[] = [

		/**
		 * Auth Page
		 */
		{
			path: authMenu.page404.path,
			element: <AUTH.PAGE_404 />,
		},
		{
			path: authMenu.signIn.path,
			element: <AUTH.SIGN_IN />,
		},
		{
			path: authMenu.signInParam.path,
			element: <AUTH.SIGN_IN />,
		},
	];


	export const rowdayRoutes: RouteProps[] = [

		/**
		 * RowDay Menu
		 */
		{
			path: `${rowdayPagesMenu.onebillionminutes.path}`,
			element: <ROWDAY.ONEBILLIONMINUTES />,
		},
	
	];

	export const guest: RouteProps[] = [
		
		{
			path: `${streamspacePagesMenu.mystream.path}`,
			element: ENABLE_COMBINED_STREAM_PILOT
				? <STREAMSPACE.MYSTREAM_COMBINED />
				: <STREAMSPACE.MYSTREAM />,
		},

		{
			path: ':username/mystream-combined',
			element: <STREAMSPACE.MYSTREAM_COMBINED />,
		},

		{
			path: ':username/mystream-legacy',
			element: <STREAMSPACE.MYSTREAM />,
		},
	
	];

	const contents: RouteProps[] = [
		/**
		 * Home Menu
		 */
		{
			path: `${homePagesMenu.dashboard.path}`,
			element: <HOME.DASHBOARD />,
		},

		/**
		 * RowDay Menu
		 */
		{
			path: `${rowdayPagesMenu.onebillionminutes.path}`,
			element: <ROWDAY.ONEBILLIONMINUTES />,
		},
		
		/**
		 * Streamspace Menu
		 */
		{
			path: `${streamspacePagesMenu.generalstreamCombined.path}`,
			element: <STREAMSPACE.GENERALSTREAM_COMBINED />,
		},

		{
			path: `${streamspacePagesMenu.generalstream.path}`,
			element: ENABLE_COMBINED_STREAM_PILOT
				? <STREAMSPACE.GENERALSTREAM_COMBINED />
				: <STREAMSPACE.GENERALSTREAM />,
		},

		{
			path: 'translations-hls',
			element: <STREAMSPACE.GENERALSTREAM />,
		},

		{
			path: `${streamspacePagesMenu.generalstreamWebRTC.path}`,
			element: <STREAMSPACE.GENERALSTREAM_WEBRTC />,
		},

		{
			path: `${streamspacePagesMenu.generalstream.subMenu.languages.path}`,
			element: <STREAMSPACE.LANGUAGE_COMBINED />,
		},

		{
			path: 'translations-combined/:language',
			element: <STREAMSPACE.LANGUAGE_COMBINED />,
		},

		{
			path: 'translations-legacy/:language',
			element: <STREAMSPACE.LANGUAGE />,
		},

		{
			path: `${streamspacePagesMenu.mystream.path}`,
			element: ENABLE_COMBINED_STREAM_PILOT
				? <STREAMSPACE.MYSTREAM_COMBINED />
				: <STREAMSPACE.MYSTREAM />,
		},

		{
			path: ':username/mystream-combined',
			element: <STREAMSPACE.MYSTREAM_COMBINED />,
		},

		{
			path: ':username/mystream-legacy',
			element: <STREAMSPACE.MYSTREAM />,
		},
	
	];

	export default contents;
