import { InputClaimModel } from './InputClaimModel' ; /**
 * Base class for input attestations
 */ export abstract class BaseAttestationModel { param mapping param encrypted param claims param required param id constructor ( public mapping ? , public encrypted = false , public claims ? , public required = false , private _id ? ) { } /**
     * Mapping keys of all index claims.
     */ public get indexClaims ( ) : string [ ] { if ( ! this . mapping ) { return [ ] ; } return Object . entries ( this . mapping ) . filter ( ( [ _ , { indexed } ] ) => indexed ) . map ( ( [ name ] ) => name ) ; } /**
     * Gets the name of the attestation
     */ abstract get name ( ) : string ; /**
     * Gets the id of the attestation
     */ get id ( ) : string { return this . _id ?? this . name ; } toJSON ( ) { return { id : this . id , mapping : this . mapping , encrypted : this . encrypted , claims : this . claims , required : this . required , } ; } param input populateFrom ( input ) { this . encrypted = input . encrypted ; this . claims = input . claims ; this . mapping = { } ; this . required = input . required ; this . _id = input . id ; if ( input . mapping ) { for ( let key of Object . keys ( input . mapping ) ) { let claim = new InputClaimModel ( ) ; claim . populateFrom ( input . mapping [ key ] ) ; this . mapping [ key ] = claim ; } } } /**
     * Create a IdTokenAttestationModel for an input resource
     */ forInput ( ) { const arr = [ ] ; for ( let key in this . mapping ) { arr . push ( this . mapping ! [ key ] . forInput ( ) ) ; } return this . createForInput ( arr ) ; } param claims protected abstract createForInput ( claims ) ; }