module TD.Query.SetBusinessStartPage
  (SetBusinessStartPage(..)
  ) 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.InputBusinessStartPage as InputBusinessStartPage

-- | Changes the business start page of the current user. Requires Telegram Business subscription. Returns 'TD.Data.Ok.Ok'
data SetBusinessStartPage
  = SetBusinessStartPage
    { SetBusinessStartPage -> Maybe InputBusinessStartPage
start_page :: Maybe InputBusinessStartPage.InputBusinessStartPage -- ^ The new start page of the business; pass null to remove custom start page
    }
  deriving (SetBusinessStartPage -> SetBusinessStartPage -> Bool
(SetBusinessStartPage -> SetBusinessStartPage -> Bool)
-> (SetBusinessStartPage -> SetBusinessStartPage -> Bool)
-> Eq SetBusinessStartPage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBusinessStartPage -> SetBusinessStartPage -> Bool
== :: SetBusinessStartPage -> SetBusinessStartPage -> Bool
$c/= :: SetBusinessStartPage -> SetBusinessStartPage -> Bool
/= :: SetBusinessStartPage -> SetBusinessStartPage -> Bool
Eq, Int -> SetBusinessStartPage -> ShowS
[SetBusinessStartPage] -> ShowS
SetBusinessStartPage -> String
(Int -> SetBusinessStartPage -> ShowS)
-> (SetBusinessStartPage -> String)
-> ([SetBusinessStartPage] -> ShowS)
-> Show SetBusinessStartPage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBusinessStartPage -> ShowS
showsPrec :: Int -> SetBusinessStartPage -> ShowS
$cshow :: SetBusinessStartPage -> String
show :: SetBusinessStartPage -> String
$cshowList :: [SetBusinessStartPage] -> ShowS
showList :: [SetBusinessStartPage] -> ShowS
Show)

instance I.ShortShow SetBusinessStartPage where
  shortShow :: SetBusinessStartPage -> String
shortShow
    SetBusinessStartPage
      { start_page :: SetBusinessStartPage -> Maybe InputBusinessStartPage
start_page = Maybe InputBusinessStartPage
start_page_
      }
        = String
"SetBusinessStartPage"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"start_page" String -> Maybe InputBusinessStartPage -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputBusinessStartPage
start_page_
          ]

instance AT.ToJSON SetBusinessStartPage where
  toJSON :: SetBusinessStartPage -> Value
toJSON
    SetBusinessStartPage
      { start_page :: SetBusinessStartPage -> Maybe InputBusinessStartPage
start_page = Maybe InputBusinessStartPage
start_page_
      }
        = [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
"setBusinessStartPage"
          , Key
"start_page" Key -> Maybe InputBusinessStartPage -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputBusinessStartPage
start_page_
          ]