package net.woodyfolsom.cs6601.p3.svc;

import java.util.Date;
import java.util.List;

import net.woodyfolsom.cs6601.p3.dao.HeadlineDao;
import net.woodyfolsom.cs6601.p3.domain.Headline;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MySQLHeadlineServiceImpl implements HeadlineService {
	private Log log = LogFactory.getLog(MySQLHeadlineServiceImpl.class);
	
	@Autowired
	private HeadlineDao headlineDao;

	@Override
	public int insertHeadline(Headline headline) {
		return headlineDao.insert(headline);
	}

	@Override
	public int[] insertHeadlines(List<Headline> headlines) {
		return headlineDao.insertBatch(headlines);
	}
	
	@Override
	public List<Headline> getHeadlines(String stock, Date date) {
		return headlineDao.select(stock, date);
	}
	
	@Override
	public List<Headline> getHeadlines(String stock, Date startDate, Date endDate, int dataset) {
		return headlineDao.select(stock, startDate, endDate, dataset);
	}

	@Override
	public boolean assignRandomDatasets(int training/*, int test*/, int validation) {
		return headlineDao.assignRandomDatasets(training/*, test*/, validation);
	}

	@Override
	public int getCount() {
		return headlineDao.getCount();
	}

	@Override
	public int getCount(int dataset) {
		return headlineDao.getCount(dataset);
	}
}