{- |
   The functions in this module are trivial wrappers around the functions
   in "Hakyll.FileStore.Context":

   @darcsSomething@ is equivalent to @fsSomething darcsStore@, where
   @darcsStore = darcsFileStore "."@.
-}

--------------------------------------------------------------------------------

module Hakyll.FileStore.Darcs.Context
    ( darcsStore
    , darcsGetItemUTC
    , darcsGetItemUTC'
    , darcsDateField
    , darcsDateFieldWith
    , darcsGetItemModificationTime
    , darcsGetItemModificationTime'
    , darcsModificationTimeField
    , darcsModificationTimeFieldWith
    , darcsGetRevisions
    , darcsGetAuthors
    , darcsGetAuthorNames
    , darcsAuthorNamesField
    , darcsAuthorNamesFieldWith
    , darcsGetAuthorEmails
    , darcsAuthorEmailsField
    , darcsAuthorEmailsFieldWith
    ) where

--------------------------------------------------------------------------------

import           Data.Time.Clock             (UTCTime)
import           Data.FileStore              (Author,
                                              FileStore,
                                              Revision,
                                              darcsFileStore)
import           Data.Time.Locale.Compat     (TimeLocale)
import           Hakyll.Core.Compiler        (Compiler)
import           Hakyll.Core.Identifier      (Identifier)
import           Hakyll.Web.Template.Context (Context)

--------------------------------------------------------------------------------

import           Hakyll.FileStore.Context -- evil!

--------------------------------------------------------------------------------

darcsStore :: FileStore
darcsStore :: FileStore
darcsStore = FilePath -> FileStore
darcsFileStore FilePath
"."
-- ^ @darcsStore = darcsFileStore "."@

--------------------------------------------------------------------------------

darcsGetItemUTC :: TimeLocale
               -> Identifier
               -> Compiler UTCTime
darcsGetItemUTC :: TimeLocale -> Identifier -> Compiler UTCTime
darcsGetItemUTC = FileStore -> TimeLocale -> Identifier -> Compiler UTCTime
fsGetItemUTC FileStore
darcsStore

darcsGetItemUTC' :: Identifier
                -> Compiler (Maybe UTCTime)
darcsGetItemUTC' :: Identifier -> Compiler (Maybe UTCTime)
darcsGetItemUTC' = FileStore -> Identifier -> Compiler (Maybe UTCTime)
fsGetItemUTC' FileStore
darcsStore

darcsDateField :: String
              -> String
              -> Context a
darcsDateField :: FilePath -> FilePath -> Context a
darcsDateField = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsDateField FileStore
darcsStore

darcsDateFieldWith :: TimeLocale
                  -> String
                  -> String
                  -> Context a
darcsDateFieldWith :: TimeLocale -> FilePath -> FilePath -> Context a
darcsDateFieldWith = FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
forall a.
FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
fsDateFieldWith FileStore
darcsStore

darcsGetItemModificationTime :: Identifier
                            -> Compiler UTCTime
darcsGetItemModificationTime :: Identifier -> Compiler UTCTime
darcsGetItemModificationTime = FileStore -> Identifier -> Compiler UTCTime
fsGetItemModificationTime FileStore
darcsStore

darcsGetItemModificationTime' :: Identifier
                             -> Compiler (Maybe UTCTime)
darcsGetItemModificationTime' :: Identifier -> Compiler (Maybe UTCTime)
darcsGetItemModificationTime' = FileStore -> Identifier -> Compiler (Maybe UTCTime)
fsGetItemModificationTime' FileStore
darcsStore

darcsModificationTimeField :: String
                          -> String
                          -> Context a
darcsModificationTimeField :: FilePath -> FilePath -> Context a
darcsModificationTimeField = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsModificationTimeField FileStore
darcsStore

darcsModificationTimeFieldWith :: TimeLocale
                              -> String
                              -> String
                              -> Context a
darcsModificationTimeFieldWith :: TimeLocale -> FilePath -> FilePath -> Context a
darcsModificationTimeFieldWith = FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
forall a.
FileStore -> TimeLocale -> FilePath -> FilePath -> Context a
fsModificationTimeFieldWith FileStore
darcsStore

--------------------------------------------------------------------------------

darcsGetRevisions :: Identifier
                 -> Compiler [Revision]
darcsGetRevisions :: Identifier -> Compiler [Revision]
darcsGetRevisions = FileStore -> Identifier -> Compiler [Revision]
fsGetRevisions FileStore
darcsStore

darcsGetAuthors :: Identifier
               -> Compiler [Author]
darcsGetAuthors :: Identifier -> Compiler [Author]
darcsGetAuthors = FileStore -> Identifier -> Compiler [Author]
fsGetAuthors FileStore
darcsStore

darcsGetAuthorNames :: Identifier
                   -> Compiler [String]
darcsGetAuthorNames :: Identifier -> Compiler [FilePath]
darcsGetAuthorNames = FileStore -> Identifier -> Compiler [FilePath]
fsGetAuthorNames FileStore
darcsStore

darcsAuthorNamesField :: String
                     -> Context a
darcsAuthorNamesField :: FilePath -> Context a
darcsAuthorNamesField = FileStore -> FilePath -> Context a
forall a. FileStore -> FilePath -> Context a
fsAuthorNamesField FileStore
darcsStore

darcsAuthorNamesFieldWith :: String
                         -> String
                         -> Context a
darcsAuthorNamesFieldWith :: FilePath -> FilePath -> Context a
darcsAuthorNamesFieldWith = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsAuthorNamesFieldWith FileStore
darcsStore

darcsGetAuthorEmails :: Identifier
                    -> Compiler [String]
darcsGetAuthorEmails :: Identifier -> Compiler [FilePath]
darcsGetAuthorEmails = FileStore -> Identifier -> Compiler [FilePath]
fsGetAuthorEmails FileStore
darcsStore

darcsAuthorEmailsField :: String
                      -> Context a
darcsAuthorEmailsField :: FilePath -> Context a
darcsAuthorEmailsField = FileStore -> FilePath -> Context a
forall a. FileStore -> FilePath -> Context a
fsAuthorEmailsField FileStore
darcsStore

darcsAuthorEmailsFieldWith :: String
                          -> String
                          -> Context a
darcsAuthorEmailsFieldWith :: FilePath -> FilePath -> Context a
darcsAuthorEmailsFieldWith = FileStore -> FilePath -> FilePath -> Context a
forall a. FileStore -> FilePath -> FilePath -> Context a
fsAuthorEmailsFieldWith FileStore
darcsStore

--------------------------------------------------------------------------------