import {Component, OnInit} from '@angular/core';
import {User, UsersService} from '../../components/user/users/users.service';
import {AuthService} from '../../classes/auth.service';

@Component({
  selector: 'app-notification',
  templateUrl: './notification.component.html'
})
export class NotificationComponent implements OnInit {
  // message faghat baray notification hast
  include: ['messages']

  message;
  today: number = Date.now();
  user: User;
  /**
   * incluse attribute hay ye relationship ro neshon mide
   */
  userMessages;

  constructor(
              private authService: AuthService,
              private userService: UsersService,
  ) {
    this.userService.register();

      this.authService.currentUser.subscribe(user => {
          if (user)
          {
              this.user = user;
              this.userMessages = user.messages;
          }
      });



  }

  ngOnInit() {
    // todo
    // this.msg.getPermission();
    // this.msg.receiveMessage();
    // this.message = this.msg.currentMessage;
  }
}
