import { ModalController } from '@ionic/angular/standalone';
import { AgentUserInputComponent } from './agent-user-input/agent-user-input.component';

/**
 * 数据搜集Modal
 * @description
 * https://ionicframework.com/docs/api/modal#controller-modals
 */
export async function getUserInput(modalCtrl:ModalController,options:{fieldsArray:any}){
  const modal = await modalCtrl.create({
    component: AgentUserInputComponent,
    componentProps:{
      fieldsArray:options.fieldsArray
    }
  });
  modal.present();

  const { data, role } = await modal.onWillDismiss();

  if (role === 'confirm') {
    return data;
  }
}