module TD.Query.SetCloseFriends
  (SetCloseFriends(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Changes the list of close friends of the current user. Returns 'TD.Data.Ok.Ok'
data SetCloseFriends
  = SetCloseFriends
    { SetCloseFriends -> Maybe [Int]
user_ids :: Maybe [Int] -- ^ User identifiers of close friends; the users must be contacts of the current user
    }
  deriving (SetCloseFriends -> SetCloseFriends -> Bool
(SetCloseFriends -> SetCloseFriends -> Bool)
-> (SetCloseFriends -> SetCloseFriends -> Bool)
-> Eq SetCloseFriends
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetCloseFriends -> SetCloseFriends -> Bool
== :: SetCloseFriends -> SetCloseFriends -> Bool
$c/= :: SetCloseFriends -> SetCloseFriends -> Bool
/= :: SetCloseFriends -> SetCloseFriends -> Bool
Eq, Int -> SetCloseFriends -> ShowS
[SetCloseFriends] -> ShowS
SetCloseFriends -> String
(Int -> SetCloseFriends -> ShowS)
-> (SetCloseFriends -> String)
-> ([SetCloseFriends] -> ShowS)
-> Show SetCloseFriends
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetCloseFriends -> ShowS
showsPrec :: Int -> SetCloseFriends -> ShowS
$cshow :: SetCloseFriends -> String
show :: SetCloseFriends -> String
$cshowList :: [SetCloseFriends] -> ShowS
showList :: [SetCloseFriends] -> ShowS
Show)

instance I.ShortShow SetCloseFriends where
  shortShow :: SetCloseFriends -> String
shortShow
    SetCloseFriends
      { user_ids :: SetCloseFriends -> Maybe [Int]
user_ids = Maybe [Int]
user_ids_
      }
        = String
"SetCloseFriends"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"user_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
user_ids_
          ]

instance AT.ToJSON SetCloseFriends where
  toJSON :: SetCloseFriends -> Value
toJSON
    SetCloseFriends
      { user_ids :: SetCloseFriends -> Maybe [Int]
user_ids = Maybe [Int]
user_ids_
      }
        = [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
"setCloseFriends"
          , Key
"user_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
user_ids_
          ]