import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/List_BabyInformationModel.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/add_newchild_model.dart';
import 'package:diplomaticquarterapp/core/model/childvaccines/create_vaccination_table.dart';
import 'package:diplomaticquarterapp/core/service/childvaccines/add_new_child_service.dart';
import 'package:diplomaticquarterapp/core/service/childvaccines/vaccination_table_service.dart';

import '../../../locator.dart';
import '../base_view_model.dart';


class VaccinationTableViewModel extends BaseViewModel{

  VaccinationTableService _creteVaccinationTableService = locator<VaccinationTableService>();
  List<CreateVaccinationTable> get creteVaccinationTableModelList=> _creteVaccinationTableService.createVaccinationTableModelList;

  getCreateVaccinationTable(List_BabyInformationModel babyInfo, bool sendEmail) async {
    setState(ViewState.Busy);

    await  _creteVaccinationTableService.getCreateVaccinationTableOrders(babyInfo, sendEmail);//getCreateNewBabyOrders();

    if ( _creteVaccinationTableService.hasError) {
      error =  _creteVaccinationTableService.error;
      setState(ViewState.Error);
    } else
      setState(ViewState.Idle);
  }

}
