library(needs)
library(dplyr)
needs(xgboost)

attach(input[[1]])
if (file.exists('./viviendas-model.model')) {
    bst <- xgb.load('./viviendas-model.model')
    predictResult <- predict(bst, customerValues)
    returnObject <- list(
        "prediction_result" = prediction_result <- list(
            "request_array"   	  = customerValues,
            "data_request_length" = length(customerValues),
            "prediction_length"   = length(predictResult),
            "prediction_result"   = predictResult
        ),
        "request_status"      =     "ASTEG::SYSTEM::OK",
        "operation_message"   =     "ASTEG::SYSTEM::PREDICTION-COMPLETED"
    )
} else {
    returnObject <- list(
        "request_status"      =     "ASTEG::SYSTEM::FAILED",
        "operation_message"   =     "ASTEG::SYSTEM::PREDICTION-FAILED|NO-MODEL-AVAILABLE"
    )
}
