# load symbol table
useDynLib(xts, .registration = TRUE, .fixes = "C_")

# non-base package imports
importFrom(stats,
  lag,
  time,
  sd,
  median,
  na.omit,
  na.action,
  na.pass,
  start,
  end,
  window,
  setNames,
  ts,
  as.ts,
  frequency,
  tsp,
  'tsp<-')

importFrom(methods,
  hasArg)

importFrom(grDevices,
  xy.coords)

importFrom(graphics,
  abline,
  clip,
  legend,
  lines,
  par,
  plot,
  plot.new,
  plot.window,
  polygon,
  segments,
  text)

importFrom(utils,
  str,
  tail)

# xts exports
export(.parseISO8601)

export(firstof,
       lastof)

export(is.timeBased,
       timeBased,
       timeBasedRange,
       timeBasedSeq)

export(.indexsec,
       .indexmin,
       .indexhour,
       .indexday,
       .indexDate,
       .indexmon,
       .indexmday,
       .indexwday,
       .indexyday,
       .indexisdst,
       .indexyear,
       .indexweek)

export(isOrdered)

export(.subset.xts)
export(.subset_xts)

# user visible core xts functions
export(xts, .xts)
export(as.xts)
export(is.xts)
export(endpoints)
export(align.time)
export(shift.time)
export(adj.time)
export(make.index.unique)
export(make.time.unique)
export(is.time.unique)
export(is.index.unique)
export(dimnames.xts)
export('dimnames<-.xts')
export(xcoredata)
export('xcoredata<-')
export(.index)
export('.index<-')
export(xtsible)
export(as.environment.xts)
export(use.xts, try.xts)
export(Reclass, use.reclass)
export(reclass)

export(CLASS)
export('CLASS<-')
export(indexFormat)
export('indexFormat<-')
export(tformat)
export('tformat<-')

export(indexClass)
export('indexClass<-')
export(tclass)
export('tclass<-')

export(indexTZ)
export('indexTZ<-')
export(tzone)
export('tzone<-')

export(convertIndex)
export(nseconds,
       nminutes,
       nhours,
       ndays,
       nweeks,
       nmonths,
       nquarters,
       nyears)
export(to_period) # testing
export(to.period,
       to.minutes,
       to.minutes3,
       to.minutes5,
       to.minutes10,
       to.minutes15,
       to.minutes30,
       to.hourly,
       to.daily,
       to.weekly,
       to.monthly,
       to.quarterly,
       to.yearly)
export(xtsAttributes)
export('xtsAttributes<-')
export(periodicity)
export(period.apply,
       period.max,
       period.min,
       period.sum,
       period.prod)
export(first,
       last)
export(apply.daily,
       apply.weekly,
       apply.monthly,
       apply.quarterly,
       apply.yearly)
export(rbind.xts,
       cbind.xts,
       c.xts)
export(split.xts)

export(axTicksByTime)

export(plot.xts)
export(addLegend)
export(addEventLines)
# export(addPoints)
export(addSeries)
export(addPanel)
export(addPolygon)
S3method(plot,xts)
S3method(lines,xts)
S3method(points,xts)
S3method(print, replot_xts)
S3method(plot, replot_xts)
S3method(str, replot_xts)

#export(lines.xts)
#S3method(lines,xts)
#S3method(points,xts)

#export(Lag.xts, Next.xts) #, Diff.xts)

export(lag.xts)
export(diff.xts)
export(merge.xts)
#export(mergeXts)
S3method(all.equal, xts)
S3method(split, xts)
S3method(lag,xts)
S3method(diff,xts)
S3method(first,default)
S3method(last,default)
S3method(first,xts)
S3method(last,xts)
S3method(print,periodicity)
S3method(align.time, xts)
S3method(align.time, POSIXct)
S3method(align.time, POSIXlt)
S3method(shift.time, xts)
S3method(make.index.unique, xts)
S3method(make.index.unique, numeric)
S3method(make.index.unique, POSIXct)
S3method(is.time.unique, xts)
S3method(is.time.unique, zoo)

# xts methods
importFrom(zoo,coredata)
importFrom(zoo, index)
importFrom(zoo,'index<-')
importFrom(zoo,'time<-')
importFrom(zoo, na.locf)
importFrom(zoo, as.zoo)
#importFrom(zoo, lagts)
importFrom(zoo, rollapply)
importFrom(zoo, na.approx)
importFrom(zoo, na.fill)
importFrom(zoo, na.fill0)
importFrom(zoo, as.yearmon)
importFrom(zoo, as.yearqtr)
importFrom(zoo, is.regular)
importFrom(zoo, zoo)
importFrom(zoo, MATCH)
S3method(coredata,xts)
S3method(xcoredata,default)
S3method('xcoredata<-',default)
S3method(as.xts,xts)
S3method('[',xts)
S3method('[<-',xts)
S3method(str,xts)
S3method(start, xts)
S3method(end, xts)
S3method(na.omit,xts)
S3method(na.locf,xts)
S3method(na.fill,xts)
S3method(print,xts)
S3method(print,CLASS)
S3method('CLASS<-',xts)
S3method(window,xts)

S3method(dimnames, xts)
S3method('dimnames<-', xts)

S3method(tclass, default)
S3method('tclass<-', default)
S3method(tclass,xts)
S3method('tclass<-',xts)

S3method(tformat,default)
S3method(tformat,xts)
S3method('tformat<-',xts)

S3method(tzone, default)
S3method('tzone<-', default)
S3method(tzone,xts)
S3method('tzone<-',xts)

S3method('index',xts)
S3method('index<-',xts)
S3method('time<-',xts)
S3method('xtsAttributes<-',xts)
S3method(merge,xts)
S3method(rbind,xts)
S3method(cbind,xts)
S3method(c,xts)
S3method(Ops,xts)
S3method(as.numeric,xts)
S3method(as.xts,numeric)
S3method(as.double,xts)
S3method(as.xts,double)
S3method(as.integer,xts)
S3method(as.xts,integer)
S3method(as.complex,xts)
S3method(as.xts,complex)
S3method(as.logical,xts)
S3method(as.xts,logical)
S3method(cumsum, xts)
S3method(cumprod, xts)
S3method(cummin, xts)
S3method(cummax, xts)
#S3method(lagts,xts)
S3method(rollapply, xts)

# list specific methods
S3method(as.list,xts)

# ts specific methods
S3method(as.xts, ts)
S3method(as.ts, xts)

# zoo specific methods
#importFrom(zoo,as.zoo)  # now in zoo
S3method(as.xts,zoo)
if (getRversion() >= "3.6.0" && utils::packageVersion("zoo") < "1.8.5") {
  # xts:::as.zoo.xts was copied to zoo:::as.zoo.xts in zoo 1.8-5
  S3method(zoo::as.zoo, xts)
}

# data.frame specific methods
S3method(as.xts,data.frame)
S3method(as.data.frame, xts)

# matrix specific methods
S3method(as.xts,matrix)
S3method(as.matrix,xts)

# environment specific methods
#S3method(as.xts,environment)
S3method(as.environment,xts)

# timeSeries (package:timeSeries) specific methods
if (getRversion() >= "3.6.0") {
  S3method(timeSeries::as.timeSeries, xts)
}
S3method(as.xts,timeSeries)

# irts (package:tseries) specific methods
S3method(as.xts,irts)

# Date specific methods
S3method(as.xts,Date)

# POSIX specific methods
S3method(as.xts,POSIXt)

# yearmon/yearqtr specific methods
S3method(as.xts,yearmon)
S3method(as.xts,yearqtr)

# timeDate specific methods
S3method(as.xts,timeDate)
## currently unexported functions that _may_ be exported at some point

#export(startof,endof,firstof,lastof)
