using TIAM.Entities.Transfers; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models; using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels; namespace TIAMMobileApp.Services { public class WizardProcessor : IWizardProcessor { public ITransferDataService transferDataService { get; set; } public IUserDataService userDataService { get; set; } public WizardProcessor(ITransferDataService transferDataService, IUserDataService userDataService) { this.transferDataService = transferDataService; this.userDataService = userDataService; } public async Task ProcessWizardAsync(Type type, object data) where TModelType: class { switch (type.Name) { case "TransferDestinationWizardModel": var result = await transferDataService.CreateTransferDestination((TransferDestination)data); return result as TModelType; //var a = new WizardProcessorResult(); //a.Model = result; //return a as TResult; case "ServiceProvider": return null; default: return null; } } public Task ValidateWizardStepAsync(Type type, string fieldName, object fieldValue) { //if type is TransferDestination, then validate the field name //if (type.Name == "TransferDestination") // return await TransferDataService.ValidateDestination(fieldName); //if type is ServiceProvider, then validate the field name //if type is something else, then throw an exception throw new NotImplementedException(); } } }