module TD.Query.EditBusinessStory
  (EditBusinessStory(..)
  , defaultEditBusinessStory
  ) 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.InputStoryContent as InputStoryContent
import qualified TD.Data.InputStoryAreas as InputStoryAreas
import qualified TD.Data.FormattedText as FormattedText
import qualified TD.Data.StoryPrivacySettings as StoryPrivacySettings

-- | Changes a story posted by the bot on behalf of a business account; for bots only. Returns 'TD.Data.Story.Story'
data EditBusinessStory
  = EditBusinessStory
    { EditBusinessStory -> Maybe Int
story_poster_chat_id :: Maybe Int                                       -- ^ Identifier of the chat that posted the story
    , EditBusinessStory -> Maybe Int
story_id             :: Maybe Int                                       -- ^ Identifier of the story to edit
    , EditBusinessStory -> Maybe InputStoryContent
content              :: Maybe InputStoryContent.InputStoryContent       -- ^ New content of the story
    , EditBusinessStory -> Maybe InputStoryAreas
areas                :: Maybe InputStoryAreas.InputStoryAreas           -- ^ New clickable rectangle areas to be shown on the story media
    , EditBusinessStory -> Maybe FormattedText
caption              :: Maybe FormattedText.FormattedText               -- ^ New story caption
    , EditBusinessStory -> Maybe StoryPrivacySettings
privacy_settings     :: Maybe StoryPrivacySettings.StoryPrivacySettings -- ^ The new privacy settings for the story
    }
  deriving (EditBusinessStory -> EditBusinessStory -> Bool
(EditBusinessStory -> EditBusinessStory -> Bool)
-> (EditBusinessStory -> EditBusinessStory -> Bool)
-> Eq EditBusinessStory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditBusinessStory -> EditBusinessStory -> Bool
== :: EditBusinessStory -> EditBusinessStory -> Bool
$c/= :: EditBusinessStory -> EditBusinessStory -> Bool
/= :: EditBusinessStory -> EditBusinessStory -> Bool
Eq, Int -> EditBusinessStory -> ShowS
[EditBusinessStory] -> ShowS
EditBusinessStory -> String
(Int -> EditBusinessStory -> ShowS)
-> (EditBusinessStory -> String)
-> ([EditBusinessStory] -> ShowS)
-> Show EditBusinessStory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditBusinessStory -> ShowS
showsPrec :: Int -> EditBusinessStory -> ShowS
$cshow :: EditBusinessStory -> String
show :: EditBusinessStory -> String
$cshowList :: [EditBusinessStory] -> ShowS
showList :: [EditBusinessStory] -> ShowS
Show)

instance I.ShortShow EditBusinessStory where
  shortShow :: EditBusinessStory -> String
shortShow
    EditBusinessStory
      { story_poster_chat_id :: EditBusinessStory -> Maybe Int
story_poster_chat_id = Maybe Int
story_poster_chat_id_
      , story_id :: EditBusinessStory -> Maybe Int
story_id             = Maybe Int
story_id_
      , content :: EditBusinessStory -> Maybe InputStoryContent
content              = Maybe InputStoryContent
content_
      , areas :: EditBusinessStory -> Maybe InputStoryAreas
areas                = Maybe InputStoryAreas
areas_
      , caption :: EditBusinessStory -> Maybe FormattedText
caption              = Maybe FormattedText
caption_
      , privacy_settings :: EditBusinessStory -> Maybe StoryPrivacySettings
privacy_settings     = Maybe StoryPrivacySettings
privacy_settings_
      }
        = String
"EditBusinessStory"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"story_poster_chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_poster_chat_id_
          , String
"story_id"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
story_id_
          , String
"content"              String -> Maybe InputStoryContent -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputStoryContent
content_
          , String
"areas"                String -> Maybe InputStoryAreas -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputStoryAreas
areas_
          , String
"caption"              String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
caption_
          , String
"privacy_settings"     String -> Maybe StoryPrivacySettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StoryPrivacySettings
privacy_settings_
          ]

instance AT.ToJSON EditBusinessStory where
  toJSON :: EditBusinessStory -> Value
toJSON
    EditBusinessStory
      { story_poster_chat_id :: EditBusinessStory -> Maybe Int
story_poster_chat_id = Maybe Int
story_poster_chat_id_
      , story_id :: EditBusinessStory -> Maybe Int
story_id             = Maybe Int
story_id_
      , content :: EditBusinessStory -> Maybe InputStoryContent
content              = Maybe InputStoryContent
content_
      , areas :: EditBusinessStory -> Maybe InputStoryAreas
areas                = Maybe InputStoryAreas
areas_
      , caption :: EditBusinessStory -> Maybe FormattedText
caption              = Maybe FormattedText
caption_
      , privacy_settings :: EditBusinessStory -> Maybe StoryPrivacySettings
privacy_settings     = Maybe StoryPrivacySettings
privacy_settings_
      }
        = [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
"editBusinessStory"
          , Key
"story_poster_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
story_poster_chat_id_
          , Key
"story_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
story_id_
          , Key
"content"              Key -> Maybe InputStoryContent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputStoryContent
content_
          , Key
"areas"                Key -> Maybe InputStoryAreas -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputStoryAreas
areas_
          , Key
"caption"              Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
caption_
          , Key
"privacy_settings"     Key -> Maybe StoryPrivacySettings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StoryPrivacySettings
privacy_settings_
          ]

defaultEditBusinessStory :: EditBusinessStory
defaultEditBusinessStory :: EditBusinessStory
defaultEditBusinessStory =
  EditBusinessStory
    { story_poster_chat_id :: Maybe Int
story_poster_chat_id = Maybe Int
forall a. Maybe a
Nothing
    , story_id :: Maybe Int
story_id             = Maybe Int
forall a. Maybe a
Nothing
    , content :: Maybe InputStoryContent
content              = Maybe InputStoryContent
forall a. Maybe a
Nothing
    , areas :: Maybe InputStoryAreas
areas                = Maybe InputStoryAreas
forall a. Maybe a
Nothing
    , caption :: Maybe FormattedText
caption              = Maybe FormattedText
forall a. Maybe a
Nothing
    , privacy_settings :: Maybe StoryPrivacySettings
privacy_settings     = Maybe StoryPrivacySettings
forall a. Maybe a
Nothing
    }