/**
 *
 * @author Vouzoukidou Nelly, email: vuzukid (at) csd (dot) uoc (dot) gr
 */
public class Date {
    private int day;
    private int month;
    private int year;

    public Date() {
        day = 1;
        month = 1;
        year = 2000;
    }

    public Date(int day, int month) {
        this.day = day;
        this.month = month;
        this.year = 2010;
    }

    public Date(int day, int month, int year) {
        this.day = day;
        this.month = month;
        this.year = year;
    }

    /**
     * Returns the day of this date
     * Postcondition: returns a value between 1 and 30
     * @return the day of this date
     */
    public int getDay() {
        return day;
    }

    public int getMonth() {
        return month;
    }

    public int getYear() {
        return year;
    }

    public boolean isLeap() {
        if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * <b>Precondition</b>: the value of day must be in [1, 30]
     * <br>
     * Postcondition: the day of this date changes to the one given as a parameter
     * @param day the new day for this Date object (a variable of type int, in [1, 30])
     * @throws IllegalArgumentException when the given day is not in [1, 30]
     */
    public void setDay(int day) {
        if (day < 1 || day > 30) {
            throw new IllegalArgumentException("Day must be in [1, 30]. Found " + day + " instead");
        }
        this.day = day;
    }

    public void setMonth(int month) {
        if (month < 1 || month > 12) {
            throw new IllegalArgumentException("Month must be in [1, 12]. Found " + month + " instead");
        }
        this.month = month;
    }

//    /**
//     *
//     * @param a is a value ..
//     * @param b
//     * @param c
//     * @return
//     * @throws Exception
//     */
//    public int lala(int a, int b, char c) throws Exception {
//        
//    }

    public void setYear(int year) {
        if (year < 1) {
            throw new IllegalArgumentException("Year must be a positive number. Found " + year + " instead");
        }
        this.year = year;
    }

    public void increaseDays(int days) {
        year += days % 360;
        days -= days / 360;
        month += days % 12;
        month += days / 12;
        day += days;
    }
}
