import { Component, OnInit } from '@angular/core';
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import {
  EmployeeType,
  RoomInfo,
  RoomType
} from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
import {
  StatusBulkInfo,
  TerminalStatusInfo,
  TerminalStatusNumber,
  WorkStatusType
} from '@ucap-webmessenger/protocol-status';
import { Router } from '@angular/router';
import { Company } from '@ucap-webmessenger/api-external';
import { EventType, Info, EventJson } from '@ucap-webmessenger/protocol-event';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { StatusCode as ApiStatusCode } from '@ucap-webmessenger/api';
import { StatusCode } from '@ucap-webmessenger/core';

@Component({
  selector: 'app-template.page',
  templateUrl: './template.page.component.html',
  styleUrls: ['./template.page.component.scss']
})
export class TemplatePageComponent implements OnInit {
  profileImageRoot = 'http://27.122.224.170:8011/ProfileImage';

  userInfo: UserInfo = buddyData;

  presence: StatusBulkInfo = status;

  companyList: Company[] = companyList;

  companyCode: string = 'GUC006';

  roomInfo: RoomInfo = roomInfo;

  sessionVerinfo: VersionInfo2Response;

  constructor(private router: Router) {}

  ngOnInit() {
    this.sessionVerinfo = {
      statusCode: ApiStatusCode.Success,
      errorMessage: '',
      profileRoot: this.profileImageRoot
    };
  }

  onClickLogin() {
    this.router.navigate(['/account/login']);
  }
}

export const status: StatusBulkInfo = {
  // 사용자SEQ
  userSeq: 15,
  // 상태코드(PC)
  pcStatus: StatusCode.Away,
  // 상태코드(통화)
  phoneStatus: StatusCode.Offline,
  // 상태코드(모바일)
  mobileStatus: StatusCode.OnLine,
  // 상태코드(PC화상)
  conferenceStatus: StatusCode.Offline,
  // 상태메시지
  statusMessage: '다른용무중',
  // 상태코드(Mobile화상)
  mobileConferenceStatus: StatusCode.Offline,
  // 상태코드(iMessenger)
  imessengerStatus: StatusCode.Offline,
  // 단말상태정보(s)
  terminalStatus: TerminalStatusInfo.Idle,
  // 단말상태번호(n)
  terminalStatusNumber: TerminalStatusNumber.Idle,
  workstatus: WorkStatusType.Work
};
export const buddyData: UserInfo = {
  seq: 15,
  name: '채희중',
  profileImageFile: '/2017/08/09/PF_15_174154508.jpeg',
  grade: '책임',
  intro: '프로필정보 변경됨.',
  companyCode: 'GUC006',
  hpNumber: '01089339833',
  lineNumber: '01089339833',
  email: 'hjchae72@lgcns.com',
  isMobile: false,
  deptName: 'UCAP TEAM',
  isFavorit: false,
  isBuddy: true,
  isActive: true,
  roleCd: RoleCode.CompanyExcludeSync,
  employeeNum: ' ',
  madn: '0033',
  hardSadn: ' ',
  fmcSadn: '0033',
  nameEn: 'HUI JOONG CHAE',
  nameCn: ' ',
  gradeEn: 'Business Engineering',
  gradeCn: ' ',
  deptNameEn: ' ',
  deptNameCn: ' ',
  isPrivacyAgree: true,
  isValidLogin: true,
  employeeType: EmployeeType.Regular,
  nickName: '채책임(닉)',
  order: ''
};

const roomInfo: RoomInfo = {
  roomSeq: '2530',
  roomType: RoomType.Single,
  roomName: ' ',
  finalEventType: EventType.Character,
  finalEventMessage: '비밀 대화방입니다',
  finalEventDate: '2019-09-30 13:57:06',
  joinUserCount: 2,
  noReadCnt: 0,
  receiveAlarm: true,
  isJoinRoom: true,
  expiredFileStdSeq: 0,
  isTimeRoom: true,
  timeRoomInterval: 5
};

const companyList: Company[] = [
  {
    companyCode: 'GUC002',
    companyName: 'LG Electronics.',
    companyDomain: 'lge.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC040',
    companyName: 'LGE한국영업협력사',
    companyDomain: 'lgepartner.com',
    companyConfAuthYn: 'Y',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC021',
    companyName: 'LG이노텍',
    companyDomain: 'lginnotek.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC036',
    companyName: '하이프라자',
    companyDomain: 'hiplaza.co.kr',
    companyConfAuthYn: 'Y',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC006',
    companyName: 'LG CNS',
    companyDomain: 'lgcns.com',
    companyConfAuthYn: 'Y',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC041',
    companyName: 'LGEIL',
    companyDomain: 'lgeil.com',
    companyConfAuthYn: 'Y',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC100',
    companyName: 'LG UCAP',
    companyDomain: 'lgucap.com',
    companyConfAuthYn: 'Y',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUCIM',
    companyName: '아메사용회사',
    companyDomain: 'test.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'N',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC005',
    companyName: 'LG화학',
    companyDomain: 'lgchem.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GSGAL',
    companyName: 'GS칼텍스',
    companyDomain: 'gscaltex.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC001',
    companyName: 'LG U+',
    companyDomain: 'lguplus.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC007',
    companyName: 'LG Display',
    companyDomain: 'lgdisplay.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'N'
  },
  {
    companyCode: 'GUC011',
    companyName: 'LG인화원',
    companyDomain: 'lgacademy.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC013',
    companyName: 'LG MMA',
    companyDomain: 'lgmma.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC015',
    companyName: '(주)LG',
    companyDomain: 'lg.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC016',
    companyName: 'LGERI',
    companyDomain: 'lgeri.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC024',
    companyName: 'LG Hausys',
    companyDomain: 'lghausys.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC028',
    companyName: 'LG상사',
    companyDomain: 'lgi.co.kr',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC032',
    companyName: '코리아일레콤',
    companyDomain: 'koreaelecom.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC035',
    companyName: 'HLDS',
    companyDomain: 'hlds.co.kr',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC038',
    companyName: 'BizTech Partners',
    companyDomain: 'GUC018',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  },
  {
    companyCode: 'GUC042',
    companyName: 'Japan R&D Lab',
    companyDomain: 'lgjlab.com',
    companyConfAuthYn: 'N',
    ucapUseYn: 'Y',
    companyTimerChatAuthYn: 'Y'
  }
];

const eventInfo: Info<EventJson>[] = [
  {
    seq: 6,
    type: EventType.Character,
    senderSeq: 504688,
    sendDate: '2019-10-08 14:28:43',
    sentMessage: '테스트1111',
    receiverCount: 2
  },
  {
    seq: 20,
    type: EventType.File,
    senderSeq: 509747,
    sendDate: '2019-10-15 17:18:49',
    sentMessage:
      '{\r\n"StatusCode":"200",\r\n"ErrorMessage":"",\r\n"RoomID":"0",\r\n"FileName":"1.jpg",\r\n"FileExt":"jpg",\r\n"FileType":"I",\r\n"ThumbURL":"http://27.122.224.170:8011/WebFile/GUC006/2019/10/15/MA_509747_17184948.jpg.thumb.jpg",\r\n"AttSEQ":"2964",\r\n"AttSize":"879394",\r\n"AttRegDate":"2019-10-15 17:18:49",\r\n"ImageWidth":"320",\r\n"ImageHeight":"240",\r\n"CompanyCode":"GUC006",\r\n"VoiceTime":"",\r\n"SynappKey":""\r\n}',
    receiverCount: 2
  },
  {
    seq: 21,
    type: EventType.File,
    senderSeq: 509747,
    sendDate: '2019-10-15 17:20:24',
    sentMessage:
      '{\r\n"StatusCode":"200",\r\n"ErrorMessage":"",\r\n"RoomID":"0",\r\n"FileName":"dummy_더미.txt",\r\n"FileExt":"txt",\r\n"FileType":"F",\r\n"ThumbURL":"",\r\n"AttSEQ":"2965",\r\n"AttSize":"1736",\r\n"AttRegDate":"2019-10-15 17:20:23",\r\n"ImageWidth":"320",\r\n"ImageHeight":"320",\r\n"CompanyCode":"GUC006",\r\n"VoiceTime":"",\r\n"SynappKey":""\r\n}',
    receiverCount: 2
  },
  {
    seq: 22,
    type: EventType.File,
    senderSeq: 509747,
    sendDate: '2019-10-15 17:21:10',
    sentMessage:
      '{\r\n"StatusCode":"200",\r\n"ErrorMessage":"",\r\n"RoomID":"0",\r\n"FileName":"The_Power_of_Teamwork_-_Funny_Animation.mp4",\r\n"FileExt":"mp4",\r\n"FileType":"V",\r\n"ThumbURL":"",\r\n"AttSEQ":"2966",\r\n"AttSize":"4476141",\r\n"AttRegDate":"2019-10-15 17:21:10",\r\n"ImageWidth":"320",\r\n"ImageHeight":"320",\r\n"CompanyCode":"GUC006",\r\n"VoiceTime":"",\r\n"SynappKey":""\r\n}',
    receiverCount: 2
  },
  {
    seq: 3,
    type: EventType.MassText,
    senderSeq: 10642,
    sendDate: '2019-09-19 09:46:24',
    sentMessage:
      '{"StatusCode":"200","ErrorMessage":"","EventMassSeq":"1011","RoomID":"2479","RegDate":"","Content":"RequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSendRequestMassEventSend"}',
    receiverCount: 2
  },
  {
    seq: 1,
    type: EventType.Join,
    senderSeq: 509747,
    sendDate: '2019-10-15 17:23:26',
    sentMessage: '이진호2,T10112,T10222,이진호',
    receiverCount: 4
  },
  {
    seq: 4,
    type: EventType.Exit,
    senderSeq: 509747,
    sendDate: '2019-10-15 17:24:15',
    sentMessage: '이진호2',
    receiverCount: 3
  },
  {
    seq: 19,
    type: EventType.RecalledMessage,
    senderSeq: 509747,
    sendDate: '2019-10-15 16:36:47',
    sentMessage: 'aaaaaa',
    receiverCount: 2
  },
  {
    seq: 25,
    type: EventType.RenameRoom,
    senderSeq: 509747,
    sendDate: '2019-10-15 17:25:55',
    sentMessage: '이진호2,이진호,이진호2 바꿔',
    receiverCount: 2
  },
  {
    receiverCount: 2,
    sendDate: '2019-10-15 17:28:13',
    senderSeq: 509747,
    sentMessage: '509747,43200',
    seq: 5,
    type: EventType.GuideForRoomTimerChanged
  }
];
