module Hledger.Flow.RuntimeOptions where

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

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,
    RuntimeOptions -> Bool
prettyReports :: Bool
  }
  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
$cshowsPrec :: Int -> RuntimeOptions -> ShowS
showsPrec :: Int -> RuntimeOptions -> ShowS
$cshow :: RuntimeOptions -> String
show :: RuntimeOptions -> String
$cshowList :: [RuntimeOptions] -> ShowS
showList :: [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
_) = 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
_) = Bool
sq

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

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

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

instance HasPrettyReports RuntimeOptions where
  prettyReports :: RuntimeOptions -> Bool
prettyReports (RuntimeOptions BaseDir
_ RunDir
_ Maybe Integer
_ Bool
_ Text
_ HledgerInfo
_ SystemInfo
_ Bool
_ Bool
_ Bool
_ Int
_ Bool
pr) = Bool
pr