import { Todos, Projects, UserStore } from '@store'
import globalroutines from '../globalroutines/index'

import { date, Screen } from 'quasar'
import { IListRoutes, ILang, IOperators, IPreloadImages } from '../model/index'

import { IFunctionality } from '@src/model/GlobalStore'
import firebase from '@src/error-handler/firebase'

const functionality: IFunctionality = {
  PWA: false,
  SHOW_USER_MENU: true, // Cambiare con true
  SHOW_PROFILE: true,
  SHOW_REG_BUTTON: false,
  ENABLE_REGISTRATION: true, // Cambiare con true
  ENABLE_REG_AYNI: true,
  SHOW_NEWSLETTER: false,
  SHOW_ONLY_POLICY: true,
  ENABLE_TODOS_LOADING: false,
  ENABLE_PROJECTS_LOADING: false,
  SHOW_IF_IS_SERVER_CONNECTION: false,
  SHOW_MESSAGES: false,
  BOOKING_EVENTS: false
}

const routes_admin: IListRoutes[] = [
  {
    active: true,
    order: 1000,
    path: '/admin/cfgserv',
    materialIcon: 'event_seat',
    name: 'pages.Admin',
    component: () => import('@/views/admin/cfgServer/cfgServer.vue'),
    level_parent: 0.0,
    level_child: 0.5,
    inmenu: true,
    submenu: true,
    onlyAdmin: true
  },
  {
    active: true,
    order: 1010,
    path: '/admin/extralist',
    materialIcon: 'event_seat',
    name: 'pages.extralist',
    component: () => import('@/views/admin/extralist/extralist.vue'),
    level_parent: 0.0,
    level_child: 0.5,
    inmenu: true,
    submenu: true,
    onlyAdmin: true
  },
  {
    active: true,
    order: 1020,
    path: '/admin/dbop',
    materialIcon: 'event_seat',
    name: 'pages.dbop',
    component: () => import('@/views/admin/dbop/dbop.vue'),
    level_parent: 0.0,
    level_child: 0.5,
    inmenu: true,
    submenu: true,
    onlyAdmin: true
  },
]

const routes_newsletter: IListRoutes[] = [
  {
    active: true,
    order: 10,
    name: 'newsletter.template', path: '/admin/newsletter/templemail',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 20,
    name: 'newsletter.sendemail', path: '/admin/newsletter/newnewsletter',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 30,
    name: 'newsletter.check', path: '/admin/newsletter/check',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 40,
    name: 'newsletter.sent', path: '/admin/newsletter/newslist',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 50,
    name: 'newsletter.mailinglist', path: '/admin/newsletter/mailinglist',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 60,
    name: 'newsletter.settings', path: '/admin/newsletter/settings',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 70,
    name: 'newsletter.serversettings', path: '/admin/newsletter/main_settings',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
  {
    active: true,
    order: 80,
    name: 'newsletter.others', path: '/admin/newsletter/events',  materialIcon: 'fas fa-users',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: true, submenu: true, level_parent: 0.5, level_child: 0.5, onlyManager: true
  },
]

const routes_manager: IListRoutes[] = [
  {
    active: true,
    order: 10,
    path: '/admin/userlist',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.userlist',
    component: () => import('@/rootgen/admin/usersList/usersList.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyManager: true,
    onlyTutor: true
  },
  {
    active: true,
    order: 10,
    path: '/admin/zoomlist',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.zoomlist',
    component: () => import('@/rootgen/admin/zoomList/zoomList.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyManager: true,
    onlyTutor: false
  },
  {
    active: true,
    order: 15,
    path: '/admin/showextralist',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.extralist',
    component: () => import('@/rootgen/admin/extraList/extraList.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyManager: true
  },
  {
    active: true,
    order: 20,
    path: '/admin/navi',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.navi',
    component: () => import('@/rootgen/admin/allnavi/allnavi.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyAdmin: true,
    onlyManager: true,
    onlyTutor: true
  },
  {
    active: true,
    order: 25,
    path: '/admin/listadoni_navi',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.listadoni_navi',
    component: () => import('@/rootgen/admin/listadoninavi/listadoninavi.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyAdmin: true,
    onlyManager: true,
    onlyTutor: true
  },
  {
    active: true,
    order: 27,
    path: '/admin/tableslist',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.tableslist',
    component: () => import('@/rootgen/admin/tablesList/tablesList.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyAdmin: true,
    onlyManager: true,
  },
  {
    active: true,
    order: 30,
    path: '/admin/pages',
    materialIcon: 'fas fa-file-alt',
    name: 'otherpages.admin.pages',
    component: () => import('@/rootgen/admin/pages/pages.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyManager: true,
    onlyTraduttrici: true
  },
  {
    active: true,
    order: 40,
    path: '/admin/gallery',
    materialIcon: 'fas fa-file-alt',
    name: 'otherpages.admin.gallery',
    component: () => import('@/rootgen/admin/gallery/gallery.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyAdmin: true,
    onlyManager: true
  },
  {
    active: true,
    order: 50,
    path: '/admin/media',
    materialIcon: 'fas fa-file-alt',
    name: 'otherpages.admin.media',
    component: () => import('@/rootgen/admin/uploader/uploader.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    onlyAdmin: true,
    onlyManager: true
  },
  {
    active: true,
    order: 60,
    path: '/admin/newsletter',
    materialIcon: 'fas fa-users',
    name: 'otherpages.admin.newsletter',
    inmenu: false,
    submenu: true,
    routes2: routes_newsletter,
    solotitle: true,
    level_parent: 0.5,
    level_child: 0.5,
    onlyAdmin: true,
    onlyManager: true
  },
  {
    active: functionality.BOOKING_EVENTS,
    order: 70,
    path: '/admin/usereventlist',
    materialIcon: 'edit',
    name: 'otherpages.admin.usereventlist',
    component: () => import('@/rootgen/admin/eventlist/eventlist.vue'),
    inmenu: true,
    submenu: true,
    level_parent: 0,
    level_child: 0.5,
    infooter: true,
    onlyManager: true,
    onlyAdmin: true,
  }
]

const baseroutes: IListRoutes[] = [
  {
    active: true,
    order: 10,
    path: '/',
    materialIcon: 'home',
    name: 'pages.home',
    component: () => import('@/root/home/home.vue'),
    inmenu: true,
    infooter: true
  },
  {
    active: true,
    order: 20,
    path: '/signup/:invited',
    materialIcon: 'how_to_reg',
    name: 'pages.presentazione2',
    component: () => import('@/root/intro/intro.vue'),
    inmenu: false,
    infooter: false,
    separator: false
  },
  {
    active: true,
    order: 30,
    path: '/intro',
    materialIcon: 'how_to_reg',
    name: 'pages.presentazione',
    component: () => import('@/root/intro/intro.vue'),
    meta: {requiresAuth: true},
    inmenu: true,
    infooter: true
  },
  {
    active: false,
    order: 40,
    path: '/testimonial',
    materialIcon: 'fas fa-comments',
    name: 'pages.testimonial',
    component: () => import('@/root/testimonianze/testimonianze.vue'),
    inmenu: true,
    infooter: true,
    onlyif_logged: false
  },
  {
    active: true,
    path: '/separator',
    name: 'separator',
    order: 50,
    isseparator: true,
    inmenu: true,
  },
  {
    active: true,
    order: 100,
    path: '/dashboard',
    materialIcon: 'fas fa-chalkboard',
    name: 'pages.dashboard',
    component: () => import('@/views/user/dashboard/dashboard.vue'),
    meta: {requiresAuth: true},
    inmenu: true,
    infooter: true
  },
  {
    active: true,
    order: 110,
    path: '/invite',
    materialIcon: 'fas fa-user-plus',
    name: 'pages.invita',
    component: () => import('@/root/invite/invite.vue'),
    meta: {requiresAuth: true},
    inmenu: true,
    infooter: true
  },
  {
    active: true,
    order: 120,
    path: '/profile',
    materialIcon: 'fas fa-user',
    name: 'pages.profile',
    component: () => import('@/views/user/profile/profile.vue'),
    meta: {requiresAuth: true},
    inmenu: true,
    infooter: true,
  },
  {
    active: true,
    order: 1000,
    path: '/admin/newsletter/:idparam',
    materialIcon: 'event',
    name: 'pages.newsletter.menu',
    component: () => import('@/rootgen/admin/newsletter/newsletter.vue'),
    inmenu: false,
    infooter: false
  },
  {
    active: true,
    order: 1000,
    path: '/404error',
    materialIcon: 'fas fa-calendar-plus',
    name: 'otherpages.error404',
    component: () => import('@/root/My404page/My404page.vue'),
    inmenu: false,
    infooter: false
  },
  {
    active: true,
    order: 2000,
    path: '/admin',
    materialIcon: 'fas fa-user-shield',
    name: 'otherpages.admin.menu',
    inmenu: true,
    routes2: routes_admin,
    solotitle: true,
    infooter: true,
    onlyAdmin: true
  },
  ...routes_admin,
  {
    active: true,
    order: 2110,
    path: '/manage',
    materialIcon: 'fas fa-users-cog',
    name: 'otherpages.manage.menu',
    inmenu: true,
    routes2: routes_manager,
    solotitle: true,
    infooter: true,
    onlyAdmin: true,
    onlyManager: true,
    onlyTutor: true
  },
  ...routes_manager,
  {
    active: functionality.SHOW_MESSAGES,
    order: 2150,
    path: '/messages/:un',
    materialIcon: 'fas fa-comment',
    name: 'otherpages.messages.menu',
    component: () => import('@/views/messages/messages.vue'),
    inmenu: functionality.SHOW_MESSAGES,
    infooter: functionality.SHOW_MESSAGES,
    meta: {requiresAuth: true},
  },
  // --- NOT IN MENU: ---
  { active: true,
    order: 1000,
    path: '/policy', name: 'pages.policy', component: () => import('@/root/policy/policy.vue') },
  {
    active: functionality.ENABLE_REGISTRATION,
    order: 1000,
    path: '/signup',
    materialIcon: 'how_to_reg',
    name: 'pages.SignUp',
    component: () => import('@/views/login/signup_complete/signup_complete.vue'),
    inmenu: false,
    infooter: false,
    separator: false
  },
  {
    active: functionality.ENABLE_REGISTRATION,
    order: 2000,
    path: '/regok',
    materialIcon: 'how_to_reg',
    name: 'pages.regok',
    component: () => import('@/views/login/regok/regok.vue'),
    inmenu: false,
    infooter: false,
    separator: false
  },
  {
    order: 2000,
    path: '/invite',
    materialIcon: 'how_to_reg',
    name: 'pages.regok',
    component: () => import('@/root/invite/invite.vue'),
    inmenu: false,
    infooter: false,
    separator: false
  },
/*
  {
    active: functionality.ENABLE_REGISTRATION,
    order: 1000,
    path: '/signup/:invited',
    materialIcon: 'how_to_reg',
    name: 'pages.SignUp2',
    component: () => import('@/views/login/signup_complete/signup_complete.vue'),
    inmenu: false,
    infooter: false,
    separator: false
  },
*/
  {
    active: true,
    order: 1000,
    path: '/signin',
    materialIcon: 'account_circle',
    name: 'pages.SignIn',
    component: () => import('@/views/login/signin_noreg/signin_noreg.vue'),
    inmenu: false,
    infooter: true
  },
  { active: true, order: 1000, path: '/vreg', name: 'pages.vreg', component: () => import('@/views/login/vreg/vreg.vue') },
  { active: true, order: 1000, path: '/requestresetpwd', name: 'pages.requestresetpwd', component: () => import('@/views/requestresetpwd/requestresetpwd.vue') },
  { active: true, order: 1000, path: '/updatepassword', name: 'pages.updatepassword', component: () => import('@/views/updatepassword/updatepassword.vue') },
  { active: true, order: 1000, path: '/offline', name: 'Offline', component: () => import('@/views/offline/offline.vue') },
]

export const routes = baseroutes

const preLoadImages: IPreloadImages[] = [
  { imgname: '../../statics/images/logo.png', alt: 'logo', mobile: false },
  { imgname: '../../statics/icons/flag_gb.svg', alt: 'flag us', mobile: false },
  { imgname: '../../statics/icons/flag_it.svg', alt: 'flag it', mobile: false },
  { imgname: '../../statics/icons/flag_es.svg', alt: 'flag es', mobile: false },
  { imgname: '../../statics/icons/flag_fr.svg', alt: 'flag fr', mobile: false },
  { imgname: '../../statics/icons/flag_pt.svg', alt: 'flag pt', mobile: false },
  // { imgname: '../../statics/images/background.jpg', alt: 'corsi di formazione per operatori del massaggio del benessere', mobile: true },
  // { imgname: '../../statics/images/background2.jpg', alt: 'stanza con cuscini per seminario reiki', mobile: true },
  // { imgname: '../../statics/images/background3.jpg', alt: 'foto di gruppo seminaristi reiki', mobile: true },
]

export function preloadedimages() {

  return [...preLoadImages]
}


const arrLangUsed = [
  'it',
  'si',
  'enUs',
  'es',
  'pt',
  'fr'
]

const lang_available: ILang[] = [
  { label: 'Italiano', icon: 'fa-flag-it', value: 'it', image: '../statics/icons/flag_it.svg', short: 'IT' },
  { label: 'Slovenski', icon: 'fa-flag-si', value: 'si', image: '../statics/icons/flag_si.svg', short: 'SI' },
  { label: 'English', icon: 'fa-flag-us', value: 'enUs', image: '../statics/icons/flag_gb.svg', short: 'EN' },
  { label: 'Español', icon: 'fa-flag-es', value: 'es', image: '../statics/icons/flag_es.svg', short: 'ES' },
  { label: 'Português', icon: 'fa-flag-pt', value: 'pt', image: '../statics/icons/flag_pt.svg', short: 'PT' },
  { label: 'Français', icon: 'fa-flag-fr', value: 'fr', image: '../statics/icons/flag_fr.svg', short: 'FR' },
  // { label: 'German', icon: 'fa-flag-de', value: 'de', image: '../statics/images/de.png', short: 'DE' },
]

const costanti = {
  videointro: 'https://youtu.be/dbscY8jWDMM',
  nascita_ayni: 'https://youtu.be/3JDRkN9z_rM',
  paginaspiegazione: 'https://ayni.gifteconomy.app/what/',
}

export const static_data = {
  functionality,
  baseroutes,
  costanti,
  routes,
  lang_available,
  preLoadImages,
  arrLangUsed
}
