import { Component, Input } from "@angular/core";

import { CollectionView } from "@bitwarden/common/vault/models/view/collection.view";

@Component({
  selector: "app-collection-badge",
  templateUrl: "collection-name-badge.component.html",
})
export class CollectionNameBadgeComponent {
  @Input() collectionIds: string[];
  @Input() collections: CollectionView[];

  get shownCollections(): string[] {
    return this.showXMore ? this.collectionIds.slice(0, 2) : this.collectionIds;
  }

  get showXMore(): boolean {
    return this.collectionIds.length > 3;
  }

  get xMoreCount(): number {
    return this.collectionIds.length - 2;
  }
}
