module Hledger.Flow.RuntimeOptions
where

import qualified Data.Text as T
import Prelude hiding (putStrLn)
import Hledger.Flow.Types
import Hledger.Flow.Internals (SystemInfo)

data RuntimeOptions = RuntimeOptions { RuntimeOptions -> BaseDir
baseDir :: BaseDir
                                     , RuntimeOptions -> RunDir
importRunDir :: RunDir
                                     , RuntimeOptions -> Maybe Integer
importStartYear :: Maybe Integer
                                     , RuntimeOptions -> Bool
onlyNewFiles :: Bool
                                     , RuntimeOptions -> Text
hfVersion :: T.Text
                                     , RuntimeOptions -> HledgerInfo
hledgerInfo :: HledgerInfo
                                     , RuntimeOptions -> SystemInfo
sysInfo :: SystemInfo
                                     , RuntimeOptions -> Bool
verbose :: Bool
                                     , RuntimeOptions -> Bool
showOptions :: Bool
                                     , RuntimeOptions -> Bool
sequential :: Bool
                                     , RuntimeOptions -> Int
batchSize :: Int
                                     }
  deriving (Int -> RuntimeOptions -> ShowS
[RuntimeOptions] -> ShowS
RuntimeOptions -> String
(Int -> RuntimeOptions -> ShowS)
-> (RuntimeOptions -> String)
-> ([RuntimeOptions] -> ShowS)
-> Show RuntimeOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuntimeOptions] -> ShowS
$cshowList :: [RuntimeOptions] -> ShowS
show :: RuntimeOptions -> String
$cshow :: RuntimeOptions -> String
showsPrec :: Int -> RuntimeOptions -> ShowS
$cshowsPrec :: Int -> RuntimeOptions -> ShowS
Show)

instance HasVerbosity RuntimeOptions where
  verbose :: RuntimeOptions -> Bool
verbose (RuntimeOptions BaseDir
_ RunDir
_ Maybe Integer
_ Bool
_ Text
_ HledgerInfo
_ SystemInfo
_ Bool
v Bool
_ Bool
_ Int
_) = Bool
v

instance HasSequential RuntimeOptions where
  sequential :: RuntimeOptions -> Bool
sequential (RuntimeOptions BaseDir
_ RunDir
_ Maybe Integer
_ Bool
_ Text
_ HledgerInfo
_ SystemInfo
_ Bool
_ Bool
_ Bool
sq Int
_) = Bool
sq

instance HasBatchSize RuntimeOptions where
  batchSize :: RuntimeOptions -> Int
batchSize (RuntimeOptions BaseDir
_ RunDir
_ Maybe Integer
_ Bool
_ Text
_ HledgerInfo
_ SystemInfo
_ Bool
_ Bool
_ Bool
_ Int
bs) = Int
bs

instance HasBaseDir RuntimeOptions where
  baseDir :: RuntimeOptions -> BaseDir
baseDir (RuntimeOptions BaseDir
bd RunDir
_ Maybe Integer
_ Bool
_ Text
_ HledgerInfo
_ SystemInfo
_ Bool
_ Bool
_ Bool
_ Int
_) = BaseDir
bd

instance HasRunDir RuntimeOptions where
  importRunDir :: RuntimeOptions -> RunDir
importRunDir (RuntimeOptions BaseDir
_ RunDir
rd Maybe Integer
_ Bool
_ Text
_ HledgerInfo
_ SystemInfo
_ Bool
_ Bool
_ Bool
_ Int
_) = RunDir
rd