# Namespace for lsmeans package

# Imports
import(Matrix)
import(methods)
import(mvtnorm)
import(estimability)

# 'requireNamespace' block below allows me to put multcomp in
# Imports instead of Depends. 
if (requireNamespace("multcomp", quietly = TRUE)) {
    importFrom(multcomp, cld, glht, modelparm)
    
    export(cld) # need user to see it even if multcomp not loaded
    
    S3method(cld, ref.grid)
    S3method(cld, lsm.list)
    S3method(glht, lsmlf)
    S3method(glht, ref.grid)
    S3method(modelparm, lsmwrap)
}

if (requireNamespace("plyr", quietly = TRUE)) {
    importFrom(plyr, alply)
}


# Visible exports
exportPattern("*.lsmc")  #all contrast fcns
export(
    as.glht,
    contrast,
    ### is.estble,
    lsm,
    lsm.basis,
    lsmeans, 
    lsmeans.character,  # because it is a generic
    lsmobj,
    lsmip,
    lsm.options,
    lstrends,
    ### nonest.basis,
    recover.data,
    ref.grid,
    regrid,
    test
)    


# S3 methods - 
# For clarity, I'm showing them all 
# but commenting out the ones used only interally

S3method(as.glht, ref.grid)

S3method(confint, ref.grid)
S3method(confint, lsm.list)

S3method(contrast, ref.grid)
S3method(contrast,lsm.list)

#S3method(glht, lsmlf)   # in namespace block above
#S3method(glht, ref.grid)

S3method(lsmeans, character)
S3method(lsmeans.character, default)
S3method(lsmeans.character, ref.grid)
S3method(lsmeans, default)
S3method(lsmeans, formula)
S3method(lsmeans, list)

S3method(lsmip, default)

#S3method(modelparm, lsmwrap) # in namespace block above

S3method(pairs, ref.grid)
S3method(pairs, lsm.list)

S3method(plot, lsmobj)
S3method(plot, summary.ref.grid)

S3method(predict, ref.grid)

S3method(print, ref.grid)
S3method(print, summary.ref.grid)
S3method(print, lsm.list)

S3method(recover.data, call)

S3method(str, ref.grid)
S3method(str, lsm.list)

S3method(summary, ref.grid)
S3method(summary, glht.list)
S3method(summary, lsm.list)

S3method(test, ref.grid)
S3method(test, lsm.list)

S3method(update, ref.grid)

S3method(vcov, ref.grid)

# interim support for old lsmeans function
# removed at version 2.14
#   export(.old.lsmeans)
#   S3method(print, lsm)
#   S3method(print, data.frame.lsm)
