module Patrol.Type.ClientSdkPackage where

import qualified Data.Aeson as Aeson
import qualified Data.Text as Text
import qualified Patrol.Extra.Aeson as Aeson

-- | <https://develop.sentry.dev/sdk/event-payloads/types/#clientsdkpackage>
data ClientSdkPackage = ClientSdkPackage
  { ClientSdkPackage -> Text
name :: Text.Text,
    ClientSdkPackage -> Text
version :: Text.Text
  }
  deriving (ClientSdkPackage -> ClientSdkPackage -> Bool
(ClientSdkPackage -> ClientSdkPackage -> Bool)
-> (ClientSdkPackage -> ClientSdkPackage -> Bool)
-> Eq ClientSdkPackage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClientSdkPackage -> ClientSdkPackage -> Bool
== :: ClientSdkPackage -> ClientSdkPackage -> Bool
$c/= :: ClientSdkPackage -> ClientSdkPackage -> Bool
/= :: ClientSdkPackage -> ClientSdkPackage -> Bool
Eq, Int -> ClientSdkPackage -> ShowS
[ClientSdkPackage] -> ShowS
ClientSdkPackage -> String
(Int -> ClientSdkPackage -> ShowS)
-> (ClientSdkPackage -> String)
-> ([ClientSdkPackage] -> ShowS)
-> Show ClientSdkPackage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClientSdkPackage -> ShowS
showsPrec :: Int -> ClientSdkPackage -> ShowS
$cshow :: ClientSdkPackage -> String
show :: ClientSdkPackage -> String
$cshowList :: [ClientSdkPackage] -> ShowS
showList :: [ClientSdkPackage] -> ShowS
Show)

instance Aeson.ToJSON ClientSdkPackage where
  toJSON :: ClientSdkPackage -> Value
toJSON ClientSdkPackage
clientSdkPackage =
    [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
$ ClientSdkPackage -> Text
name ClientSdkPackage
clientSdkPackage,
        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
$ ClientSdkPackage -> Text
version ClientSdkPackage
clientSdkPackage
      ]

empty :: ClientSdkPackage
empty :: ClientSdkPackage
empty =
  ClientSdkPackage
    { name :: Text
name = Text
Text.empty,
      version :: Text
version = Text
Text.empty
    }