import { IENVIRONMENT } from '@app_core/injection-tokens';
import { ACCOUNT_PAGE, IAppPage, LOGIN_PAGE } from '@app_core/services/globals';

export const SUPPORTED_LANGUAGES = ['de', 'en'];

declare const environment: IENVIRONMENT;
export const APP_TITLE: string = environment['APP_TITLE'] ?? 'StaffDB';
export const cnst_DefaultCulture = environment.culture ?? 'de-DE';
export const cnst_DefaultLanguage = environment.language ?? 'de';

// page description, wich is used for routing as well for preparing routings menus and intern for page loading
export const APP_PAGES: IAppPage[] = [
  {
    caption: 'Mitarbeiter',
    path: 'employee',
    loadChildren: () => import('@app_modules/employee/employee.module').then(m => m.EmployeeModule),
    icon: '',
    messageCaption: 'Employee',
  },
  {
    caption: 'Abteilungen',
    path: 'departments',
    loadChildren: () => import('@app_modules/department/department.module').then(m => m.DepartmentModule),
    icon: '',
    messageCaption: 'Department',
  },
  ACCOUNT_PAGE,
  LOGIN_PAGE,
];

// named constants to access the arry APP_PAGES

export const enum EN_AppPages {
  Employee = 0,
  Department = 1,
  Settings = 2,
  Login = 3,
}

// named constants with numbers of http requests of data loading for every page for maintain of spinner

export const enum EN_HttpQueriesCount4Page {
  Employee = 1,
  Department = 1,
  Login = 10, //no of quires in load stammdata
}

export function getPageIndex(page: string): number {
  return APP_PAGES.findIndex((pg) => pg.path === page);
}


export enum EN_AppEntities {
  //-- base data entities
  Employee = 'employee',
  CostCentre = 'costcentre',
  Vendor = 'vendor',
  EmployeeStatus = 'employeestatus',
  Rang = 'rang',
  DocumentArt = 'documentart',
  Project = 'project',
  Department = 'department',
  WindreamSearch = 'windreamsearch',
  WindreamIndex = 'windreamindex',
  WindreamIndexToWindreamSearchToDepartment = 'windreamindextowindreamsearchtodepartment',
  WindreamSearchToDepartment = 'windreamsearchtodepartment',
  WindreamSearchItemToWindreamSearchToDepartment = 'windreamsearchitemtowindreamsearchtodepartment',
  WindreamSearchItem = 'windreamsearchitem',
  DocumentArtToDepartment = 'documentarttodepartment',
  EmployeeToDepartment = 'employeetodepartment',
  EmployeeToWebapp = 'employeetowebapp',
  WebApp = 'webapp',
  WebAppRole = 'webapprole',
  WebAppToDepartment = 'webapptodepartment',
  WebAppToWebAppRole = 'webapptowebapprole',
  EmployeeAttribute = 'employeeattribute',
  EmployeeToAttribute = 'employeetoattribute',
  WebAppAdditionalRole = 'webappadditionalrole',
  WebAppToWebAppAdditionalRole = 'webapptowebappadditionalrole',
  WindreamSearchToDepartmentCopyWindreamTile = 'windreamSearchToDepartment/CopyWindreamTile',
  DepartmentCopyWindreamTiles = 'department/copyWindreamTiles',
  Subsidiary = 'Subsidiary'
}


export enum EN_EmployeeStatus {
  MainFunction = 1,
  AdditionalFunction = 2,
}


export enum EN_EmployeeRang {
  Mitarbeiter = 4,
}


export const cnst_LoadedEntitiesExpiresInMs = 30000; //30s
