module OrgStat.Outputs.Types
( TimelineParams (..)
, tpColorSalt
, tpLegend
, tpTopDay
, tpColumnWidth
, tpColumnHeight
, tpBackground
, TimelineOutput (..)
, SummaryParams (..)
, SummaryOutput (..)
, BlockParams (..)
, BlockOutput (..)
) where
import Universum
import Control.Lens (makeLenses)
import Data.Default (Default (..))
import Diagrams.Backend.SVG (B)
import qualified Diagrams.Prelude as D
data TimelineParams = TimelineParams
{ _tpColorSalt :: !Int
, _tpLegend :: !Bool
, _tpTopDay :: !Int
, _tpColumnWidth :: !Double
, _tpColumnHeight :: !Double
, _tpBackground :: !(D.Colour Double)
} deriving (Show)
instance Default TimelineParams where
def = TimelineParams 0 True 5 1 1 (D.sRGB24 0xf2 0xf2 0xf2)
makeLenses ''TimelineParams
mergeParams :: TimelineParams -> TimelineParams -> TimelineParams
mergeParams lhs rhs = mods lhs
where
mods = foldr1 (.)
[ asId tpColorSalt
, asId tpLegend
, asId tpTopDay
, asId tpColumnWidth
, asId tpColumnHeight
, asId tpBackground ]
asId :: forall b. (Eq b) => Lens' TimelineParams b -> TimelineParams -> TimelineParams
asId l x =
if def ^. l == rhs ^. l
then x else x & l .~ (rhs ^. l)
instance Monoid TimelineParams where
mempty = def
mappend = mergeParams
newtype TimelineOutput = TimelineOutput (D.Diagram B)
data SummaryParams = SummaryParams
{ spTemplate :: !Text
} deriving Show
newtype SummaryOutput = SummaryOutput Text
data BlockParams = BlockParams
{
} deriving (Show)
newtype BlockOutput = BlockOutput Text