module TD.Query.SetBusinessAccountUsername
  (SetBusinessAccountUsername(..)
  , defaultSetBusinessAccountUsername
  ) where

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

-- | Changes the editable username of a business account; for bots only. Returns 'TD.Data.Ok.Ok'
data SetBusinessAccountUsername
  = SetBusinessAccountUsername
    { SetBusinessAccountUsername -> Maybe Text
business_connection_id :: Maybe T.Text -- ^ Unique identifier of business connection
    , SetBusinessAccountUsername -> Maybe Text
username               :: Maybe T.Text -- ^ The new value of the username
    }
  deriving (SetBusinessAccountUsername -> SetBusinessAccountUsername -> Bool
(SetBusinessAccountUsername -> SetBusinessAccountUsername -> Bool)
-> (SetBusinessAccountUsername
    -> SetBusinessAccountUsername -> Bool)
-> Eq SetBusinessAccountUsername
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBusinessAccountUsername -> SetBusinessAccountUsername -> Bool
== :: SetBusinessAccountUsername -> SetBusinessAccountUsername -> Bool
$c/= :: SetBusinessAccountUsername -> SetBusinessAccountUsername -> Bool
/= :: SetBusinessAccountUsername -> SetBusinessAccountUsername -> Bool
Eq, Int -> SetBusinessAccountUsername -> ShowS
[SetBusinessAccountUsername] -> ShowS
SetBusinessAccountUsername -> String
(Int -> SetBusinessAccountUsername -> ShowS)
-> (SetBusinessAccountUsername -> String)
-> ([SetBusinessAccountUsername] -> ShowS)
-> Show SetBusinessAccountUsername
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBusinessAccountUsername -> ShowS
showsPrec :: Int -> SetBusinessAccountUsername -> ShowS
$cshow :: SetBusinessAccountUsername -> String
show :: SetBusinessAccountUsername -> String
$cshowList :: [SetBusinessAccountUsername] -> ShowS
showList :: [SetBusinessAccountUsername] -> ShowS
Show)

instance I.ShortShow SetBusinessAccountUsername where
  shortShow :: SetBusinessAccountUsername -> String
shortShow
    SetBusinessAccountUsername
      { business_connection_id :: SetBusinessAccountUsername -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , username :: SetBusinessAccountUsername -> Maybe Text
username               = Maybe Text
username_
      }
        = String
"SetBusinessAccountUsername"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"business_connection_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
business_connection_id_
          , String
"username"               String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
username_
          ]

instance AT.ToJSON SetBusinessAccountUsername where
  toJSON :: SetBusinessAccountUsername -> Value
toJSON
    SetBusinessAccountUsername
      { business_connection_id :: SetBusinessAccountUsername -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , username :: SetBusinessAccountUsername -> Maybe Text
username               = Maybe Text
username_
      }
        = [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
"setBusinessAccountUsername"
          , Key
"business_connection_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
business_connection_id_
          , Key
"username"               Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
username_
          ]

defaultSetBusinessAccountUsername :: SetBusinessAccountUsername
defaultSetBusinessAccountUsername :: SetBusinessAccountUsername
defaultSetBusinessAccountUsername =
  SetBusinessAccountUsername
    { business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
    , username :: Maybe Text
username               = Maybe Text
forall a. Maybe a
Nothing
    }