package com.acme.structure.exception.main;


import com.acme.structure.exception.base.ApplicationException;
import com.acme.structure.exception.base.InfrastructureException;
import com.acme.structure.util.DateUtility;

import java.util.Date;

public class DateInputConsistencyException extends InfrastructureException
{
    private Date begin;
    private Date end;

    //this class is used if end date is not after begin date

    public DateInputConsistencyException(Date begin, Date end)
    {
        exceptionCode = "14";
        exceptionType = ApplicationException.EXCEPTION_TYPE_ERROR;

        this.begin = begin;
        this.end = end;
    }

    @Override
    public String getReason()
    {
        return DateUtility.convertDateToString(begin) + " <-> " + DateUtility.convertDateToString(end);
    }

}
