#' @title Wrapper für die Berechnung des Umlageergebnisses und der Bilanz
#'
#' @description Dieser Wrapper buendelt die Berechnung des Umlageergebnisses,
#' des Ertrags der Anlagen, des Betriebsergebnisses und des Fondsstandes der AHV
#'
#' @param tl_inp List of input data frames.
#'
#' @param tl_hauptberechnung List of processed input data frames containing the
#' important components of the budget.
#'
#' @param tl_vorb_berechn List of preprocessed input data frames.
#'
#' @return a `tidylist` containing the following tidy data frames:
#' - `tl_out_ahv_umlage`
#' - `tl_out_ahv_bilanz`
#'
#' @author [MAS BSV](mailto:sekretariat.mas@bsv.admin.ch)
#'
#' @export

wrap_ahv_ergebnisse <- function(tl_inp,
                                tl_hauptberechnung,
                                tl_vorb_berechn) {
    
    print("Run module: wrap_ahv_ergebnisse")
    
    # Berechnung von Umlageergebnissen, Ertrag der Anlagen, Betriebsergebnis und 
    # Fondsstand AHV.
    AHV_BILANZ <- mod_ahv_bilanz(
        PARAM_GLOBAL = tl_inp$PARAM_GLOBAL,
        AHV_AUSGABEN = tl_hauptberechnung$AHV_AUSGABEN,
        AHV_EINNAHMEN = tl_hauptberechnung$AHV_EINNAHMEN,
        ZINS = tl_vorb_berechn$ZINS,
        AHV_ABRECHNUNG = tl_vorb_berechn$AHV_ABRECHNUNG,
        IV_SCHULD = tl_vorb_berechn$IV_SCHULD)
    
    return(list(AHV_BILANZ = AHV_BILANZ))
}
