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

import { CourseThemeService } from 'src/app/services/course-theme.service';

import { CourseThemeData } from 'src/app/structures/course-theme-data';

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

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

  allThemes: CourseThemeData[] | null = null;

  newThemePage = Globals.pages.newTheme;

  themeSavingStatus: number = Globals.savingStatus.none;

  constructor(private courseThemeService: CourseThemeService) { 
    this.courseThemeService.courseThemes$.subscribe((data: CourseThemeData[] | null) => {
      this.allThemes = data
    })
    this.courseThemeService.actualizeCourseThemes(); 

    this.courseThemeService.saveStatusReset();
    this.courseThemeService.courseThemeSaveStatus$.subscribe( val => this.themeSavingStatus = val );
  }

  ngOnInit(): void {
  }

}
