import {Component, inject, OnInit} from '@angular/core';
import {Meta, Title} from '@angular/platform-browser';
import {ALTITUDE_VERSION} from '@custom-types/constant';
import {RouterOutlet} from '@angular/router';
import {FooterComponent} from '@pages/footer/footer/footer.component';

@Component({
  standalone: true,
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrl: './app.component.scss',
  imports: [
    RouterOutlet,
    FooterComponent
  ]
})
export class AppComponent implements OnInit {
  title = 'Survival Minecraft Server on ' + ALTITUDE_VERSION + '! | Altitude Community';
  title_og = 'Community-centered ' + ALTITUDE_VERSION + ' Survival Minecraft Server';
  description = 'Start your adventure today! We are a ' +
    ALTITUDE_VERSION + ' survival community with McMMO, MyPet, Dynmap, &amp; player shop based economy. ' +
    'Monthly server events. Best community in ' + ALTITUDE_VERSION + '!';
  description_og = 'Start your adventure today! We host ' +
    ALTITUDE_VERSION + ' survival with features suggested by our community: McMMO, MyPet, Dynmap, &amp; economy. ' +
    'Monthly server events...';
  keywords = 'minecraft,survival,server,servers,community,small,vanilla,semivanilla,dynmap,mcmmo,griefing,' +
    ALTITUDE_VERSION + ',altitude,alttd,play,join,find,friends,friendly,simple,private,whitelist,whitelisted,creative,' +
    'worldedit'

  private readonly titleService = inject(Title);
  private readonly metaService = inject(Meta);

  ngOnInit(): void {
    this.titleService.setTitle(this.title)
    this.metaService.updateTag({name: 'description', content: this.description});
    this.metaService.updateTag({name: 'twitter:description', content: this.description_og})
    this.metaService.updateTag({name: 'og:title', content: this.title_og})
    this.metaService.updateTag({name: 'og:description', content: this.description_og})
    this.metaService.updateTag({name: 'keywords', content: this.keywords})
  }

}
