// Path: backbone/src/main/java/org/researchstack/backbone/ui/step/body/BodyAnswer.java
// public class BodyAnswer {
//     public static final BodyAnswer VALID = new BodyAnswer(true, 0);
//     public static final BodyAnswer INVALID = new BodyAnswer(false,
//             R.string.rsb_invalid_answer_default);
// 
//     private boolean isValid;
//     private int reason;
//     private String[] params;
// 
//     public BodyAnswer(boolean isValid, @StringRes int reason, String... params) {
//         this.isValid = isValid;
//         this.reason = reason;
//         this.params = params;
//     }
// 
//     public boolean isValid() {
//         return isValid;
//     }
// 
//     @StringRes
//     public int getReason() {
//         return reason;
//     }
// 
//     public String[] getParams() {
//         return params;
//     }
// 
//     public String getString(Context context) {
//         if (getParams().length == 0) {
//             return context.getString(getReason());
//         } else {
//             return context.getString(getReason(), getParams());
//         }
//     }
// }
// 
// Path: backbone/src/main/java/org/researchstack/backbone/utils/FormatHelper.java
// public class FormatHelper {
// 
//     public static final int NONE = -1;
//     public static final String DATE_FORMAT_ISO_8601 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
//     public static final SimpleDateFormat DEFAULT_FORMAT = new SimpleDateFormat(FormatHelper.DATE_FORMAT_ISO_8601,
//             Locale.getDefault());
//     public static final String DATE_FORMAT_SIMPLE_DATE = "yyyy-MM-dd";
//     public static final SimpleDateFormat SIMPLE_FORMAT_DATE = new SimpleDateFormat(
//             DATE_FORMAT_SIMPLE_DATE,
//             Locale.getDefault());
//     private FormatHelper() {
//     }
// 
//     /**
//      * Helper method to return a formatter suitable for
//      * {@link ConsentSignatureStepLayout}
//      *
//      * @return DateFormat that is a DateInstance (only formats y, m, and d attributes)
//      */
//     public static DateFormat getSignatureFormat() {
//         return getFormat(DateFormat.SHORT, NONE);
//     }
// 
//     /**
//      * Returns a DateFormat object based on the dateStyle and timeStyle params
//      *
//      * @param dateStyle style for the date defined by static constants within {@link DateFormat}
//      * @param timeStyle style for the time defined by static constants within {@link DateFormat}
//      * @return DateFormat object
//      */
//     public static DateFormat getFormat(int dateStyle, int timeStyle) {
//         // Date & Time format
//         if (isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getDateTimeInstance(dateStyle, timeStyle);
//         }
// 
//         // Date format
//         else if (isStyle(dateStyle) && !isStyle(timeStyle)) {
//             return DateFormat.getDateInstance(dateStyle);
//         }
// 
//         // Time format
//         else if (!isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getTimeInstance(timeStyle);
//         }
// 
//         // Else crash since the styles are invalid
//         else {
//             throw new IllegalArgumentException("dateStyle and timeStyle cannot both be ");
//         }
//     }
// 
//     public static boolean isStyle(int style) {
//         return style >= DateFormat.FULL && style <= DateFormat.SHORT;
//     }
// 
// }


import org.researchstack.backbone.R;
import org.researchstack.backbone.ui.step.body.BodyAnswer;
import org.researchstack.backbone.utils.FormatHelper;
import java.util.Date;
     * Returns the minimum allowed date.
     * <p>
     * When the value of this property is <code>null</code>, there is no minimum.
     *
     * @return returns the minimum allowed date, or null
     */
    public Date getMinimumDate() {
        return minimumDate;
    }

    /**
     * The maximum allowed date.
     * <p>
     * When the value of this property is <code>null</code>, there is no maximum.
     *
     * @return returns the maximum allowed date, or null
     */
    public Date getMaximumDate() {
        return maximumDate;
    }

    @Override
    public QuestionType getQuestionType() {
        if (style == DateAnswerStyle.Date) return Type.Date;
        if (style == DateAnswerStyle.DateAndTime) return Type.DateAndTime;
        if (style == DateAnswerStyle.TimeOfDay) return Type.TimeOfDay;

        return Type.None;
    }

// Path: backbone/src/main/java/org/researchstack/backbone/ui/step/body/BodyAnswer.java
// public class BodyAnswer {
//     public static final BodyAnswer VALID = new BodyAnswer(true, 0);
//     public static final BodyAnswer INVALID = new BodyAnswer(false,
//             R.string.rsb_invalid_answer_default);
// 
//     private boolean isValid;
//     private int reason;
//     private String[] params;
// 
//     public BodyAnswer(boolean isValid, @StringRes int reason, String... params) {
//         this.isValid = isValid;
//         this.reason = reason;
//         this.params = params;
//     }
// 
//     public boolean isValid() {
//         return isValid;
//     }
// 
//     @StringRes
//     public int getReason() {
//         return reason;
//     }
// 
//     public String[] getParams() {
//         return params;
//     }
// 
//     public String getString(Context context) {
//         if (getParams().length == 0) {
//             return context.getString(getReason());
//         } else {
//             return context.getString(getReason(), getParams());
//         }
//     }
// }
// 
// Path: backbone/src/main/java/org/researchstack/backbone/utils/FormatHelper.java
// public class FormatHelper {
// 
//     public static final int NONE = -1;
//     public static final String DATE_FORMAT_ISO_8601 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
//     public static final SimpleDateFormat DEFAULT_FORMAT = new SimpleDateFormat(FormatHelper.DATE_FORMAT_ISO_8601,
//             Locale.getDefault());
//     public static final String DATE_FORMAT_SIMPLE_DATE = "yyyy-MM-dd";
//     public static final SimpleDateFormat SIMPLE_FORMAT_DATE = new SimpleDateFormat(
//             DATE_FORMAT_SIMPLE_DATE,
//             Locale.getDefault());
//     private FormatHelper() {
//     }
// 
//     /**
//      * Helper method to return a formatter suitable for
//      * {@link ConsentSignatureStepLayout}
//      *
//      * @return DateFormat that is a DateInstance (only formats y, m, and d attributes)
//      */
//     public static DateFormat getSignatureFormat() {
//         return getFormat(DateFormat.SHORT, NONE);
//     }
// 
//     /**
//      * Returns a DateFormat object based on the dateStyle and timeStyle params
//      *
//      * @param dateStyle style for the date defined by static constants within {@link DateFormat}
//      * @param timeStyle style for the time defined by static constants within {@link DateFormat}
//      * @return DateFormat object
//      */
//     public static DateFormat getFormat(int dateStyle, int timeStyle) {
//         // Date & Time format
//         if (isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getDateTimeInstance(dateStyle, timeStyle);
//         }
// 
//         // Date format
//         else if (isStyle(dateStyle) && !isStyle(timeStyle)) {
//             return DateFormat.getDateInstance(dateStyle);
//         }
// 
//         // Time format
//         else if (!isStyle(dateStyle) && isStyle(timeStyle)) {
//             return DateFormat.getTimeInstance(timeStyle);
//         }
// 
//         // Else crash since the styles are invalid
//         else {
//             throw new IllegalArgumentException("dateStyle and timeStyle cannot both be ");
//         }
//     }
// 
//     public static boolean isStyle(int style) {
//         return style >= DateFormat.FULL && style <= DateFormat.SHORT;
//     }
// 
// }


// Path: backbone/src/main/java/org/researchstack/backbone/answerformat/DateAnswerFormat.java
import org.researchstack.backbone.R;
import org.researchstack.backbone.ui.step.body.BodyAnswer;
import org.researchstack.backbone.utils.FormatHelper;
import java.util.Date;

     * Returns the minimum allowed date.
     * <p>
     * When the value of this property is <code>null</code>, there is no minimum.
     *
     * @return returns the minimum allowed date, or null
     */
    public Date getMinimumDate() {
        return minimumDate;
    }

    /**
     * The maximum allowed date.
     * <p>
     * When the value of this property is <code>null</code>, there is no maximum.
     *
     * @return returns the maximum allowed date, or null
     */
    public Date getMaximumDate() {
        return maximumDate;
    }

    @Override
    public QuestionType getQuestionType() {
        if (style == DateAnswerStyle.Date) return Type.Date;
        if (style == DateAnswerStyle.DateAndTime) return Type.DateAndTime;
        if (style == DateAnswerStyle.TimeOfDay) return Type.TimeOfDay;

        return Type.None;
    }

    public BodyAnswer validateAnswer(Date resultDate) {