import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { Player } from '../../app.model';

@Component({
  selector: 'app-night-shop',
  imports: [],
  templateUrl: './night-shop.component.html',
  styleUrl: './night-shop.component.scss'
})
export class NightShopComponent {
  constructor(
    public dialogRef: MatDialogRef<NightShopComponent>,
    @Inject(MAT_DIALOG_DATA) public data: { player: Player }
  ) { }

  skipToNextDay(): void {
    const currentDay = sessionStorage.getItem('currentDay');
    let nextDay = 1;

    if (currentDay !== null) {
      nextDay = parseInt(currentDay, 10) + 1;
    }

    sessionStorage.setItem('currentDay', nextDay.toString());
    this.dialogRef.close();
  }
}
