module TD.Query.GetMapThumbnailFile
  (GetMapThumbnailFile(..)
  , defaultGetMapThumbnailFile
  ) 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

-- | Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded. Returns 'TD.Data.File.File'
data GetMapThumbnailFile
  = GetMapThumbnailFile
    { GetMapThumbnailFile -> Maybe Location
location :: Maybe Location.Location -- ^ Location of the map center
    , GetMapThumbnailFile -> Maybe Int
zoom     :: Maybe Int               -- ^ Map zoom level; 13-20
    , GetMapThumbnailFile -> Maybe Int
width    :: Maybe Int               -- ^ Map width in pixels before applying scale; 16-1024
    , GetMapThumbnailFile -> Maybe Int
height   :: Maybe Int               -- ^ Map height in pixels before applying scale; 16-1024
    , GetMapThumbnailFile -> Maybe Int
scale    :: Maybe Int               -- ^ Map scale; 1-3
    , GetMapThumbnailFile -> Maybe Int
chat_id  :: Maybe Int               -- ^ Identifier of a chat in which the thumbnail will be shown. Use 0 if unknown
    }
  deriving (GetMapThumbnailFile -> GetMapThumbnailFile -> Bool
(GetMapThumbnailFile -> GetMapThumbnailFile -> Bool)
-> (GetMapThumbnailFile -> GetMapThumbnailFile -> Bool)
-> Eq GetMapThumbnailFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetMapThumbnailFile -> GetMapThumbnailFile -> Bool
== :: GetMapThumbnailFile -> GetMapThumbnailFile -> Bool
$c/= :: GetMapThumbnailFile -> GetMapThumbnailFile -> Bool
/= :: GetMapThumbnailFile -> GetMapThumbnailFile -> Bool
Eq, Int -> GetMapThumbnailFile -> ShowS
[GetMapThumbnailFile] -> ShowS
GetMapThumbnailFile -> String
(Int -> GetMapThumbnailFile -> ShowS)
-> (GetMapThumbnailFile -> String)
-> ([GetMapThumbnailFile] -> ShowS)
-> Show GetMapThumbnailFile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetMapThumbnailFile -> ShowS
showsPrec :: Int -> GetMapThumbnailFile -> ShowS
$cshow :: GetMapThumbnailFile -> String
show :: GetMapThumbnailFile -> String
$cshowList :: [GetMapThumbnailFile] -> ShowS
showList :: [GetMapThumbnailFile] -> ShowS
Show)

instance I.ShortShow GetMapThumbnailFile where
  shortShow :: GetMapThumbnailFile -> String
shortShow
    GetMapThumbnailFile
      { location :: GetMapThumbnailFile -> Maybe Location
location = Maybe Location
location_
      , zoom :: GetMapThumbnailFile -> Maybe Int
zoom     = Maybe Int
zoom_
      , width :: GetMapThumbnailFile -> Maybe Int
width    = Maybe Int
width_
      , height :: GetMapThumbnailFile -> Maybe Int
height   = Maybe Int
height_
      , scale :: GetMapThumbnailFile -> Maybe Int
scale    = Maybe Int
scale_
      , chat_id :: GetMapThumbnailFile -> Maybe Int
chat_id  = Maybe Int
chat_id_
      }
        = String
"GetMapThumbnailFile"
          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
"zoom"     String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
zoom_
          , String
"width"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
width_
          , String
"height"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
height_
          , String
"scale"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
scale_
          , String
"chat_id"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          ]

instance AT.ToJSON GetMapThumbnailFile where
  toJSON :: GetMapThumbnailFile -> Value
toJSON
    GetMapThumbnailFile
      { location :: GetMapThumbnailFile -> Maybe Location
location = Maybe Location
location_
      , zoom :: GetMapThumbnailFile -> Maybe Int
zoom     = Maybe Int
zoom_
      , width :: GetMapThumbnailFile -> Maybe Int
width    = Maybe Int
width_
      , height :: GetMapThumbnailFile -> Maybe Int
height   = Maybe Int
height_
      , scale :: GetMapThumbnailFile -> Maybe Int
scale    = Maybe Int
scale_
      , chat_id :: GetMapThumbnailFile -> Maybe Int
chat_id  = Maybe Int
chat_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
"getMapThumbnailFile"
          , 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
"zoom"     Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
zoom_
          , Key
"width"    Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
width_
          , Key
"height"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
height_
          , Key
"scale"    Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
scale_
          , 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_
          ]

defaultGetMapThumbnailFile :: GetMapThumbnailFile
defaultGetMapThumbnailFile :: GetMapThumbnailFile
defaultGetMapThumbnailFile =
  GetMapThumbnailFile
    { location :: Maybe Location
location = Maybe Location
forall a. Maybe a
Nothing
    , zoom :: Maybe Int
zoom     = Maybe Int
forall a. Maybe a
Nothing
    , width :: Maybe Int
width    = Maybe Int
forall a. Maybe a
Nothing
    , height :: Maybe Int
height   = Maybe Int
forall a. Maybe a
Nothing
    , scale :: Maybe Int
scale    = Maybe Int
forall a. Maybe a
Nothing
    , chat_id :: Maybe Int
chat_id  = Maybe Int
forall a. Maybe a
Nothing
    }