import { Pipe, PipeTransform } from '@angular/core'; import { I18nService } from '@yourcause/common/i18n'; import { RejectAddressRequestReason } from '../address-requests.typing'; @Pipe({ name: 'gcRejectionReason' }) export class RejectionReasonPipe implements PipeTransform { constructor ( private i18n: I18nService ) { } transform (reason: RejectAddressRequestReason) { switch (reason) { case RejectAddressRequestReason.INSUFFICIENT_DOCUMENTATION: return this.i18n.translate( 'GLOBAL:textInsufficientDocumentation', {}, 'Insufficient documentation' ); case RejectAddressRequestReason.NOT_FOR_CHARITABLE_PURPOSE: return this.i18n.translate( 'GLOBAL:textNotForCharitablePurpose', {}, 'Not for charitable purpose' ); default: return this.i18n.translate( 'common:textOther', {}, 'Other' ); } } }