module TD.Data.InputStoryAreaType
  (InputStoryAreaType(..)) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.Location as Location
import qualified TD.Data.LocationAddress as LocationAddress
import qualified Data.Text as T
import qualified TD.Data.ReactionType as ReactionType

-- | Describes type of clickable area on a story media to be added
data InputStoryAreaType
  = InputStoryAreaTypeLocation -- ^ An area pointing to a location
    { InputStoryAreaType -> Maybe Location
location :: Maybe Location.Location               -- ^ The location
    , InputStoryAreaType -> Maybe LocationAddress
address  :: Maybe LocationAddress.LocationAddress -- ^ Address of the location; pass null if unknown
    }
  | InputStoryAreaTypeFoundVenue -- ^ An area pointing to a venue found by the bot getOption("venue_search_bot_username")
    { InputStoryAreaType -> Maybe Int
query_id  :: Maybe Int    -- ^ Identifier of the inline query, used to found the venue
    , InputStoryAreaType -> Maybe Text
result_id :: Maybe T.Text -- ^ Identifier of the inline query result
    }
  | InputStoryAreaTypePreviousVenue -- ^ An area pointing to a venue already added to the story
    { InputStoryAreaType -> Maybe Text
venue_provider :: Maybe T.Text -- ^ Provider of the venue
    , InputStoryAreaType -> Maybe Text
venue_id       :: Maybe T.Text -- ^ Identifier of the venue in the provider database
    }
  | InputStoryAreaTypeSuggestedReaction -- ^ An area pointing to a suggested reaction
    { InputStoryAreaType -> Maybe ReactionType
reaction_type :: Maybe ReactionType.ReactionType -- ^ Type of the reaction
    , InputStoryAreaType -> Maybe Bool
is_dark       :: Maybe Bool                      -- ^ True, if reaction has a dark background
    , InputStoryAreaType -> Maybe Bool
is_flipped    :: Maybe Bool                      -- ^ True, if reaction corner is flipped
    }
  | InputStoryAreaTypeMessage -- ^ An area pointing to a message
    { InputStoryAreaType -> Maybe Int
chat_id    :: Maybe Int -- ^ Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat
    , InputStoryAreaType -> Maybe Int
message_id :: Maybe Int -- ^ Identifier of the message. Use messageProperties.can_be_shared_in_story to check whether the message is suitable
    }
  | InputStoryAreaTypeLink -- ^ An area pointing to a HTTP or tg:// link
    { InputStoryAreaType -> Maybe Text
url :: Maybe T.Text -- ^ HTTP or tg:// URL to be opened when the area is clicked
    }
  | InputStoryAreaTypeWeather -- ^ An area with information about weather
    { InputStoryAreaType -> Maybe Double
temperature      :: Maybe Double -- ^ Temperature, in degree Celsius
    , InputStoryAreaType -> Maybe Text
emoji            :: Maybe T.Text -- ^ Emoji representing the weather
    , InputStoryAreaType -> Maybe Int
background_color :: Maybe Int    -- ^ A color of the area background in the ARGB format
    }
  deriving (InputStoryAreaType -> InputStoryAreaType -> Bool
(InputStoryAreaType -> InputStoryAreaType -> Bool)
-> (InputStoryAreaType -> InputStoryAreaType -> Bool)
-> Eq InputStoryAreaType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputStoryAreaType -> InputStoryAreaType -> Bool
== :: InputStoryAreaType -> InputStoryAreaType -> Bool
$c/= :: InputStoryAreaType -> InputStoryAreaType -> Bool
/= :: InputStoryAreaType -> InputStoryAreaType -> Bool
Eq, Int -> InputStoryAreaType -> ShowS
[InputStoryAreaType] -> ShowS
InputStoryAreaType -> String
(Int -> InputStoryAreaType -> ShowS)
-> (InputStoryAreaType -> String)
-> ([InputStoryAreaType] -> ShowS)
-> Show InputStoryAreaType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputStoryAreaType -> ShowS
showsPrec :: Int -> InputStoryAreaType -> ShowS
$cshow :: InputStoryAreaType -> String
show :: InputStoryAreaType -> String
$cshowList :: [InputStoryAreaType] -> ShowS
showList :: [InputStoryAreaType] -> ShowS
Show)

instance I.ShortShow InputStoryAreaType where
  shortShow :: InputStoryAreaType -> String
shortShow InputStoryAreaTypeLocation
    { location :: InputStoryAreaType -> Maybe Location
location = Maybe Location
location_
    , address :: InputStoryAreaType -> Maybe LocationAddress
address  = Maybe LocationAddress
address_
    }
      = String
"InputStoryAreaTypeLocation"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"location" String -> Maybe Location -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Location
location_
        , String
"address"  String -> Maybe LocationAddress -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe LocationAddress
address_
        ]
  shortShow InputStoryAreaTypeFoundVenue
    { query_id :: InputStoryAreaType -> Maybe Int
query_id  = Maybe Int
query_id_
    , result_id :: InputStoryAreaType -> Maybe Text
result_id = Maybe Text
result_id_
    }
      = String
"InputStoryAreaTypeFoundVenue"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"query_id"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
query_id_
        , String
"result_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
result_id_
        ]
  shortShow InputStoryAreaTypePreviousVenue
    { venue_provider :: InputStoryAreaType -> Maybe Text
venue_provider = Maybe Text
venue_provider_
    , venue_id :: InputStoryAreaType -> Maybe Text
venue_id       = Maybe Text
venue_id_
    }
      = String
"InputStoryAreaTypePreviousVenue"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"venue_provider" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
venue_provider_
        , String
"venue_id"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
venue_id_
        ]
  shortShow InputStoryAreaTypeSuggestedReaction
    { reaction_type :: InputStoryAreaType -> Maybe ReactionType
reaction_type = Maybe ReactionType
reaction_type_
    , is_dark :: InputStoryAreaType -> Maybe Bool
is_dark       = Maybe Bool
is_dark_
    , is_flipped :: InputStoryAreaType -> Maybe Bool
is_flipped    = Maybe Bool
is_flipped_
    }
      = String
"InputStoryAreaTypeSuggestedReaction"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"reaction_type" String -> Maybe ReactionType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ReactionType
reaction_type_
        , String
"is_dark"       String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_dark_
        , String
"is_flipped"    String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_flipped_
        ]
  shortShow InputStoryAreaTypeMessage
    { chat_id :: InputStoryAreaType -> Maybe Int
chat_id    = Maybe Int
chat_id_
    , message_id :: InputStoryAreaType -> Maybe Int
message_id = Maybe Int
message_id_
    }
      = String
"InputStoryAreaTypeMessage"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"chat_id"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
        , String
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
        ]
  shortShow InputStoryAreaTypeLink
    { url :: InputStoryAreaType -> Maybe Text
url = Maybe Text
url_
    }
      = String
"InputStoryAreaTypeLink"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"url" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
url_
        ]
  shortShow InputStoryAreaTypeWeather
    { temperature :: InputStoryAreaType -> Maybe Double
temperature      = Maybe Double
temperature_
    , emoji :: InputStoryAreaType -> Maybe Text
emoji            = Maybe Text
emoji_
    , background_color :: InputStoryAreaType -> Maybe Int
background_color = Maybe Int
background_color_
    }
      = String
"InputStoryAreaTypeWeather"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"temperature"      String -> Maybe Double -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Double
temperature_
        , String
"emoji"            String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
emoji_
        , String
"background_color" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
background_color_
        ]

instance AT.FromJSON InputStoryAreaType where
  parseJSON :: Value -> Parser InputStoryAreaType
parseJSON v :: Value
v@(AT.Object Object
obj) = do
    String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String

    case String
t of
      String
"inputStoryAreaTypeLocation"          -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeLocation Value
v
      String
"inputStoryAreaTypeFoundVenue"        -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeFoundVenue Value
v
      String
"inputStoryAreaTypePreviousVenue"     -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypePreviousVenue Value
v
      String
"inputStoryAreaTypeSuggestedReaction" -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeSuggestedReaction Value
v
      String
"inputStoryAreaTypeMessage"           -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeMessage Value
v
      String
"inputStoryAreaTypeLink"              -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeLink Value
v
      String
"inputStoryAreaTypeWeather"           -> Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeWeather Value
v
      String
_                                     -> Parser InputStoryAreaType
forall a. Monoid a => a
mempty
    
    where
      parseInputStoryAreaTypeLocation :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypeLocation :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeLocation = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypeLocation" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Location
location_ <- Object
o Object -> Key -> Parser (Maybe Location)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"location"
        Maybe LocationAddress
address_  <- Object
o Object -> Key -> Parser (Maybe LocationAddress)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"address"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypeLocation
          { location :: Maybe Location
location = Maybe Location
location_
          , address :: Maybe LocationAddress
address  = Maybe LocationAddress
address_
          }
      parseInputStoryAreaTypeFoundVenue :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypeFoundVenue :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeFoundVenue = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypeFoundVenue" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
query_id_  <- (String -> Int) -> Maybe String -> Maybe Int
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Int
I.readInt64 (Maybe String -> Maybe Int)
-> Parser (Maybe String) -> Parser (Maybe Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"query_id"
        Maybe Text
result_id_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"result_id"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypeFoundVenue
          { query_id :: Maybe Int
query_id  = Maybe Int
query_id_
          , result_id :: Maybe Text
result_id = Maybe Text
result_id_
          }
      parseInputStoryAreaTypePreviousVenue :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypePreviousVenue :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypePreviousVenue = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypePreviousVenue" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
venue_provider_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"venue_provider"
        Maybe Text
venue_id_       <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"venue_id"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypePreviousVenue
          { venue_provider :: Maybe Text
venue_provider = Maybe Text
venue_provider_
          , venue_id :: Maybe Text
venue_id       = Maybe Text
venue_id_
          }
      parseInputStoryAreaTypeSuggestedReaction :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypeSuggestedReaction :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeSuggestedReaction = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypeSuggestedReaction" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe ReactionType
reaction_type_ <- Object
o Object -> Key -> Parser (Maybe ReactionType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"reaction_type"
        Maybe Bool
is_dark_       <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_dark"
        Maybe Bool
is_flipped_    <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"is_flipped"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypeSuggestedReaction
          { reaction_type :: Maybe ReactionType
reaction_type = Maybe ReactionType
reaction_type_
          , is_dark :: Maybe Bool
is_dark       = Maybe Bool
is_dark_
          , is_flipped :: Maybe Bool
is_flipped    = Maybe Bool
is_flipped_
          }
      parseInputStoryAreaTypeMessage :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypeMessage :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeMessage = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypeMessage" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
chat_id_    <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"chat_id"
        Maybe Int
message_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"message_id"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypeMessage
          { chat_id :: Maybe Int
chat_id    = Maybe Int
chat_id_
          , message_id :: Maybe Int
message_id = Maybe Int
message_id_
          }
      parseInputStoryAreaTypeLink :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypeLink :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeLink = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypeLink" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
url_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"url"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypeLink
          { url :: Maybe Text
url = Maybe Text
url_
          }
      parseInputStoryAreaTypeWeather :: A.Value -> AT.Parser InputStoryAreaType
      parseInputStoryAreaTypeWeather :: Value -> Parser InputStoryAreaType
parseInputStoryAreaTypeWeather = String
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"InputStoryAreaTypeWeather" ((Object -> Parser InputStoryAreaType)
 -> Value -> Parser InputStoryAreaType)
-> (Object -> Parser InputStoryAreaType)
-> Value
-> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Double
temperature_      <- Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"temperature"
        Maybe Text
emoji_            <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"emoji"
        Maybe Int
background_color_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"background_color"
        InputStoryAreaType -> Parser InputStoryAreaType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputStoryAreaType -> Parser InputStoryAreaType)
-> InputStoryAreaType -> Parser InputStoryAreaType
forall a b. (a -> b) -> a -> b
$ InputStoryAreaTypeWeather
          { temperature :: Maybe Double
temperature      = Maybe Double
temperature_
          , emoji :: Maybe Text
emoji            = Maybe Text
emoji_
          , background_color :: Maybe Int
background_color = Maybe Int
background_color_
          }
  parseJSON Value
_ = Parser InputStoryAreaType
forall a. Monoid a => a
mempty

instance AT.ToJSON InputStoryAreaType where
  toJSON :: InputStoryAreaType -> Value
toJSON InputStoryAreaTypeLocation
    { location :: InputStoryAreaType -> Maybe Location
location = Maybe Location
location_
    , address :: InputStoryAreaType -> Maybe LocationAddress
address  = Maybe LocationAddress
address_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type"    Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypeLocation"
        , Key
"location" Key -> Maybe Location -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Location
location_
        , Key
"address"  Key -> Maybe LocationAddress -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe LocationAddress
address_
        ]
  toJSON InputStoryAreaTypeFoundVenue
    { query_id :: InputStoryAreaType -> Maybe Int
query_id  = Maybe Int
query_id_
    , result_id :: InputStoryAreaType -> Maybe Text
result_id = Maybe Text
result_id_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type"     Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypeFoundVenue"
        , Key
"query_id"  Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
query_id_
        , Key
"result_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
result_id_
        ]
  toJSON InputStoryAreaTypePreviousVenue
    { venue_provider :: InputStoryAreaType -> Maybe Text
venue_provider = Maybe Text
venue_provider_
    , venue_id :: InputStoryAreaType -> Maybe Text
venue_id       = Maybe Text
venue_id_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type"          Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypePreviousVenue"
        , Key
"venue_provider" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
venue_provider_
        , Key
"venue_id"       Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
venue_id_
        ]
  toJSON InputStoryAreaTypeSuggestedReaction
    { reaction_type :: InputStoryAreaType -> Maybe ReactionType
reaction_type = Maybe ReactionType
reaction_type_
    , is_dark :: InputStoryAreaType -> Maybe Bool
is_dark       = Maybe Bool
is_dark_
    , is_flipped :: InputStoryAreaType -> Maybe Bool
is_flipped    = Maybe Bool
is_flipped_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type"         Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypeSuggestedReaction"
        , Key
"reaction_type" Key -> Maybe ReactionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ReactionType
reaction_type_
        , Key
"is_dark"       Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_dark_
        , Key
"is_flipped"    Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_flipped_
        ]
  toJSON InputStoryAreaTypeMessage
    { chat_id :: InputStoryAreaType -> Maybe Int
chat_id    = Maybe Int
chat_id_
    , message_id :: InputStoryAreaType -> Maybe Int
message_id = Maybe Int
message_id_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type"      Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypeMessage"
        , Key
"chat_id"    Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
        , Key
"message_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
message_id_
        ]
  toJSON InputStoryAreaTypeLink
    { url :: InputStoryAreaType -> Maybe Text
url = Maybe Text
url_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type" Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypeLink"
        , Key
"url"   Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
url_
        ]
  toJSON InputStoryAreaTypeWeather
    { temperature :: InputStoryAreaType -> Maybe Double
temperature      = Maybe Double
temperature_
    , emoji :: InputStoryAreaType -> Maybe Text
emoji            = Maybe Text
emoji_
    , background_color :: InputStoryAreaType -> Maybe Int
background_color = Maybe Int
background_color_
    }
      = [Pair] -> Value
A.object
        [ Key
"@type"            Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"inputStoryAreaTypeWeather"
        , Key
"temperature"      Key -> Maybe Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Double
temperature_
        , Key
"emoji"            Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
emoji_
        , Key
"background_color" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
background_color_
        ]