package com.smppw.common.pojo.dto;

import com.smppw.constants.Consts;
import com.smppw.common.pojo.enums.TimeRange;
import org.joda.time.DateTime;

/**
 * @author Yu Liu
 *
 */
public class DateRange {
	private String startDate;
	private String endDate;

	private String retStartDate;
	private String navEndDate;

	private TimeRange timeRange;

	public TimeRange getTimeRange() {
		return timeRange;
	}

	public void setTimeRange(TimeRange timeRange) {
		this.timeRange = timeRange;
	}

	public String getRetStartDate() {
		return retStartDate;
	}

	public void setRetStartDate(String retStartDate) {
		this.retStartDate = retStartDate;
	}

	public String getNavEndDate() {
		return navEndDate;
	}

	public void setNavEndDate(String navEndDate) {
		this.navEndDate = navEndDate;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public DateRange(String startDate, String endDate) {
		super();
		this.startDate = startDate;
		this.endDate = endDate;
	}

	public DateRange(String startDate, String endDate, TimeRange timeRange) {
		super();
		this.startDate = startDate;
		this.endDate = endDate;
		this.timeRange = timeRange;
	}

	public DateRange(String dateRangeStr) {
		String[] arr = dateRangeStr.split("~");
		this.startDate = arr[0];
		this.endDate = arr[1];
	}

	public DateRange(DateTime startDate, DateTime endDate) {
		super();
		this.startDate = startDate.toString(Consts.DEFAULT_DATE_PATTERN);
		this.endDate = endDate.toString(Consts.DEFAULT_DATE_PATTERN);
	}

	public DateRange() {
		super();
	}

//	public boolean include(String date) {
//		DateConvertor convertor = new DateConvertorImpl();
//
//		int startIndex = convertor.convertToIndex(startDate);
//		int endIndex = convertor.convertToIndex(endDate);
//		int index = convertor.convertToIndex(date);
//
//		return startIndex <= index && index <= endIndex;
//	}

	@Override
	public String toString() {
		return startDate + "~" + endDate;
	}

}
