package com.service;

import com.entity.Sprint;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;

/**
 *
 * Interface service for the sprint.
 *
 * @author Laurentiu Marcut
 */
@Service
public interface SprintsService {

    /**
     *
     * Select sprint by id.
     *
     * @param project
     * @param id
     * @return sprint
     * @throws SQLException
     */
    @Transactional(readOnly = true)
    Sprint select(String project, int id) throws SQLException;

    /**
     *
     * Select all sprints.
     *
     * @param project
     * @return sprints
     * @throws SQLException
     */
    @Transactional(readOnly = true)
    List<Sprint> selectAll(String project) throws SQLException;

    /**
     *
     * Select all ids.
     *
     * @param project
     * @return ids
     * @throws SQLException
     */
    @Transactional(readOnly = true)
    List<Integer> selectAllIds(String project) throws SQLException;

    /**
     *
     * Select total sprints.
     *
     * @param project
     * @return total sprints
     * @throws SQLException
     */
    @Transactional(readOnly = true)
    int selectTotalSprints(String project) throws SQLException;

    /**
     *
     * Insert sprint.
     *
     * @param id
     * @param project
     * @throws SQLException
     */
    @Transactional
    void insert(int id, String project) throws SQLException;

    /**
     *
     * Delete sprint.
     *
     * @param id
     * @param project
     * @throws SQLException
     */
    @Transactional
    void delete(int id, String project) throws SQLException;

    /**
     *
     * Update start date.
     *
     * @param id
     * @param project
     * @param startDate
     * @throws SQLException
     */
    @Transactional
    void updateStartDate(int id, String project, Date startDate) throws SQLException;

    /**
     *
     * Update end date.
     *
     * @param id
     * @param project
     * @param endDate
     * @throws SQLException
     */
    @Transactional
    void updateEndDate(int id, String project, Date endDate) throws SQLException;

    /**
     *
     * Update total capacity.
     *
     * @param id
     * @param project
     * @param totalCapacity
     * @throws SQLException
     */
    @Transactional
    void updateTotalCapacity(int id, String project, int totalCapacity) throws SQLException;

    /**
     *
     * Update members.
     *
     * @param id
     * @param project
     * @param members
     * @throws SQLException
     */
    @Transactional
    void updateMembers(int id, String project, int members) throws SQLException;

    /**
     *
     * Update state.
     *
     * @param project
     * @param id
     * @param state
     * @throws SQLException
     */
    @Transactional
    void updateState(String project, int id,  String state) throws SQLException;
}
