import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Router } from '@angular/router';
import { SaleProduct } from 'src/app/models/sale-product.model';

@Component({
  selector: 'app-card-product-list',
  templateUrl: './card-product-list.component.html',
  styleUrls: ['./card-product-list.component.scss']
})
export class CardProductListComponent implements OnInit {

  @Input() public product: SaleProduct;

  @Input() public borderTop: boolean;
  @Output() resultDescription = new EventEmitter<string>();

  public getImageUrl(contactId: number): string {
    return `https://www.telerik.com/kendo-angular-ui-develop/components/listview/assets/contacts/${contactId}.png`;
  }

  public getMessagesText(messagesCount: number): string {
    return `${messagesCount} new message${messagesCount > 1 ? 's' : ''}`;
  }
  constructor(
    private readonly router: Router,
  ) { }

  ngOnInit() {
  }

  selectProduct() {
    console.log(this.product.smallDescription);
    this.resultDescription.emit(this.product.smallDescription);
  }

}
