import { Component } from '@angular/core';
import { DetailsService } from 'src/services/details/details.service';
import { DataService } from 'src/services/data/data.service';
import { ArmorClassDetailsComponent } from './armor-class-details/armor-class-details.component';

@Component({
  selector: 'armor-class',
  templateUrl: './armor-class.component.html',
  styleUrls: ['./armor-class.component.scss'],
})
export class ArmorClassComponent {
  public constructor(
    public dataAccessor: DataService,
    public detailsAccessor: DetailsService,
  ) {}

  public armorClass: number = 0;

  ngOnInit(): void {
    this.armorClass = this.dataAccessor.armorClass;
  }

  public updateValue(): void {
    this.dataAccessor.armorClass = this.armorClass;
  }

  public openDetails(): void {
    this.detailsAccessor.openPanel(ArmorClassDetailsComponent, {
      armorClass: this.armorClass,
    });
  }
}
