package ru.micord.ervu.service.form;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import ru.micord.ervu.component.field.BaseFieldLoadComponent;
import model.BpmnVariableForSave;
import model.FieldData;
import service.container.AbstractFormService;
import utils.FormUtils;

import ru.cg.webbpm.modules.database.bean.entity_graph.EntityColumn;

/**
 * @author gulnaz
 */
public class LoadFormService extends AbstractFormService {

  @Override
  protected Object saveDataById(Object o, List<FieldData> list) {
    throw new UnsupportedOperationException();
  }

  @Override
  protected Map<EntityColumn, Object> getValuesForSave(Object o, List<FieldData> list) {
    throw new UnsupportedOperationException();
  }

  @Override
  protected List<FieldData> loadData(Object dto, List<String> loadableComponentIds) {
    List<FieldData> fieldData = new ArrayList<>();
    FormUtils.getFormComponents(this, BaseFieldLoadComponent.class)
        .forEach(component -> {
          FieldData data = component.loadFrom(dto);
          fieldData.add(data);
        });

    return fieldData;
  }

  @Override
  public Object saveData(String s, List<FieldData> list, Boolean aBoolean,
      List<BpmnVariableForSave> list1) throws Exception {
    throw new UnsupportedOperationException();
  }

  @Override
  public List<FieldData> loadData() {
    throw new UnsupportedOperationException();
  }

  @Override
  public Object deleteData(Object o) {
    throw new UnsupportedOperationException();
  }

  @Override
  public Object deleteData(String s, List<BpmnVariableForSave> list) {
    throw new UnsupportedOperationException();
  }

  @Override
  public Object parseId(String s) {
    return null;
  }
}
