import { Controller } from "./AbstractController";
import "../model/AbstractModel";
import "../model/UserModel";
import "../view/AbstractView";
import "../view/UserView";
import { Model } from "../model/AbstractModel";
import { View } from "../view/AbstractView";
import { ChatMessageViewModel } from "../viewmodel/ChatMessageViewModel";
import { ChatModel } from "../model/ChatModel";
import { ChatView } from "../view/ChatView";
import { Client } from "@stomp/stompjs";
import { EncryptionService } from "../../common/service/EncryptionService";
import { ChatMessageDTO } from "../../common/dto/ChatMessageDTO";
import log from "loglevel";

export interface Props {
  model: ChatModel;
  view: ChatView;
  chatStompClient: Client;
  encryptionService: EncryptionService;
}

export class ChatController {
  private readonly _props: Props;
  constructor(props: Props) {
    this._props = props;
  }

  public test(): void {
    const chatMessageViewModels: ChatMessageViewModel[] = [];
    let chatMessageViewModelMock = new ChatMessageViewModel();
    chatMessageViewModelMock.fromUser = "user1";
    chatMessageViewModelMock.toUser = "user2";
    chatMessageViewModelMock.message = "";
    chatMessageViewModelMock.messageTime = new Date();
    chatMessageViewModels.push(chatMessageViewModelMock);
  }

  public store(userName: string, message: ChatMessageViewModel): void {
    this._props.model.storeUserMessages(userName, Array(message), "new");
  }
}
