module TD.Query.RemoveContacts
  (RemoveContacts(..)
  ) where

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

-- | Removes users from the contact list. Returns 'TD.Data.Ok.Ok'
data RemoveContacts
  = RemoveContacts
    { RemoveContacts -> Maybe [Int]
user_ids :: Maybe [Int] -- ^ Identifiers of users to be deleted
    }
  deriving (RemoveContacts -> RemoveContacts -> Bool
(RemoveContacts -> RemoveContacts -> Bool)
-> (RemoveContacts -> RemoveContacts -> Bool) -> Eq RemoveContacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveContacts -> RemoveContacts -> Bool
== :: RemoveContacts -> RemoveContacts -> Bool
$c/= :: RemoveContacts -> RemoveContacts -> Bool
/= :: RemoveContacts -> RemoveContacts -> Bool
Eq, Int -> RemoveContacts -> ShowS
[RemoveContacts] -> ShowS
RemoveContacts -> String
(Int -> RemoveContacts -> ShowS)
-> (RemoveContacts -> String)
-> ([RemoveContacts] -> ShowS)
-> Show RemoveContacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveContacts -> ShowS
showsPrec :: Int -> RemoveContacts -> ShowS
$cshow :: RemoveContacts -> String
show :: RemoveContacts -> String
$cshowList :: [RemoveContacts] -> ShowS
showList :: [RemoveContacts] -> ShowS
Show)

instance I.ShortShow RemoveContacts where
  shortShow :: RemoveContacts -> String
shortShow
    RemoveContacts
      { user_ids :: RemoveContacts -> Maybe [Int]
user_ids = Maybe [Int]
user_ids_
      }
        = String
"RemoveContacts"
          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 RemoveContacts where
  toJSON :: RemoveContacts -> Value
toJSON
    RemoveContacts
      { user_ids :: RemoveContacts -> 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
"removeContacts"
          , 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_
          ]