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

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

  public initiative: number = 0;

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

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

  public openDetails(): void {
    this.detailsAccessor.openPanel(InitiativeDetailsComponent, {
      initiative: this.initiative,
    });
  }
}
