module Lighthouse.Options
    ( Options (..), defaultOptions
    , Authentication (..)
    ) where

import qualified Data.Text as T
import Lighthouse.Utils.Logging (LogHandler, noopLogHandler)

-- | Configuration options.
data Options s = Options
    { forall s. Options s -> Authentication
optAuthentication :: Authentication
    , forall s. Options s -> s
optInitialState   :: s
    , forall s. Options s -> LogHandler
optLogHandler     :: LogHandler
    , forall s. Options s -> Bool
optCloseOnError   :: Bool
    }

-- | Authentication details for the Lighthouse.
data Authentication = Authentication
    { Authentication -> Text
authUsername :: T.Text
    , Authentication -> Text
authToken    :: T.Text
    }
    deriving (Int -> Authentication -> ShowS
[Authentication] -> ShowS
Authentication -> String
(Int -> Authentication -> ShowS)
-> (Authentication -> String)
-> ([Authentication] -> ShowS)
-> Show Authentication
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Authentication -> ShowS
showsPrec :: Int -> Authentication -> ShowS
$cshow :: Authentication -> String
show :: Authentication -> String
$cshowList :: [Authentication] -> ShowS
showList :: [Authentication] -> ShowS
Show, Authentication -> Authentication -> Bool
(Authentication -> Authentication -> Bool)
-> (Authentication -> Authentication -> Bool) -> Eq Authentication
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Authentication -> Authentication -> Bool
== :: Authentication -> Authentication -> Bool
$c/= :: Authentication -> Authentication -> Bool
/= :: Authentication -> Authentication -> Bool
Eq)

-- | Creates a default set of options.
defaultOptions :: Authentication -> s -> Options s
defaultOptions :: forall s. Authentication -> s -> Options s
defaultOptions Authentication
auth s
st = Options
    { optAuthentication :: Authentication
optAuthentication = Authentication
auth
    , optInitialState :: s
optInitialState   = s
st
    , optLogHandler :: LogHandler
optLogHandler     = LogHandler
noopLogHandler
    , optCloseOnError :: Bool
optCloseOnError   = Bool
True
    }