# only when we have src code
# useDynLib("restriktor")
importFrom("lavaan",
           lavParseModelString,
           #lav_constraints_parse,
           lav_partable_constraints_def,
           lav_func_jacobian_complex,
           lav_func_jacobian_simple,
           lav_partable_constraints_ciq,
           lav_partable_constraints_ceq,
           lav_matrix_vech_idx,
           lav_matrix_vechru_idx,
           lav_matrix_symmetric_sqrt,
           lav_matrix_bdiag,
           lav_matrix_duplication_post,
           lav_matrix_duplication_pre_post,
           lav_samplestats_from_data,
           lav_data_update,
           lav_partable_add,
           lav_model_implied,
           standardizedSolution,
           parTable,
           lavInspect,
           sem,   # conTestD
           lavaan # conTestD
           )

importFrom("mvtnorm",
           #rmvnorm, 
           dmvnorm,
           pmvnorm)

# truncated multivariate normal
importFrom("tmvtnorm",
           rtmvnorm)

importFrom("quadprog",
           solve.QP)

importFrom("boot",
           boot,
           boot.ci)

importFrom("MASS",
           psi.bisquare,
           psi.huber,
           ginv,
           rlm)

#importFrom("pbapply", 
#           pblapply,
#           pboptions)

#importFrom("ic.infer",
           #nchoosek, NOT EXPORTED!
#           ic.weights)

importFrom("utils", packageDescription, capture.output, tail)

importFrom("stats", coef, df.residual, dnorm, fitted,
           formula, frequency, median, model.matrix,
           naresid, pchisq, pf, pnorm, printCoefmat, pt,
           quantile, rchisq, residuals, rnorm, rt, runif,
           sd, start, terms, update, var, vcov, density,
           weighted.residuals, weights, gaussian, lm.fit,
           lm.wfit, mad, coefficients, family, logLik,
           model.frame, anova, optimize, sigma, cov, dist, 
           lm, uniroot, reshape, aggregate, setNames, as.formula,
           nobs) 

importFrom("graphics", abline, axis, box, hist, par)

importFrom("norm", em.norm, prelim.norm, imp.norm, rngseed)

importFrom("ggplot2", ggplot, aes, .data, geom_point, geom_line, geom_hline,theme, unit, margin,
           element_blank, element_text, element_line, scale_y_continuous, 
           scale_x_discrete, labs, guides, guide_legend, scale_color_brewer,
           geom_density, geom_segment, ggtitle, xlab, ylab, element_rect, 
           scale_fill_brewer, scale_color_manual, coord_cartesian,
           scale_linetype_manual, geom_vline, geom_ribbon, scale_x_continuous,
           facet_grid, scale_x_log10, stat_density, after_stat, scale_fill_manual)

importFrom("scales", brewer_pal)

importFrom("gridExtra", grid.arrange)

importFrom("future", plan)

importFrom("future.apply", future_lapply)

importFrom("progressr", progressor, with_progress, handlers)
# export ordinary functions defined in this package
export(restriktor)
export(conLM.lm, conRLM.rlm, conGLM.glm, conMLM.mlm)
export(conTest, iht)
export(conTest_summary)
export(conTest_ceq)
export(conTestC)
export(conTestF.conLM, conTestF.conRLM, conTestF.conGLM)
export(conTestLRT.conLM, conTestLRT.conGLM, conTestLRT.conMLM)
export(conTestScore.conLM, conTestScore.conRLM, conTestScore.conGLM)
export(conTestWald.conRLM)
export(conTestC.restriktor)
export(conTest_ceq.conLM, conTest_ceq.conRLM, conTest_ceq.conGLM)
export(conTestD)
export(bootstrapD)
export(goric, goric.lavaan)
export(calculate_IC_weights)
export(summary.restriktor)
export(conTest_summary.restriktor)
export(logLik.restriktor)
export(coef.restriktor, model.matrix.restriktor)
export(con_weights_boot)
export(coef.con_goric)
export(evSyn, plot.evSyn)
export(calculate_IC_weights, calc_ICweights)
export(print.goric_ICw)
export(benchmark)
export(benchmark_means)
export(benchmark_asymp)

S3method(coef, restriktor)
S3method(model.matrix, restriktor)
S3method(logLik, restriktor)
S3method(print, restriktor)
S3method(print, conTest)
S3method(print, conTestLavaan)
S3method(print, summary.restriktor)
S3method(summary, restriktor)
S3method(print, con_goric)
S3method(summary, con_goric)
S3method(coef, con_goric)
S3method(coef, gorica_est)

#S3method(conTestD, conLavaan)
S3method(conTestC, restriktor)
S3method(conTestLRT, conLM)
S3method(conTestLRT, conGLM)
S3method(conTestLRT, conMLM)
S3method(conTestScore, conLM)
S3method(conTestScore, conRLM)
S3method(conTestScore, conGLM)
S3method(conTestWald, conRLM)
S3method(conTestF, conLM)
S3method(conTestF, conRLM)
S3method(conTestF, conGLM)
S3method(conTest_ceq, conLM)
S3method(conTest_ceq, conRLM)
S3method(conTest_ceq, conGLM)
S3method(conTest_summary, restriktor)

S3method(conLM, lm)
S3method(conRLM, rlm)
S3method(conGLM, glm)
S3method(conMLM, mlm)

S3method(goric, default)
S3method(goric, lm)
S3method(goric, lavaan)
S3method(goric, numeric)
S3method(goric, CTmeta)
S3method(goric, rma)
S3method(goric, nlmerMod)
S3method(goric, glmerMod)
S3method(goric, lmerMod)

S3method(plot, evSyn)
S3method(print, evSyn)
S3method(summary, evSyn)
S3method(print, summary.evSyn)

S3method(print, goric_ICw)

S3method(print, benchmark)
S3method(plot, benchmark)
S3method(print, benchmark_plot)