package com.goafanti.report.bo;

import java.util.Calendar;
import java.util.Date;

import org.apache.commons.lang3.time.DateFormatUtils;

import com.goafanti.common.constant.AFTConstants;
import com.goafanti.common.utils.DateUtils;

public class ReportDate {

	private Date	dailyStart;
	private Date	dailyEnd;
	private Date	weeklyStart;
	private Date	weeklyEnd;
	private Date	monthStart;
	private Date	monthEnd;
	private Date	quarterStart;
	private Date	quarterEnd;
	private Date	yearStart;
	private Date	yearEnd;

	public ReportDate(Date startTime) {
		Calendar start = DateUtils.setMidnight(new Calendar.Builder().setInstant(startTime).build());
		this.dailyStart = start.getTime();
		this.dailyEnd = DateUtils.addDays(start.getTime(), 1);
		this.weeklyStart = DateUtils.getFirstDayOfWeek(startTime);
		this.weeklyEnd = DateUtils.addDays(DateUtils.getLastDayOfWeek(startTime), 1);
		this.monthStart = DateUtils.getFirstDayOfMonth(start.get(Calendar.YEAR), start.get(Calendar.MONTH));
		this.monthEnd = DateUtils
				.addDays(DateUtils.getLastDayOfMonth(start.get(Calendar.YEAR), start.get(Calendar.MONTH)), 1);
		this.quarterStart = DateUtils.getFirstDayOfQuarter(startTime);
		this.quarterEnd = DateUtils.addDays(DateUtils.getLastDayOfQuarter(startTime), 1);
		this.yearStart = DateUtils.setMidnight(new Calendar.Builder().setDate(start.get(Calendar.YEAR), 0, 1).build())
				.getTime();
		this.yearEnd = DateUtils.setMidnight(new Calendar.Builder().setDate(start.get(Calendar.YEAR) + 1, 0, 1).build())
				.getTime();
	}

	public Date getDailyStart() {
		return dailyStart;
	}

	public void setDailyStart(Date dailyStart) {
		this.dailyStart = dailyStart;
	}

	public Date getDailyEnd() {
		return dailyEnd;
	}

	public void setDailyEnd(Date dailyEnd) {
		this.dailyEnd = dailyEnd;
	}

	public Date getWeeklyStart() {
		return weeklyStart;
	}

	public void setWeeklyStart(Date weeklyStart) {
		this.weeklyStart = weeklyStart;
	}

	public Date getWeeklyEnd() {
		return weeklyEnd;
	}

	public void setWeeklyEnd(Date weeklyEnd) {
		this.weeklyEnd = weeklyEnd;
	}

	public Date getMonthStart() {
		return monthStart;
	}

	public void setMonthStart(Date monthStart) {
		this.monthStart = monthStart;
	}

	public Date getMonthEnd() {
		return monthEnd;
	}

	public void setMonthEnd(Date monthEnd) {
		this.monthEnd = monthEnd;
	}

	public Date getQuarterStart() {
		return quarterStart;
	}

	public void setQuarterStart(Date quarterStart) {
		this.quarterStart = quarterStart;
	}

	public Date getQuarterEnd() {
		return quarterEnd;
	}

	public void setQuarterEnd(Date quarterEnd) {
		this.quarterEnd = quarterEnd;
	}

	public Date getYearStart() {
		return yearStart;
	}

	public void setYearStart(Date yearStart) {
		this.yearStart = yearStart;
	}

	public Date getYearEnd() {
		return yearEnd;
	}

	public void setYearEnd(Date yearEnd) {
		this.yearEnd = yearEnd;
	}
	public String getStringDailyEnd() {
		return DateFormatUtils.format(this.getDailyEnd(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringDailyStart() {
		return DateFormatUtils.format(this.getDailyStart(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringWeeklyStart() {
		return DateFormatUtils.format(this.getWeeklyStart(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringWeeklyEnd() {
		return DateFormatUtils.format(this.getWeeklyEnd(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringMonthStart() {
		return DateFormatUtils.format(this.getMonthStart(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringMonthEnd() {
		return DateFormatUtils.format(this.getMonthEnd(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringYearStart() {
		return DateFormatUtils.format(this.getYearStart(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringYearEnd() {
		return DateFormatUtils.format(this.getYearEnd(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringQuarterStart() {
		return DateFormatUtils.format(this.getQuarterStart(), AFTConstants.YYYYMMDDHHMMSS);
	}
	public String getStringQuarterEnd() {
		return DateFormatUtils.format(this.getQuarterEnd(), AFTConstants.YYYYMMDDHHMMSS);
	}
	
}
