<form [formGroup]="formGroup" [bitSubmit]="load">
  <bit-callout *ngIf="hideEmail" type="warning" title="{{ 'warning' | i18n }}">
    {{ "viewSendHiddenEmailWarning" | i18n }}
    <a bitLink href="https://bitwarden.com/help/receive-send/" target="_blank" rel="noreferrer">{{
      "learnMore" | i18n
    }}</a
    >.
  </bit-callout>
  <ng-container *ngIf="!loading; else spinner">
    <app-send-access-password
      (setPasswordEvent)="setPassword($event)"
      *ngIf="passwordRequired && !error"
    ></app-send-access-password>
    <bit-no-items [icon]="sendIcon" class="tw-text-main" *ngIf="unavailable">
      <ng-container slot="description">{{ "sendAccessUnavailable" | i18n }}</ng-container>
    </bit-no-items>
    <bit-no-items [icon]="sendIcon" class="tw-text-main" *ngIf="error">
      <ng-container slot="description">{{ "unexpectedErrorSend" | i18n }}</ng-container>
    </bit-no-items>
    <div *ngIf="!passwordRequired && send && !error && !unavailable">
      <p class="tw-text-center">
        <b>{{ send.name }}</b>
      </p>
      <hr />
      <!-- Text -->
      <ng-container *ngIf="send.type === sendType.Text">
        <app-send-access-text [send]="send"></app-send-access-text>
      </ng-container>
      <!-- File -->
      <ng-container *ngIf="send.type === sendType.File">
        <app-send-access-file
          [send]="send"
          [decKey]="decKey"
          [accessRequest]="accessRequest"
        ></app-send-access-file>
      </ng-container>
      <p *ngIf="expirationDate" class="tw-text-center tw-text-muted">
        Expires: {{ expirationDate | date: "medium" }}
      </p>
    </div>
  </ng-container>
  <ng-template #spinner>
    <div class="tw-text-center">
      <i
        class="bwi bwi-spinner bwi-spin bwi-2x tw-text-muted"
        title="{{ 'loading' | i18n }}"
        aria-hidden="true"
      ></i>
      <span class="tw-sr-only">{{ "loading" | i18n }}</span>
    </div>
  </ng-template>
</form>
