/*
 * @topic T00289 <span style="background-color: yellow;">New: </span>Serial Date class (Spring 2014)
 * @brief class SDate -- finish the TODO pieces
*/

#ifndef _SDATE_H_INCLUDED_
#define _SDATE_H_INCLUDED_

#include "serial_date_utility.h"

class SDate {
    //string dummy;
    int serial_date;
public:
    // Function to set calendar date. Returns:
    // -- false if given month/day/year are invalid
    // -- true if everything is okay.
    bool set( int month_, int day_, int year_ )
    {
        // TODO: validate mm, dd, yyyy
        serial_date = serial_julian_date( month_, day_, year_ );
        return true;
    }

    //----------------------------------------------
    // functions to manipulate serial value
    //----------------------------------------------
    void serial( int serial_ )  // set serial date
    {
        serial_date = serial_;
    }

    int serial()                // get serial date
    {
        return serial_date;
    }

    void add( int days_ )       // add days to serial value
    {
        serial_date = serial_date + days_;
    }

    //----------------------------------------------
    // functions to change or get calendar parts:
    //----------------------------------------------
    void month( int month_ )    // set month
    {
        set( month_, day(), year() );
    }

    int month()                 // get month
    {
        return serial_2_month( serial_date );
    }

    void day( int day_ )        // set day
    {
        // TODO
    }

    int day()                   // get day
    {
        return serial_2_day( serial_date );
    }

    void year( int year_ )      // set year
    {
        // TODO
    }

    int year()                  // get year
    {
        return serial_2_year( serial_date );
    }

};//class SDate

#endif //_SDATE_H_INCLUDED_