package service.adapter;

import org.jooq.impl.DSL;

import ru.cg.webbpm.modules.database.api.entity_graph.condition.SimpleConditionAdapter;

/**
 * @author r.latypov
 */
public class ProjectRuntimeVariableConditionAdapter extends SimpleConditionAdapter<Object> {

  public ProjectRuntimeVariableConditionAdapter() {
    super(Object.class);
  }

  public Object adapt(String str) {
    return switch (str) {
      case "\"CURRENT_DATE\"" -> DSL.currentDate();
      case "\"CURRENT_TIMESTAMP\"" -> DSL.currentTimestamp();
      default -> null;
    };
  }
}
