package ch.zhaw.gartenverwaltung.io;

import ch.zhaw.gartenverwaltung.types.Crop;
import ch.zhaw.gartenverwaltung.types.HardinessZone;
import ch.zhaw.gartenverwaltung.types.Plant;
import ch.zhaw.gartenverwaltung.types.Task;

import java.io.IOException;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

/**
 * A database of {@link Task}s.
 * The interface specifies the minimal required operations.
 */
public interface TaskDatabase {
    /**
     * Yields a list of all {@link Task}s in the database with the start and end date of a period of time.
     *
     * @param start The start date of the wanted time period
     * @param end The end date of the wanted time period
     * @return A list of {@link Task}s planned in the specified time period
     * @throws IOException If the database cannot be accessed
     */
    List<Task> getTaskList(LocalDate start, LocalDate end) throws IOException;

    /**
     * Method get all Tasks for a specific Crop
     * @param cropId the cropId
     * @return List of Tasks for given Crop
     * @throws IOException If the database cannot be accessed
     */
    List<Task> getTaskForCrop(long cropId) throws IOException;

    /**
     * Method remove all Tasks for a specific Crop
     * @param cropId the cropId
     * @throws IOException If the database cannot be accessed
     */
    void removeTasksForCrop(long cropId) throws IOException;

    /**
     * Saves the {@link Task} in the Cache.
     *
     * @param task The {@link Task} which is wanted to be saved in the TaskList
     * @throws IOException If the database cannot be accessed
     */
    void saveTask(Task task) throws IOException;

    /**
     * Removes the {@link Task}from the Cache.
     *
     * @param task The {@link Task} which has to be removed from the {@link Task} list.
     * @throws IOException If the database cannot be accessed
     */
    void removeTask(Task task) throws IOException;
}
