-- |
--
-- Static values about this notifier itself.
--
module Network.Bugsnag.Notifier
    ( BugsnagNotifier
    , bugsnagNotifier
    ) where

import Prelude

import Data.Aeson
import Data.Aeson.Ext
import Data.Text (Text)
import Data.Version
import GHC.Generics

import qualified Paths_bugsnag_haskell as Pkg

data BugsnagNotifier = BugsnagNotifier
    { BugsnagNotifier -> Text
bnName :: Text
    , BugsnagNotifier -> Version
bnVersion :: Version
    , BugsnagNotifier -> Text
bnUrl :: Text
    }
    deriving stock (forall x. BugsnagNotifier -> Rep BugsnagNotifier x)
-> (forall x. Rep BugsnagNotifier x -> BugsnagNotifier)
-> Generic BugsnagNotifier
forall x. Rep BugsnagNotifier x -> BugsnagNotifier
forall x. BugsnagNotifier -> Rep BugsnagNotifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BugsnagNotifier x -> BugsnagNotifier
$cfrom :: forall x. BugsnagNotifier -> Rep BugsnagNotifier x
Generic

instance ToJSON BugsnagNotifier where
    toJSON :: BugsnagNotifier -> Value
toJSON = Options -> BugsnagNotifier -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON (Options -> BugsnagNotifier -> Value)
-> Options -> BugsnagNotifier -> Value
forall a b. (a -> b) -> a -> b
$ String -> Options
bsAesonOptions String
"bn"
    toEncoding :: BugsnagNotifier -> Encoding
toEncoding = Options -> BugsnagNotifier -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding (Options -> BugsnagNotifier -> Encoding)
-> Options -> BugsnagNotifier -> Encoding
forall a b. (a -> b) -> a -> b
$ String -> Options
bsAesonOptions String
"bn"

bugsnagNotifier :: BugsnagNotifier
bugsnagNotifier :: BugsnagNotifier
bugsnagNotifier = BugsnagNotifier :: Text -> Version -> Text -> BugsnagNotifier
BugsnagNotifier
    { bnName :: Text
bnName = Text
"bugsnag-haskell"
    , bnVersion :: Version
bnVersion = Version
Pkg.version
    , bnUrl :: Text
bnUrl = Text
"https://github.com/pbrisbin/bugsnag-haskell"
    }