/*
 * MIT License
 *
 * Copyright (c) 2018-2019 Daniel Cortes
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package danielcortes.xyz.models.calculo_fondo;

import danielcortes.xyz.models.caja.Caja;
import java.util.List;
import java.util.Optional;

public interface CalculoFondoDAO {

  /**
   * Obtiene todos los CalculoFondo
   * @return Una lista con los CalculoFondo
   */
  List<CalculoFondo> getAll();

  /**
   * Obtiene una lista con los CalculoFondo de una Caja
   * @param caja Caja a la que pertencen los CalculoFondo
   * @return Una lista con los CalculoFondo
   */
  List<CalculoFondo> getByCaja(Caja caja);

  /**
   * Obtiene un CalculoFondo dado su Id.
   * @param id Id del CalculoFondo
   * @return Un optional que puede contener el Calculo fondo o puede estar vacio.
   */
  Optional<CalculoFondo> getById(int id);

  /**
   * Obtiene la suma de los valores del CalculoFondo de una Caja.
   * @param caja Caja a la que pertencen los CalculoFondo a sumar
   * @return La suma de los valores. En caso que la caja sea Caja.EMPTY retornara 0
   */
  int getTotalCalculoFondo(Caja caja);

  /**
   * Guarda un CalculoFondo, le otorga un id una vez guardada.
   * @param calculoFondo CalculoFondo a guardar
   */
  void insert(CalculoFondo calculoFondo);

  /**
   * Actualiza un CalculoFondo
   * @param calculoFondo CalculoFondo a actualizar
   */
  void update(CalculoFondo calculoFondo);

  /**
   * Elimina un CalculoFondo
   * @param calculoFondo CalculoFondo a eliminar
   */
  void delete(CalculoFondo calculoFondo);
}
