{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TypeSynonymInstances  #-}

module HaskellWorks.Error.Types.TimedOut (
    TimedOut (..),
) where

import           Data.Aeson
import           Data.Generics.Product.Any
import           HaskellWorks.Error.Types.RenderedError
import           Lens.Micro

import           HaskellWorks.Prelude

newtype TimedOut = TimedOut
    { TimedOut -> Text
message :: Text
    }
    deriving (TimedOut -> TimedOut -> Bool
(TimedOut -> TimedOut -> Bool)
-> (TimedOut -> TimedOut -> Bool) -> Eq TimedOut
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TimedOut -> TimedOut -> Bool
== :: TimedOut -> TimedOut -> Bool
$c/= :: TimedOut -> TimedOut -> Bool
/= :: TimedOut -> TimedOut -> Bool
Eq, (forall x. TimedOut -> Rep TimedOut x)
-> (forall x. Rep TimedOut x -> TimedOut) -> Generic TimedOut
forall x. Rep TimedOut x -> TimedOut
forall x. TimedOut -> Rep TimedOut x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TimedOut -> Rep TimedOut x
from :: forall x. TimedOut -> Rep TimedOut x
$cto :: forall x. Rep TimedOut x -> TimedOut
to :: forall x. Rep TimedOut x -> TimedOut
Generic, Int -> TimedOut -> ShowS
[TimedOut] -> ShowS
TimedOut -> String
(Int -> TimedOut -> ShowS)
-> (TimedOut -> String) -> ([TimedOut] -> ShowS) -> Show TimedOut
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TimedOut -> ShowS
showsPrec :: Int -> TimedOut -> ShowS
$cshow :: TimedOut -> String
show :: TimedOut -> String
$cshowList :: [TimedOut] -> ShowS
showList :: [TimedOut] -> ShowS
Show)

instance ToRenderedError TimedOut where
    toRenderedError :: TimedOut -> RenderedError
toRenderedError TimedOut
e =
        RenderedError
            { $sel:error:RenderedError :: Text
error   = Text
"TimedOut"
            , $sel:payload:RenderedError :: Value
payload = Text -> Value
forall a. ToJSON a => a -> Value
toJSON (Text -> Value) -> Text -> Value
forall a b. (a -> b) -> a -> b
$ TimedOut
e TimedOut -> Getting Text TimedOut Text -> Text
forall s a. s -> Getting a s a -> a
^. forall {k} (sel :: k) s t a b. HasAny sel s t a b => Lens s t a b
forall (sel :: Symbol) s t a b. HasAny sel s t a b => Lens s t a b
the @"message"
            }