//
//  CredentialProviderHandler.swift
//  TrustBuilderMfaSampleApp
//
//  Created by Ludovic Lefevre on 15/06/2023.
//

import Foundation
import TrustBuilderMfaLibSwift
import SwiftUI

struct CredentialProviderHandler  {
    
    func resolveCredentialFromList(listCredProvider : Array<CredentialProvider>) -> CredentialProvider{
        let listCredProviderWithBioOnly = listCredProvider.filter{cp in return cp.credType == CredTypeEnum.BIO}
        let response : CredentialProvider
        if (listCredProviderWithBioOnly.count > 0 ) {
            response = listCredProviderWithBioOnly[0]
        } else {
            response = listCredProvider[0]
        }
        return response
    }
}
