package de.jottyfan.camporganizer.module.confirmation.board;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import de.jottyfan.camporganizer.module.confirmation.board.model.CampBean;
import de.jottyfan.camporganizer.module.confirmation.board.model.PersonBean;

/**
 *
 * @author jotty
 *
 */
@Service
public class ConfirmationBoardService {

	@Autowired
	private ConfirmationBoardRepository repository;

	@Autowired
	private List2CSVService csvService;

	public List<CampBean> loadCampList(String username) {
		return repository.getCamps(username);
	}

	public List<PersonBean> loadPersonList(String username, Integer campId) {
		return repository.getPersons(username, campId);
	}

	public String getDownloadCsvOfAll(String username, Integer campId) {
		List<PersonBean> list = repository.getPersons(username, campId);
		return csvService.toCsv(list);
	}

	public Object getCampStartDate(String username, Integer campId) {
		return repository.getCampStartDate(username, campId);
	}
}
