import { Component, OnInit } from '@angular/core';

import { LoginService } from '../../../services/login.service';
import { InstructorService } from '../../../services/instructor.service';

import { InstructorData } from '../../../structures/instructor-data';
import { emptyInstructorDataFactory } from '../../../empty-objects/empty-instructor-data';

import * as Globals from '../../../globals';

@Component({
  selector: 'app-my-profile-page',
  templateUrl: './my-profile-page.component.html',
  styleUrls: ['./my-profile-page.component.scss']
})
export class MyProfilePageComponent implements OnInit {

  title = Globals.pages.myProfile.text;

  myData: InstructorData | null = null;

  editPage = Globals.pages.editMyProfile;

  userDataSavingStatus: number = Globals.savingStatus.none;

  constructor(private loginService: LoginService, private instructorService:InstructorService) {

    this.loginService.getLoggedInstructor().then(
      (data) => this.myData = data
    );

    this.instructorService.saveStatusReset();
    this.instructorService.instructorSaveStatus$.subscribe( val => this.userDataSavingStatus = val );
  }

  ngOnInit(): void {
  }

}
