import { Component, ChangeDetectionStrategy, Input, OnInit } from '@angular/core';
import { CustomerSearchType } from '../../defs';

@Component({
  selector: 'page-customer-result-card',
  templateUrl: 'customer-result-card.component.html',
  styleUrls: ['customer-result-card.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomerResultCardComponent implements OnInit {
  @Input()
  customer: CustomerSearchType;
  hasAttributes = 0;

  constructor() {}

  ngOnInit(): void {
    if (this.customer?.loaded && this.customer?.customerType === 16) {
      if (this.customer.organisation?.department) {
        this.hasAttributes++;
      }
      if (this.customer.lastName || this.customer.firstName) {
        this.hasAttributes++;
      }
    }
  }
}
