module Patrol.Type.DeviceContext where
import qualified Data.Aeson as Aeson
import qualified Data.Text as Text
import qualified Data.Time as Time
import qualified Patrol.Extra.Aeson as Aeson
data DeviceContext = DeviceContext
{ DeviceContext -> Text
arch :: Text.Text,
DeviceContext -> Maybe Double
batteryLevel :: Maybe Double,
DeviceContext -> Text
batteryStatus :: Text.Text,
DeviceContext -> Maybe UTCTime
bootTime :: Maybe Time.UTCTime,
DeviceContext -> Text
brand :: Text.Text,
DeviceContext -> Maybe Bool
charging :: Maybe Bool,
DeviceContext -> Text
cpuDescription :: Text.Text,
DeviceContext -> Text
deviceType :: Text.Text,
DeviceContext -> Text
deviceUniqueIdentifier :: Text.Text,
DeviceContext -> Maybe Int
externalFreeStorage :: Maybe Int,
DeviceContext -> Maybe Int
externalStorageSize :: Maybe Int,
DeviceContext -> Text
family :: Text.Text,
DeviceContext -> Maybe Int
freeMemory :: Maybe Int,
DeviceContext -> Maybe Int
freeStorage :: Maybe Int,
DeviceContext -> Maybe Bool
lowMemory :: Maybe Bool,
DeviceContext -> Text
manufacturer :: Text.Text,
DeviceContext -> Maybe Int
memorySize :: Maybe Int,
DeviceContext -> Text
model :: Text.Text,
DeviceContext -> Text
modelId :: Text.Text,
DeviceContext -> Text
name :: Text.Text,
DeviceContext -> Maybe Bool
online :: Maybe Bool,
DeviceContext -> Text
orientation :: Text.Text,
DeviceContext -> Maybe Int
processorCount :: Maybe Int,
DeviceContext -> Maybe Double
processorFrequency :: Maybe Double,
DeviceContext -> Maybe Double
screenDensity :: Maybe Double,
DeviceContext -> Maybe Double
screenDpi :: Maybe Double,
DeviceContext -> Text
screenResolution :: Text.Text,
DeviceContext -> Maybe Bool
simulator :: Maybe Bool,
DeviceContext -> Maybe Int
storageSize :: Maybe Int,
DeviceContext -> Maybe Bool
supportsAccelerometer :: Maybe Bool,
DeviceContext -> Maybe Bool
supportsAudio :: Maybe Bool,
DeviceContext -> Maybe Bool
supportsGyroscope :: Maybe Bool,
DeviceContext -> Maybe Bool
supportsLocationService :: Maybe Bool,
DeviceContext -> Maybe Bool
supportsVibration :: Maybe Bool,
DeviceContext -> Text
timezone :: Text.Text,
DeviceContext -> Maybe Int
usableMemory :: Maybe Int
}
deriving (DeviceContext -> DeviceContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeviceContext -> DeviceContext -> Bool
$c/= :: DeviceContext -> DeviceContext -> Bool
== :: DeviceContext -> DeviceContext -> Bool
$c== :: DeviceContext -> DeviceContext -> Bool
Eq, Int -> DeviceContext -> ShowS
[DeviceContext] -> ShowS
DeviceContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeviceContext] -> ShowS
$cshowList :: [DeviceContext] -> ShowS
show :: DeviceContext -> String
$cshow :: DeviceContext -> String
showsPrec :: Int -> DeviceContext -> ShowS
$cshowsPrec :: Int -> DeviceContext -> ShowS
Show)
instance Aeson.ToJSON DeviceContext where
toJSON :: DeviceContext -> Value
toJSON DeviceContext
deviceContext =
[Pair] -> Value
Aeson.intoObject
[ forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"arch" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
arch DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"battery_level" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Double
batteryLevel DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"battery_status" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
batteryStatus DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"boot_time" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe UTCTime
bootTime DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"brand" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
brand DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"charging" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
charging DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"cpu_description" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
cpuDescription DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"device_type" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
deviceType DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"device_unique_identifier" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
deviceUniqueIdentifier DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"external_free_storage" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
externalFreeStorage DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"external_storage_size" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
externalStorageSize DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"family" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
family DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"free_memory" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
freeMemory DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"free_storage" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
freeStorage DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"low_memory" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
lowMemory DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"manufacturer" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
manufacturer DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"memory_size" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
memorySize DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"model" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
model DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"model_id" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
modelId DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"name" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
name DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"online" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
online DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"orientation" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
orientation DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"processor_count" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
processorCount DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"processor_frequency" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Double
processorFrequency DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"screen_density" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Double
screenDensity DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"screen_dpi" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Double
screenDpi DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"screen_resolution" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
screenResolution DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"simulator" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
simulator DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"storage_size" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
storageSize DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"supports_accelerometer" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
supportsAccelerometer DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"supports_audio" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
supportsAudio DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"supports_gyroscope" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
supportsGyroscope DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"supports_location_service" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
supportsLocationService DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"supports_vibration" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Bool
supportsVibration DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"timezone" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Text
timezone DeviceContext
deviceContext,
forall a. ToJSON a => String -> a -> Pair
Aeson.pair String
"usable_memory" forall a b. (a -> b) -> a -> b
$ DeviceContext -> Maybe Int
usableMemory DeviceContext
deviceContext
]
empty :: DeviceContext
empty :: DeviceContext
empty =
DeviceContext
{ arch :: Text
arch = Text
Text.empty,
batteryLevel :: Maybe Double
batteryLevel = forall a. Maybe a
Nothing,
batteryStatus :: Text
batteryStatus = Text
Text.empty,
bootTime :: Maybe UTCTime
bootTime = forall a. Maybe a
Nothing,
brand :: Text
brand = Text
Text.empty,
charging :: Maybe Bool
charging = forall a. Maybe a
Nothing,
cpuDescription :: Text
cpuDescription = Text
Text.empty,
deviceType :: Text
deviceType = Text
Text.empty,
deviceUniqueIdentifier :: Text
deviceUniqueIdentifier = Text
Text.empty,
externalFreeStorage :: Maybe Int
externalFreeStorage = forall a. Maybe a
Nothing,
externalStorageSize :: Maybe Int
externalStorageSize = forall a. Maybe a
Nothing,
family :: Text
family = Text
Text.empty,
freeMemory :: Maybe Int
freeMemory = forall a. Maybe a
Nothing,
freeStorage :: Maybe Int
freeStorage = forall a. Maybe a
Nothing,
lowMemory :: Maybe Bool
lowMemory = forall a. Maybe a
Nothing,
manufacturer :: Text
manufacturer = Text
Text.empty,
memorySize :: Maybe Int
memorySize = forall a. Maybe a
Nothing,
model :: Text
model = Text
Text.empty,
modelId :: Text
modelId = Text
Text.empty,
name :: Text
name = Text
Text.empty,
online :: Maybe Bool
online = forall a. Maybe a
Nothing,
orientation :: Text
orientation = Text
Text.empty,
processorCount :: Maybe Int
processorCount = forall a. Maybe a
Nothing,
processorFrequency :: Maybe Double
processorFrequency = forall a. Maybe a
Nothing,
screenDensity :: Maybe Double
screenDensity = forall a. Maybe a
Nothing,
screenDpi :: Maybe Double
screenDpi = forall a. Maybe a
Nothing,
screenResolution :: Text
screenResolution = Text
Text.empty,
simulator :: Maybe Bool
simulator = forall a. Maybe a
Nothing,
storageSize :: Maybe Int
storageSize = forall a. Maybe a
Nothing,
supportsAccelerometer :: Maybe Bool
supportsAccelerometer = forall a. Maybe a
Nothing,
supportsAudio :: Maybe Bool
supportsAudio = forall a. Maybe a
Nothing,
supportsGyroscope :: Maybe Bool
supportsGyroscope = forall a. Maybe a
Nothing,
supportsLocationService :: Maybe Bool
supportsLocationService = forall a. Maybe a
Nothing,
supportsVibration :: Maybe Bool
supportsVibration = forall a. Maybe a
Nothing,
timezone :: Text
timezone = Text
Text.empty,
usableMemory :: Maybe Int
usableMemory = forall a. Maybe a
Nothing
}