<!--
  ~ Copyright (c) 2023 D2ArmorPicker by Mijago.
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU Affero General Public License as published
  ~ by the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU Affero General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Affero General Public License
  ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
<div *ngFor="let itemGroup of exotics; let i = index" [@listAnimation]="itemGroup.length">
  <img
    class="exoticIcon {{ selectedExotics.indexOf(-2) > -1 ? 'selected' : '' }}"
    *ngIf="i === 0"
    src="https://www.bungie.net/common/destiny2_content/icons/763634b78eb22168ac707500588b7333.jpg"
    matTooltip="Force to use ANY exotic (that is NOT a class item)"
    #tooltip="matTooltip"
    (click)="selectExotic(-2, $event)" />
  <img
    class="exoticIcon {{ selectedExotics.indexOf(-1) > -1 ? 'selected' : '' }}"
    *ngIf="i === 0"
    src="https://www.bungie.net/common/destiny2_content/icons/b4d05ef69d0c3227a7d4f7f35bbc2848.png"
    matTooltip="Force to use NO exotic at all"
    #tooltip="matTooltip"
    (click)="selectExotic(-1, $event)" />
  <span class="container" *ngFor="let exotic of itemGroup">
    <img
      class="exoticIcon {{ selectedExotics.indexOf(exotic.item.hash) > -1 ? 'selected' : '' }}"
      src="https://www.bungie.net/{{ exotic.item.icon }}"
      [exoticTooltip]="exotic.item"
      [exoticTooltipInVendor]="!exotic.inInventory && includeVendorRolls && exotic.inVendor"
      [exoticTooltipInCollection]="
        !exotic.inInventory && includeCollectionRolls && exotic.inCollection
      "
      [class.vendor-item]="!exotic.inInventory && includeVendorRolls && exotic.inVendor"
      [class.collection-item]="!exotic.inInventory && includeCollectionRolls && exotic.inCollection"
      [class.disabled]="
        !(
          exotic.inInventory ||
          (includeCollectionRolls && exotic.inCollection) ||
          (includeVendorRolls && exotic.inVendor)
        )
      "
      (click)="
        (exotic.inInventory || (includeCollectionRolls && exotic.inCollection)) &&
          selectExotic(exotic.item.hash, $event)
      " />
    <img
      class="watermarkIcon"
      *ngIf="exotic.item.watermarkIcon"
      src="https://www.bungie.net/{{ exotic.item.watermarkIcon }}" />
    <div
      class="item-source-overlay"
      *ngIf="!exotic.inInventory"
      [class.vendor-item]="includeVendorRolls && exotic.inVendor"
      [class.collection-item]="includeCollectionRolls && exotic.inCollection"></div>
  </span>
</div>

<div>
  <button
    *ngIf="exotics.length === 0 || exotics[0].length === 0"
    mat-raised-button
    color="warn"
    (click)="refreshAll()">
    Manually refresh manifest and inventory
  </button>
</div>

<div>
  <mat-slide-toggle
    color="primary"
    [checked]="includeCollectionRolls"
    (change)="setAllowCollectionRolls($event.checked)">
    Include <u>exotic</u> collection rolls
  </mat-slide-toggle>
</div>
<div>
  <mat-slide-toggle
    color="primary"
    [checked]="includeVendorRolls"
    (change)="setAllowVendorItems($event.checked)">
    Include <u>legendary and exotic</u> vendor armor (slower)
  </mat-slide-toggle>
</div>
<div>
  <mat-slide-toggle
    color="primary"
    [checked]="allowBlueArmorPieces"
    (change)="setAllowBlueArmorPieces($event.checked)">
    Include white, blue and green items
  </mat-slide-toggle>
</div>
<div>
  <mat-slide-toggle
    color="primary"
    [checked]="!ignoreSunsetArmor"
    (change)="setIgnoreSunsetArmor(!$event.checked)">
    Include sunset armor
  </mat-slide-toggle>
</div>
<div>
  <mat-slide-toggle
    color="warn"
    [checked]="ignoreExistingExoticArtificeSlots"
    (change)="setIgnoreExistingExoticArtificeSlots($event.checked)">
    Ignore existing artifice slots on exotics (useful for the exotic class item)
  </mat-slide-toggle>
</div>
