{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Telegram.Bot.API.Types.Story where

import Data.Aeson (FromJSON (..), ToJSON (..))
import GHC.Generics (Generic)

import Telegram.Bot.API.Internal.Utils
import Telegram.Bot.API.Types.Chat


-- ** 'Story'

-- | Unique identifier for the story in the chat
newtype StoryId = StoryId Int
  deriving (Int -> StoryId -> ShowS
[StoryId] -> ShowS
StoryId -> String
(Int -> StoryId -> ShowS)
-> (StoryId -> String) -> ([StoryId] -> ShowS) -> Show StoryId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StoryId -> ShowS
showsPrec :: Int -> StoryId -> ShowS
$cshow :: StoryId -> String
show :: StoryId -> String
$cshowList :: [StoryId] -> ShowS
showList :: [StoryId] -> ShowS
Show, [StoryId] -> Value
[StoryId] -> Encoding
StoryId -> Bool
StoryId -> Value
StoryId -> Encoding
(StoryId -> Value)
-> (StoryId -> Encoding)
-> ([StoryId] -> Value)
-> ([StoryId] -> Encoding)
-> (StoryId -> Bool)
-> ToJSON StoryId
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
$ctoJSON :: StoryId -> Value
toJSON :: StoryId -> Value
$ctoEncoding :: StoryId -> Encoding
toEncoding :: StoryId -> Encoding
$ctoJSONList :: [StoryId] -> Value
toJSONList :: [StoryId] -> Value
$ctoEncodingList :: [StoryId] -> Encoding
toEncodingList :: [StoryId] -> Encoding
$comitField :: StoryId -> Bool
omitField :: StoryId -> Bool
ToJSON, Maybe StoryId
Value -> Parser [StoryId]
Value -> Parser StoryId
(Value -> Parser StoryId)
-> (Value -> Parser [StoryId]) -> Maybe StoryId -> FromJSON StoryId
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
$cparseJSON :: Value -> Parser StoryId
parseJSON :: Value -> Parser StoryId
$cparseJSONList :: Value -> Parser [StoryId]
parseJSONList :: Value -> Parser [StoryId]
$comittedField :: Maybe StoryId
omittedField :: Maybe StoryId
FromJSON)

-- | This object represents a message about a story.
data Story = Story
  { Story -> Chat
storyChat :: Chat -- ^ Chat that posted the story.
  , Story -> StoryId
storyId :: StoryId -- ^ Unique identifier for the story in the chat.
  }
  deriving ((forall x. Story -> Rep Story x)
-> (forall x. Rep Story x -> Story) -> Generic Story
forall x. Rep Story x -> Story
forall x. Story -> Rep Story x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Story -> Rep Story x
from :: forall x. Story -> Rep Story x
$cto :: forall x. Rep Story x -> Story
to :: forall x. Rep Story x -> Story
Generic, Int -> Story -> ShowS
[Story] -> ShowS
Story -> String
(Int -> Story -> ShowS)
-> (Story -> String) -> ([Story] -> ShowS) -> Show Story
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Story -> ShowS
showsPrec :: Int -> Story -> ShowS
$cshow :: Story -> String
show :: Story -> String
$cshowList :: [Story] -> ShowS
showList :: [Story] -> ShowS
Show)

instance ToJSON Story where toJSON :: Story -> Value
toJSON = Story -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON Story where parseJSON :: Value -> Parser Story
parseJSON = Value -> Parser Story
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON