import { Component, Input } from '@angular/core';
import { SimpleItem } from 'src/interfaces/interfaces';
import { DetailsService } from 'src/services/details/details.service';

@Component({
  selector: 'simple-item-details',
  templateUrl: './simple-item-details.component.html',
  styleUrl: './simple-item-details.component.scss',
})
export class SimpleItemDetailsComponent {
  public constructor(public detailsAccessor: DetailsService) {}
  @Input() item!: any;

  public close(result: string): void {
    this.detailsAccessor.closePanel(result);
  }
  isSimpleItem(item: any): item is SimpleItem {
    return item && (item as SimpleItem).value !== undefined;
  }
}
