<ion-header>
  <ion-toolbar>
    <ion-buttons slot="start">
      <pwa-back-button></pwa-back-button>
    </ion-buttons>
    <ion-title>Actions</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="ion-padding-top">
  <ion-item-group *ngIf="pkg">

    <!-- ** standard actions ** -->
    <ion-item-divider>Standard Actions</ion-item-divider>
    <app-actions-item
      [action]="{
        name: 'Uninstall',
        description: 'This will uninstall the service from your Embassy and delete all data permanently.',
        icon: 'trash-outline'
      }"
      (click)="uninstall()">
    </app-actions-item>

    <!-- ** specific actions ** -->
    <ion-item-divider *ngIf="!(pkg.manifest.actions | empty)">Actions for {{ pkg.manifest.title }}</ion-item-divider>
    <app-actions-item
      *ngFor="let action of pkg.manifest.actions | keyvalue: asIsOrder"
      [action]="{
        name: action.value.name,
        description: action.value.description,
        icon: 'play-circle-outline'
      }"
      (click)="handleAction(action)">
    </app-actions-item>
  </ion-item-group>
</ion-content>