module Patrol.Type.NativeDebugImage 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/#nativedebugimage>
data NativeDebugImage = NativeDebugImage
  { NativeDebugImage -> Text
arch :: Text.Text,
    NativeDebugImage -> Text
codeFile :: Text.Text,
    NativeDebugImage -> Text
codeId :: Text.Text,
    NativeDebugImage -> Text
debugFile :: Text.Text,
    NativeDebugImage -> Text
debugId :: Text.Text,
    NativeDebugImage -> Text
imageAddr :: Text.Text,
    NativeDebugImage -> Maybe Int
imageSize :: Maybe Int,
    NativeDebugImage -> Text
imageVmaddr :: Text.Text,
    NativeDebugImage -> Text
type_ :: Text.Text
  }
  deriving (NativeDebugImage -> NativeDebugImage -> Bool
(NativeDebugImage -> NativeDebugImage -> Bool)
-> (NativeDebugImage -> NativeDebugImage -> Bool)
-> Eq NativeDebugImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NativeDebugImage -> NativeDebugImage -> Bool
== :: NativeDebugImage -> NativeDebugImage -> Bool
$c/= :: NativeDebugImage -> NativeDebugImage -> Bool
/= :: NativeDebugImage -> NativeDebugImage -> Bool
Eq, Int -> NativeDebugImage -> ShowS
[NativeDebugImage] -> ShowS
NativeDebugImage -> String
(Int -> NativeDebugImage -> ShowS)
-> (NativeDebugImage -> String)
-> ([NativeDebugImage] -> ShowS)
-> Show NativeDebugImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NativeDebugImage -> ShowS
showsPrec :: Int -> NativeDebugImage -> ShowS
$cshow :: NativeDebugImage -> String
show :: NativeDebugImage -> String
$cshowList :: [NativeDebugImage] -> ShowS
showList :: [NativeDebugImage] -> ShowS
Show)

instance Aeson.ToJSON NativeDebugImage where
  toJSON :: NativeDebugImage -> Value
toJSON NativeDebugImage
nativeDebugImage =
    [Pair] -> Value
Aeson.intoObject
      [ String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"arch" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
arch NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"code_file" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
codeFile NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"code_id" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
codeId NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"debug_file" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
debugFile NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"debug_id" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
debugId NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"image_addr" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
imageAddr NativeDebugImage
nativeDebugImage,
        String -> Maybe Int -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"image_size" (Maybe Int -> Pair) -> Maybe Int -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Maybe Int
imageSize NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"image_vmaddr" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
imageVmaddr NativeDebugImage
nativeDebugImage,
        String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"type" (Text -> Pair) -> Text -> Pair
forall a b. (a -> b) -> a -> b
$ NativeDebugImage -> Text
type_ NativeDebugImage
nativeDebugImage
      ]

empty :: NativeDebugImage
empty :: NativeDebugImage
empty =
  NativeDebugImage
    { arch :: Text
arch = Text
Text.empty,
      codeFile :: Text
codeFile = Text
Text.empty,
      codeId :: Text
codeId = Text
Text.empty,
      debugFile :: Text
debugFile = Text
Text.empty,
      debugId :: Text
debugId = Text
Text.empty,
      imageAddr :: Text
imageAddr = Text
Text.empty,
      imageSize :: Maybe Int
imageSize = Maybe Int
forall a. Maybe a
Nothing,
      imageVmaddr :: Text
imageVmaddr = Text
Text.empty,
      type_ :: Text
type_ = Text
Text.empty
    }