module Patrol.Type.BrowserContext where
import qualified Data.Aeson as Aeson
import qualified Data.Text as Text
import qualified Patrol.Extra.Aeson as Aeson
data BrowserContext = BrowserContext
{ BrowserContext -> Text
name :: Text.Text,
BrowserContext -> Text
version :: Text.Text
}
deriving (BrowserContext -> BrowserContext -> Bool
(BrowserContext -> BrowserContext -> Bool)
-> (BrowserContext -> BrowserContext -> Bool) -> Eq BrowserContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BrowserContext -> BrowserContext -> Bool
== :: BrowserContext -> BrowserContext -> Bool
$c/= :: BrowserContext -> BrowserContext -> Bool
/= :: BrowserContext -> BrowserContext -> Bool
Eq, Int -> BrowserContext -> ShowS
[BrowserContext] -> ShowS
BrowserContext -> String
(Int -> BrowserContext -> ShowS)
-> (BrowserContext -> String)
-> ([BrowserContext] -> ShowS)
-> Show BrowserContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BrowserContext -> ShowS
showsPrec :: Int -> BrowserContext -> ShowS
$cshow :: BrowserContext -> String
show :: BrowserContext -> String
$cshowList :: [BrowserContext] -> ShowS
showList :: [BrowserContext] -> ShowS
Show)
instance Aeson.ToJSON BrowserContext where
toJSON :: BrowserContext -> Value
toJSON BrowserContext
browserContext =
[Pair] -> Value
Aeson.intoObject
[ String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"name" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ BrowserContext -> Text
name BrowserContext
browserContext,
String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"version" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ BrowserContext -> Text
version BrowserContext
browserContext
]
empty :: BrowserContext
empty :: BrowserContext
empty =
BrowserContext
{ name :: Text
name = Text
Text.empty,
version :: Text
version = Text
Text.empty
}