module TD.Query.StartLiveStory
  (StartLiveStory(..)
  , defaultStartLiveStory
  ) 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.StoryPrivacySettings as StoryPrivacySettings

-- | Starts a new live story on behalf of a chat; requires can_post_stories administrator right for channel chats. Returns 'TD.Data.StartLiveStoryResult.StartLiveStoryResult'
data StartLiveStory
  = StartLiveStory
    { StartLiveStory -> Maybe Int
chat_id                 :: Maybe Int                                       -- ^ Identifier of the chat that will start the live story. Pass Saved Messages chat identifier when starting a live story on behalf of the current user, or a channel chat identifier
    , StartLiveStory -> Maybe StoryPrivacySettings
privacy_settings        :: Maybe StoryPrivacySettings.StoryPrivacySettings -- ^ The privacy settings for the story; ignored for stories posted on behalf of channel chats
    , StartLiveStory -> Maybe Bool
protect_content         :: Maybe Bool                                      -- ^ Pass true if the content of the story must be protected from screenshotting
    , StartLiveStory -> Maybe Bool
is_rtmp_stream          :: Maybe Bool                                      -- ^ Pass true to create an RTMP stream instead of an ordinary group call
    , StartLiveStory -> Maybe Bool
enable_messages         :: Maybe Bool                                      -- ^ Pass true to allow viewers of the story to send messages
    ,  :: Maybe Int                                       -- ^ The minimum number of Telegram Stars that must be paid by viewers for each sent message to the call; 0-getOption("paid_group_call_message_star_count_max")
    }
  deriving (StartLiveStory -> StartLiveStory -> Bool
(StartLiveStory -> StartLiveStory -> Bool)
-> (StartLiveStory -> StartLiveStory -> Bool) -> Eq StartLiveStory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StartLiveStory -> StartLiveStory -> Bool
== :: StartLiveStory -> StartLiveStory -> Bool
$c/= :: StartLiveStory -> StartLiveStory -> Bool
/= :: StartLiveStory -> StartLiveStory -> Bool
Eq, Int -> StartLiveStory -> ShowS
[StartLiveStory] -> ShowS
StartLiveStory -> String
(Int -> StartLiveStory -> ShowS)
-> (StartLiveStory -> String)
-> ([StartLiveStory] -> ShowS)
-> Show StartLiveStory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StartLiveStory -> ShowS
showsPrec :: Int -> StartLiveStory -> ShowS
$cshow :: StartLiveStory -> String
show :: StartLiveStory -> String
$cshowList :: [StartLiveStory] -> ShowS
showList :: [StartLiveStory] -> ShowS
Show)

instance I.ShortShow StartLiveStory where
  shortShow :: StartLiveStory -> String
shortShow
    StartLiveStory
      { chat_id :: StartLiveStory -> Maybe Int
chat_id                 = Maybe Int
chat_id_
      , privacy_settings :: StartLiveStory -> Maybe StoryPrivacySettings
privacy_settings        = Maybe StoryPrivacySettings
privacy_settings_
      , protect_content :: StartLiveStory -> Maybe Bool
protect_content         = Maybe Bool
protect_content_
      , is_rtmp_stream :: StartLiveStory -> Maybe Bool
is_rtmp_stream          = Maybe Bool
is_rtmp_stream_
      , enable_messages :: StartLiveStory -> Maybe Bool
enable_messages         = Maybe Bool
enable_messages_
      , paid_message_star_count :: StartLiveStory -> Maybe Int
paid_message_star_count = Maybe Int
paid_message_star_count_
      }
        = String
"StartLiveStory"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"                 String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"privacy_settings"        String -> Maybe StoryPrivacySettings -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StoryPrivacySettings
privacy_settings_
          , String
"protect_content"         String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
protect_content_
          , String
"is_rtmp_stream"          String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_rtmp_stream_
          , String
"enable_messages"         String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
enable_messages_
          , String
"paid_message_star_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
paid_message_star_count_
          ]

instance AT.ToJSON StartLiveStory where
  toJSON :: StartLiveStory -> Value
toJSON
    StartLiveStory
      { chat_id :: StartLiveStory -> Maybe Int
chat_id                 = Maybe Int
chat_id_
      , privacy_settings :: StartLiveStory -> Maybe StoryPrivacySettings
privacy_settings        = Maybe StoryPrivacySettings
privacy_settings_
      , protect_content :: StartLiveStory -> Maybe Bool
protect_content         = Maybe Bool
protect_content_
      , is_rtmp_stream :: StartLiveStory -> Maybe Bool
is_rtmp_stream          = Maybe Bool
is_rtmp_stream_
      , enable_messages :: StartLiveStory -> Maybe Bool
enable_messages         = Maybe Bool
enable_messages_
      , paid_message_star_count :: StartLiveStory -> Maybe Int
paid_message_star_count = Maybe Int
paid_message_star_count_
      }
        = [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
"startLiveStory"
          , Key
"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
chat_id_
          , 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_
          , Key
"protect_content"         Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
protect_content_
          , Key
"is_rtmp_stream"          Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_rtmp_stream_
          , Key
"enable_messages"         Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
enable_messages_
          , Key
"paid_message_star_count" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
paid_message_star_count_
          ]

defaultStartLiveStory :: StartLiveStory
defaultStartLiveStory :: StartLiveStory
defaultStartLiveStory =
  StartLiveStory
    { chat_id :: Maybe Int
chat_id                 = Maybe Int
forall a. Maybe a
Nothing
    , privacy_settings :: Maybe StoryPrivacySettings
privacy_settings        = Maybe StoryPrivacySettings
forall a. Maybe a
Nothing
    , protect_content :: Maybe Bool
protect_content         = Maybe Bool
forall a. Maybe a
Nothing
    , is_rtmp_stream :: Maybe Bool
is_rtmp_stream          = Maybe Bool
forall a. Maybe a
Nothing
    , enable_messages :: Maybe Bool
enable_messages         = Maybe Bool
forall a. Maybe a
Nothing
    , paid_message_star_count :: Maybe Int
paid_message_star_count = Maybe Int
forall a. Maybe a
Nothing
    }