
package de.ivu.elect.jee.presentation.dynamicform;

import java.util.Date;
import java.util.function.Consumer;
import java.util.function.Supplier;

public class LambdaTimestampBetweenProperty extends AbstractTemporalBetweenProperty {

  private static final AbstractTimestampProperty TEMPLATE = new AbstractTimestampProperty() {

    @Override
    public boolean getDefaultRequired() {
      return false;
    }

    @Override
    public String getDefaultLabel() {
      return null;
    }

    @Override
    public void setValue(Date value) {
    }

    @Override
    public Date getValue() {
      return null;
    }
  };

  public LambdaTimestampBetweenProperty(String defaultLabel, AbstractTimestampProperty from, AbstractTimestampProperty to, boolean propertyCrossFieldValidationEnabled) {
    this(defaultLabel, from.isRequired(), from::setValue, from::getValue, to.isRequired(), to::setValue, to::getValue, propertyCrossFieldValidationEnabled);
  }

  public LambdaTimestampBetweenProperty(String defaultLabel, boolean valueFromRequired, Consumer<Date> setterFrom, Supplier<Date> getterFrom, boolean valueToRequired, Consumer<Date> setterTo,
      Supplier<Date> getterTo, boolean propertyCrossFieldValidationEnabled) {
    super(PropertyType.INPUT_CALENDAR_TIME_BETWEEN, TEMPLATE, defaultLabel, valueFromRequired, setterFrom, getterFrom, valueToRequired, setterTo, getterTo, propertyCrossFieldValidationEnabled);
  }
}
