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

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

  public movement: number = 0;

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

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

  public openDetails(): void {
    this.detailsAccessor.openPanel(MovementDetailsComponent, {
      movement: this.movement,
    });
  }
}
