# Methods needed from other packages
importFrom(stats, confint, fitted, coef, vcov, predict, update, profile,
           simulate, residuals, logLik, as.formula, binomial, cov, dbinom,
           dmultinom, dnbinom, dnorm, dpois, formula,
           glm.fit, integrate, median, model.frame,
           model.matrix, model.offset, na.omit, optim, pchisq, plogis,
           pnorm, qchisq, qnorm, quantile, rbinom,
           reshape, rmultinom, rnbinom, rpois, runif, sd, uniroot,
           update.formula, sigma)
importFrom(graphics, plot, hist, abline, axis, lines, points, polygon, segments)
importFrom(utils, head, read.csv)
importFrom(grDevices, devAskNewPage, dev.interactive, palette.colors)
importFrom(MASS, mvrnorm)
importFrom(parallel, detectCores, makeCluster, stopCluster, clusterExport,
           clusterEvalQ)
importFrom(methods, is, as, new, show, slot, .hasSlot, callGeneric, 
           callNextMethod, setMethod)
importFrom(lattice, xyplot, levelplot)
importFrom(Rcpp, evalCpp)
importFrom(pbapply, pbsapply, pblapply)


# Fitting functions
export(occu, occuFP, occuRN, pcount, pcountOpen, multinomPois, distsamp,
       colext, gmultmix, gdistsamp, gpcount, occuPEN, occuPEN_CV, occuMulti,
       occuMS, computeMPLElambda, pcount.spHDS, occuTTD, distsampOpen,
       multmixOpen, nmixTTD, gdistremoval)
export(removalPiFun, doublePiFun)
export(makeRemPiFun, makeCrPiFun, makeCrPiFunMb, makeCrPiFunMh)

# S4 classes
exportClasses(unmarkedFit, unmarkedFitOccu, unmarkedFitOccuFP, unmarkedFitDS,
              unmarkedFitPCount, unmarkedFitMPois, unmarkedFitPCO,
              unmarkedFrameDSO, unmarkedFitDSO,
              unmarkedFrameMMO, unmarkedFitMMO,
              unmarkedFitOccuMulti,
              unmarkedFrame, unmarkedFrameOccu, unmarkedFramePCount,
              unmarkedFrameMPois, unmarkedFrameDS, unmarkedMultFrame,
              unmarkedFrameGMM, unmarkedFrameGDS, unmarkedFramePCO,
              unmarkedFrameGPC, unmarkedEstimate, unmarkedFitList,
              unmarkedModSel, unmarkedRanef, unmarkedFrameOccuMulti,
              unmarkedFrameOccuMS, unmarkedFrameGDR, unmarkedCrossVal,
              unmarkedPostSamples, unmarkedPower, unmarkedPowerList)

# Methods
exportMethods(backTransform, coef, confint, coordinates, fitted, getData,
              getP, getFP, getB, getY, head, hessian, linearComb, mle,
              modSel, nllFun, numSites, numY, obsCovs, obsNum, "obsCovs<-",
              obsToY, "obsToY<-", parboot, plot, hist, predict, profile,
              projection, residuals, sampleSize, SE, show, simulate, siteCovs,
              "siteCovs<-", summary, update, vcov, yearlySiteCovs,
              "yearlySiteCovs<-", "[", smoothed, projected, nonparboot, logLik,
              LRT, ranef, bup, crossVal, posteriorSamples, sigma, randomTerms, 
              optimizePenalty, unmarkedPowerList, plotEffectsData, plotEffects)

S3method("print", "unmarkedPostSamples")

# Constructors
export(unmarkedEstimate, fitList, mapInfo, unmarkedFrame,
    unmarkedFrameOccu, unmarkedFrameOccuFP, unmarkedFramePCount, unmarkedFrameMPois,
    unmarkedFrameDS, unmarkedMultFrame, unmarkedFrameGMM,
    unmarkedFramePCO, unmarkedFrameGDS, unmarkedFrameGPC, unmarkedFrameOccuMulti,
    unmarkedFrameOccuMS, unmarkedFrameOccuTTD, unmarkedFrameDSO, 
    unmarkedFrameMMO, unmarkedFrameGDR)

# Formatting
export(csvToUMF, formatLong, formatWide, formatMult, formatDistData)

# Misc
export(imputeMissing, gxhn, gxexp, gxhaz, dxhn, dxexp, dxhaz, drhn, drexp,
    drhaz, grhn, grexp, grhaz, sight2perpdist, lambda2psi, SSE, vif, powerAnalysis,
    shinyPower)

useDynLib("unmarked", .registration=TRUE)
useDynLib(unmarked_TMBExports)
