import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { UserInfo } from '@ucap-webmessenger/protocol-room';
import {
  UserInfoSS,
  UserInfoF,
  UserInfoDN
} from '@ucap-webmessenger/protocol-query';

@Component({
  selector: 'ucap-profile-my-profile-widget',
  templateUrl: './my-profile-widget.component.html',
  styleUrls: ['./my-profile-widget.component.scss']
})
export class MyProfileWidgetComponent implements OnInit {
  @Input()
  profileImageRoot: string;
  @Input()
  profileImageFile: string;

  @Output()
  openProfile = new EventEmitter<
    UserInfo | UserInfoSS | UserInfoF | UserInfoDN
  >();

  constructor() {}

  ngOnInit() {}

  onClickOpenProfile(
    event: MouseEvent,
    userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN
  ) {
    event.preventDefault();
    event.stopPropagation();

    this.openProfile.emit(userInfo);
  }
}
