import { Type } from '@angular/core';

import { DeviceType, DesktopType } from '@ucap/core';

import { ModuleConfig as WebSocketModuleConfig } from '@ucap/web-socket';

import {
  ModuleConfig as CommonApiModuleConfig,
  Urls as CommonApiUrls
} from '@ucap/api-common';

import {
  ModuleConfig as PublicApiModuleConfig,
  Urls as PublicApiUrls
} from '@ucap/api-public';

import {
  ModuleConfig as ExternalApiModuleConfig,
  Urls as ExternalApiUrls
} from '@ucap/api-external';

import {
  ModuleConfig as MessageApiModuleConfig,
  Urls as MessageApiUrls
} from '@ucap/api-message';

import {
  ModuleConfig as PromptApiModuleConfig,
  Urls as PromptUrls
} from '@ucap/api-prompt';

import { ModuleConfig as PiModuleConfig, Urls as PiUrls } from '@ucap/pi';

import {
  ModuleConfig as ProtocolModuleConfig,
  Urls as ProtocolUrls
} from '@ucap/protocol';

import { ModuleConfig as PingProtocolModuleConfig } from '@ucap/protocol-ping';

import { Settings } from '@app/models/settings';

export interface Environment {
  production: boolean;
  hmr: boolean;

  productConfig: {
    productId: string;
    productName: string;
    localEncriptionKey: string;
    nativeServiceClass: Type<any>;
    updateCheck: {
      deviceType: DeviceType;
      devicePlatformType: DesktopType;
      intervalHour: number;
    };
    defaultSettings: Settings;
    file: {
      /** 기본 다운로드 경로 */
      defaultDownloadFolder: string;
      /** 파일업로드 제한 사이즈 (mb) */
      defaultFileAllowSize: number;
    };
    authentication: {
      usePrivateInformationAgree: boolean;
      useRememberMe: boolean;
      useAutoLogin: boolean;
      maxTryCount: number;
      intervalForRetry: number;
    };
    profile: {
      /** 내 프로필 이미지 수정 가능 여부 */
      editableProfileImage: boolean;
    };
    group: {
      /** 소속부서(내부서) 그룹핑 사용여부 */
      useMyDeptGroup: boolean;
      /** 소속부서(내부서) 고정 그룹 SEQ */
      myDeptGroupSeq: number;
      /** 삭제,수정 불가 그룹 Seqs:number[] */
      fixedGroupSeqs: number[];
    };
    chat: {
      /** 타이머대화방 사용유무 */
      useTimerRoom: boolean;
      /** 타이머대화방 기본 interval */
      timerRoomDefaultInterval: number;

      /** 최대 대화방 참여인원 */
      maxChatRoomUser: number;
      /** 대용량대화 기준 */
      masstextLength: number;

      /** 대화방 초기 로딩 이벤트 갯수 */
      eventRequestInitCount: number;
      /** 대화방 이벤트 조회 개수 */
      eventRequestDefaultCount: number;

      /** 여기까지 읽음을 보여줄 최소 이벤트 개수 (show: over) */
      readHereShowMinimumEventCount: number;
      /** 여기까지 읽음을 보여줄 최대 이벤트 개수 (show: under) */
      readHereShowMaximumEventCount: number;
      /** 여기까지 읽음이 보여질때 대화방 이벤트 조회 개수. */
      readHereEventRequestCount: number;
    };
  };

  companyConfig: {
    companyGroupCode: string;
    fixedCompanyCode: string;
  };

  commonApiModuleConfig: CommonApiModuleConfig;
  publicApiModuleConfig: PublicApiModuleConfig;
  externalApiModuleConfig: ExternalApiModuleConfig;
  messageApiModuleConfig: MessageApiModuleConfig;
  promptApiModuleConfig: PromptApiModuleConfig;
  piModuleConfig: PiModuleConfig;
  webSocketModuleConfig: WebSocketModuleConfig;
  protocolModuleConfig: ProtocolModuleConfig;
  pingProtocolModuleConfig: PingProtocolModuleConfig;
}

export const commonApiUrls: CommonApiUrls = {
  fileProfileSave: '/Common/FileProfileSave.aspx',
  fileTalkDownload: '/Common/FileTalkDownload.aspx',
  fileTalkSave: '/Common/FileTalkSave.aspx',
  fileTalkShare: '/Common/FileTalkShare.aspx',
  massTalkDownload: '/Common/MassTalkDownload.aspx',
  massTalkSave: '/Common/MassTalkSave.aspx',
  transMassTalkDownload: '/Common/TransMassTalkDownload.aspx',
  transMassTalkSave: '/Common/TransMassTalkSave.aspx',
  translationReq: '/Common/TranslationReq.aspx',
  translationSave: '/Common/TranslationSave.aspx'
};

export const publicApiUrls: PublicApiUrls = {
  versionInfo2: '/Pub/verinfo2.aspx',
  updateInfo: '/Pub/updinfo.aspx'
};
export const externalApiUrls: ExternalApiUrls = {
  checkUserInfoEx: '/Extern/CheckUserInfoEx.aspx',
  companyList: '/Extern/CompanyList.aspx',
  tokenUpdate: '/Extern/TokenUpdate.aspx',
  urlInfo: '/Extern/urlinfo.aspx'
};
export const messageApiUrls: MessageApiUrls = {
  retrieveSendMessageList: '/uCapMsg/msg/retrieveSendMessageList.do',
  retrieveRecvMessageList: '/uCapMsg/msg/retrieveRecvMessageList.do',
  retrieveReservationMessageList:
    '/uCapMsg/msg/retrieveReservationMessageList.do',
  retrieveSearchMessage: '/uCapMsg/msg/retrieveSearchMessage.do',

  sendNewMessage: '/uCapMsg/msg/sendNewMessage.do',

  retrieveMessageDetail: '/uCapMsg/msg/retrieveMessageDetail.do',
  readMessage: '/uCapMsg/msg/readMessage.do',
  retrieveReadCheck: '/uCapMsg/msg/retrieveReadCheck.do',
  cancelMessage: '/uCapMsg/msg/cancelMessage.do',
  cancelReservationMessage: '/uCapMsg/msg/cancelReservationMessage.do',
  retrieveResourceFile: '/uCapMsg/msg/retrieveResourceFile.do',

  deleteMessage: '/uCapMsg/msg/deleteMessage.do',

  saveMyMessage: '/uCapMsg/msg/saveMyMessage.do',
  retrieveMyMessage: '/uCapMsg/msg/retrieveMyMessage.do',
  deleteMyMessage: '/uCapMsg/msg/deleteMyMessage.do',
  editMyMessage: '/uCapMsg/msg/editMyMessage.do',

  editReservationMessageEx: '/uCapMsg/msg/editReservationMessageEx.do',

  sendCopyMessage: '/uCapMsg/msg/sendCopyMessage.do',

  retrieveUnreadCount: '/uCapMsg/msg/retrieveUnreadCount.do',

  retrieveNoticeList: '/uCapMsg/notice/retrieveNoticeList.do',
  eventDownload: ''
};

export const promptUrls: PromptUrls = {
  sendCall: '/uCapPrompt/api/call/clicktocall',
  conferenceCreate: '/uCapPrompt/conference/create',
  conferenceJoin: '/uCapPrompt/conference/join'
};

export const piUrls: PiUrls = {
  login2: '/uCapPi/login2',
  userTermsAction: '/uCapPi/user/terms.action',
  passwordInitStep1: '/uCapPi/password/initStep1',
  passwordChange: '/uCapPi/password/change',
  policyTotal: '/uCapPi/policy/total',
  policyService: '/uCapPi/policy/service',
  policyPrivacy: '/uCapPi/policy/privacy',
  tokenCheck: '/uCapPi/tokenCheck',
  userMobileAuth: '/uCapPi/user/mobileAuth',
  userUserAuth: '/uCapPi/user/userAuth',
  userCall: '/uCapPi/user/call',
  userMoblieCallAuth: '/uCapPi/user/moblieCallAuth',
  eventSendEventMail: '/uCapPi/event/sendEventMail',
  userMobileInitial1: '/uCapPi/user/mobileInitial1',
  eventSendInvite: '/uCapPi/event/sendInvite',
  userRoom: '/uCapPi/user/room',
  scheduleRetrieveScheduleList: '/uCapPi/schedule/retrieveScheduleList',
  userScreenCapture: '/uCapPi/user/screenCapture'
};

export const protocolUrls: ProtocolUrls = {
  base: '/'
};

export const commonApiAcceptableFileExtensionsForDocumnet: string[] = [];

export const commonApiAcceptableFileExtensionsForImage: string[] = [];

export const commonApiAcceptableFileExtensionsForArchive: string[] = [];

export const commonApiAcceptableFileExtensionsForAudio: string[] = [];

export const commonApiAcceptableFileExtensionsForFlash: string[] = [];

export const commonApiAcceptableFileExtensionsForVideo: string[] = [];

export const commonApiAcceptableFileExtensionsForFolder: string[] = [];

export const commonApiacceptableFileExtensions: string[] = [
  // 문서
  ...commonApiAcceptableFileExtensionsForDocumnet,

  // 이미지
  ...commonApiAcceptableFileExtensionsForImage,

  // 압축
  ...commonApiAcceptableFileExtensionsForArchive,

  // 오디오
  ...commonApiAcceptableFileExtensionsForAudio,

  // 플래쉬
  ...commonApiAcceptableFileExtensionsForFlash,

  // 동영상
  ...commonApiAcceptableFileExtensionsForVideo,

  // 폴더전송
  ...commonApiAcceptableFileExtensionsForFolder
];
