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 { ActiveUserViewModel } from "../viewmodel/ActiveUserViewModel";
import { UserView } from "../view/UserView";
import { UserModel } from "../model/UserModel";

export class UserController {
    private _model: UserModel;
    private _view: UserView;


    constructor(model: UserModel, view: UserView) {
        this._model = model;
        this._view = view;
    }


    /**
     * eventHandler
     */
    public eventHandler(vm: ActiveUserViewModel[]): void {
        this._model.someBusinessMethod(vm);
    }

    public test(): void {
        const activeUsersMock: ActiveUserViewModel[] = [];
        let activeUserViewModelMock = new ActiveUserViewModel();
        activeUserViewModelMock.userName = "some user";
        // activeUserViewModelMock.lastActive = "3 hrs ago";
        activeUserViewModelMock.online = true;
        activeUsersMock.push(activeUserViewModelMock);
        activeUserViewModelMock = new ActiveUserViewModel();
        // activeUserViewModelMock.lastActive = "3 hrs ago";
        activeUserViewModelMock.online = true;
        activeUserViewModelMock.userName = "some user 2";
        activeUsersMock.push(activeUserViewModelMock);
        this.eventHandler(activeUsersMock);
    }

    public getActiveUsers(): void {
        this._model.getActiveUsers();
    }


}