    {-# LANGUAGE RecordWildCards #-}
    {-# LANGUAGE TemplateHaskell #-}
    {-|

    The @balancesheet@ command prints a simple balance sheet.

    -}

    module Hledger.Cli.Commands.Balancesheet (
      balancesheetmode
     ,balancesheet
    ) where

    import System.Console.CmdArgs.Explicit

    import Hledger
    import Hledger.Cli.CliOptions
    import Hledger.Cli.CompoundBalanceCommand

    balancesheetSpec :: CompoundBalanceCommandSpec
    balancesheetSpec = CompoundBalanceCommandSpec :: CommandDoc
    -> CommandDoc
    -> [CBCSubreportSpec]
    -> BalanceType
    -> CompoundBalanceCommandSpec
    CompoundBalanceCommandSpec {
      cbcdoc :: CommandDoc
    cbcdoc      = $(embedFileRelative "Hledger/Cli/Commands/Balancesheet.txt"),
      cbctitle :: CommandDoc
    cbctitle    = "Balance Sheet",
      cbcqueries :: [CBCSubreportSpec]
    cbcqueries  = [
         CBCSubreportSpec :: CommandDoc
    -> (Journal -> Query) -> NormalSign -> Bool -> CBCSubreportSpec
    CBCSubreportSpec{
          cbcsubreporttitle :: CommandDoc
    cbcsubreporttitle="Assets"
         ,cbcsubreportquery :: Journal -> Query
    cbcsubreportquery=Journal -> Query
    journalAssetAccountQuery
         ,cbcsubreportnormalsign :: NormalSign
    cbcsubreportnormalsign=NormalSign
    NormallyPositive
         ,cbcsubreportincreasestotal :: Bool
    cbcsubreportincreasestotal=Bool
    True
         }
        ,CBCSubreportSpec :: CommandDoc
    -> (Journal -> Query) -> NormalSign -> Bool -> CBCSubreportSpec
    CBCSubreportSpec{
          cbcsubreporttitle :: CommandDoc
    cbcsubreporttitle="Liabilities"
         ,cbcsubreportquery :: Journal -> Query
    cbcsubreportquery=Journal -> Query
    journalLiabilityAccountQuery
         ,cbcsubreportnormalsign :: NormalSign
    cbcsubreportnormalsign=NormalSign
    NormallyNegative
         ,cbcsubreportincreasestotal :: Bool
    cbcsubreportincreasestotal=Bool
    False
         }
        ],
      cbctype :: BalanceType
    cbctype     = BalanceType
    HistoricalBalance
    }

    balancesheetmode :: Mode RawOpts
    balancesheetmode :: Mode RawOpts
    balancesheetmode = CompoundBalanceCommandSpec -> Mode RawOpts
    compoundBalanceCommandMode CompoundBalanceCommandSpec
    balancesheetSpec

    balancesheet :: CliOpts -> Journal -> IO ()
    balancesheet :: CliOpts -> Journal -> IO ()
    balancesheet = CompoundBalanceCommandSpec -> CliOpts -> Journal -> IO ()
    compoundBalanceCommand CompoundBalanceCommandSpec
    balancesheetSpec