{- |
Copyright: (c) 2020 Kowainik
SPDX-License-Identifier: MPL-2.0
Maintainer: Kowainik <xrom.xkov@gmail.com>

Report and report settings types.
-}

module Stan.Report
    ( generateReport
    ) where

import Text.Blaze.Html.Renderer.Utf8 (renderHtml)

import Stan.Analysis (Analysis)
import Stan.Config (Config)
import Stan.Info (ProjectInfo, StanEnv)
import Stan.Report.Html (stanHtml)


generateReport
    :: Analysis
    -> Config
    -> [Text]  -- ^ Warnings during Trial config selections
    -> StanEnv  -- ^ Environment information
    -> ProjectInfo  -- ^ Project related Information
    -> IO ()
generateReport :: Analysis -> Config -> [Text] -> StanEnv -> ProjectInfo -> IO ()
generateReport an :: Analysis
an c :: Config
c ws :: [Text]
ws env :: StanEnv
env = FilePath -> LByteString -> IO ()
forall (m :: * -> *). MonadIO m => FilePath -> LByteString -> m ()
writeFileLBS "stan.html" (LByteString -> IO ())
-> (ProjectInfo -> LByteString) -> ProjectInfo -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Html -> LByteString
renderHtml (Html -> LByteString)
-> (ProjectInfo -> Html) -> ProjectInfo -> LByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
    Analysis -> Config -> [Text] -> StanEnv -> ProjectInfo -> Html
stanHtml Analysis
an Config
c [Text]
ws StanEnv
env