{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.CognitoIdentityProvider.Types.EventFeedbackType
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CognitoIdentityProvider.Types.EventFeedbackType where

import Amazonka.CognitoIdentityProvider.Types.FeedbackValueType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Specifies the event feedback type.
--
-- /See:/ 'newEventFeedbackType' smart constructor.
data EventFeedbackType = EventFeedbackType'
  { -- | The event feedback date.
    EventFeedbackType -> Maybe POSIX
feedbackDate :: Prelude.Maybe Core.POSIX,
    -- | The event feedback value.
    EventFeedbackType -> FeedbackValueType
feedbackValue :: FeedbackValueType,
    -- | The provider.
    EventFeedbackType -> Text
provider :: Prelude.Text
  }
  deriving (EventFeedbackType -> EventFeedbackType -> Bool
(EventFeedbackType -> EventFeedbackType -> Bool)
-> (EventFeedbackType -> EventFeedbackType -> Bool)
-> Eq EventFeedbackType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventFeedbackType -> EventFeedbackType -> Bool
$c/= :: EventFeedbackType -> EventFeedbackType -> Bool
== :: EventFeedbackType -> EventFeedbackType -> Bool
$c== :: EventFeedbackType -> EventFeedbackType -> Bool
Prelude.Eq, ReadPrec [EventFeedbackType]
ReadPrec EventFeedbackType
Int -> ReadS EventFeedbackType
ReadS [EventFeedbackType]
(Int -> ReadS EventFeedbackType)
-> ReadS [EventFeedbackType]
-> ReadPrec EventFeedbackType
-> ReadPrec [EventFeedbackType]
-> Read EventFeedbackType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EventFeedbackType]
$creadListPrec :: ReadPrec [EventFeedbackType]
readPrec :: ReadPrec EventFeedbackType
$creadPrec :: ReadPrec EventFeedbackType
readList :: ReadS [EventFeedbackType]
$creadList :: ReadS [EventFeedbackType]
readsPrec :: Int -> ReadS EventFeedbackType
$creadsPrec :: Int -> ReadS EventFeedbackType
Prelude.Read, Int -> EventFeedbackType -> ShowS
[EventFeedbackType] -> ShowS
EventFeedbackType -> String
(Int -> EventFeedbackType -> ShowS)
-> (EventFeedbackType -> String)
-> ([EventFeedbackType] -> ShowS)
-> Show EventFeedbackType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EventFeedbackType] -> ShowS
$cshowList :: [EventFeedbackType] -> ShowS
show :: EventFeedbackType -> String
$cshow :: EventFeedbackType -> String
showsPrec :: Int -> EventFeedbackType -> ShowS
$cshowsPrec :: Int -> EventFeedbackType -> ShowS
Prelude.Show, (forall x. EventFeedbackType -> Rep EventFeedbackType x)
-> (forall x. Rep EventFeedbackType x -> EventFeedbackType)
-> Generic EventFeedbackType
forall x. Rep EventFeedbackType x -> EventFeedbackType
forall x. EventFeedbackType -> Rep EventFeedbackType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EventFeedbackType x -> EventFeedbackType
$cfrom :: forall x. EventFeedbackType -> Rep EventFeedbackType x
Prelude.Generic)

-- |
-- Create a value of 'EventFeedbackType' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'feedbackDate', 'eventFeedbackType_feedbackDate' - The event feedback date.
--
-- 'feedbackValue', 'eventFeedbackType_feedbackValue' - The event feedback value.
--
-- 'provider', 'eventFeedbackType_provider' - The provider.
newEventFeedbackType ::
  -- | 'feedbackValue'
  FeedbackValueType ->
  -- | 'provider'
  Prelude.Text ->
  EventFeedbackType
newEventFeedbackType :: FeedbackValueType -> Text -> EventFeedbackType
newEventFeedbackType FeedbackValueType
pFeedbackValue_ Text
pProvider_ =
  EventFeedbackType' :: Maybe POSIX -> FeedbackValueType -> Text -> EventFeedbackType
EventFeedbackType'
    { $sel:feedbackDate:EventFeedbackType' :: Maybe POSIX
feedbackDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackValue:EventFeedbackType' :: FeedbackValueType
feedbackValue = FeedbackValueType
pFeedbackValue_,
      $sel:provider:EventFeedbackType' :: Text
provider = Text
pProvider_
    }

-- | The event feedback date.
eventFeedbackType_feedbackDate :: Lens.Lens' EventFeedbackType (Prelude.Maybe Prelude.UTCTime)
eventFeedbackType_feedbackDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EventFeedbackType -> f EventFeedbackType
eventFeedbackType_feedbackDate = (EventFeedbackType -> Maybe POSIX)
-> (EventFeedbackType -> Maybe POSIX -> EventFeedbackType)
-> Lens
     EventFeedbackType EventFeedbackType (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventFeedbackType' {Maybe POSIX
feedbackDate :: Maybe POSIX
$sel:feedbackDate:EventFeedbackType' :: EventFeedbackType -> Maybe POSIX
feedbackDate} -> Maybe POSIX
feedbackDate) (\s :: EventFeedbackType
s@EventFeedbackType' {} Maybe POSIX
a -> EventFeedbackType
s {$sel:feedbackDate:EventFeedbackType' :: Maybe POSIX
feedbackDate = Maybe POSIX
a} :: EventFeedbackType) ((Maybe POSIX -> f (Maybe POSIX))
 -> EventFeedbackType -> f EventFeedbackType)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EventFeedbackType
-> f EventFeedbackType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The event feedback value.
eventFeedbackType_feedbackValue :: Lens.Lens' EventFeedbackType FeedbackValueType
eventFeedbackType_feedbackValue :: (FeedbackValueType -> f FeedbackValueType)
-> EventFeedbackType -> f EventFeedbackType
eventFeedbackType_feedbackValue = (EventFeedbackType -> FeedbackValueType)
-> (EventFeedbackType -> FeedbackValueType -> EventFeedbackType)
-> Lens
     EventFeedbackType
     EventFeedbackType
     FeedbackValueType
     FeedbackValueType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventFeedbackType' {FeedbackValueType
feedbackValue :: FeedbackValueType
$sel:feedbackValue:EventFeedbackType' :: EventFeedbackType -> FeedbackValueType
feedbackValue} -> FeedbackValueType
feedbackValue) (\s :: EventFeedbackType
s@EventFeedbackType' {} FeedbackValueType
a -> EventFeedbackType
s {$sel:feedbackValue:EventFeedbackType' :: FeedbackValueType
feedbackValue = FeedbackValueType
a} :: EventFeedbackType)

-- | The provider.
eventFeedbackType_provider :: Lens.Lens' EventFeedbackType Prelude.Text
eventFeedbackType_provider :: (Text -> f Text) -> EventFeedbackType -> f EventFeedbackType
eventFeedbackType_provider = (EventFeedbackType -> Text)
-> (EventFeedbackType -> Text -> EventFeedbackType)
-> Lens EventFeedbackType EventFeedbackType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EventFeedbackType' {Text
provider :: Text
$sel:provider:EventFeedbackType' :: EventFeedbackType -> Text
provider} -> Text
provider) (\s :: EventFeedbackType
s@EventFeedbackType' {} Text
a -> EventFeedbackType
s {$sel:provider:EventFeedbackType' :: Text
provider = Text
a} :: EventFeedbackType)

instance Core.FromJSON EventFeedbackType where
  parseJSON :: Value -> Parser EventFeedbackType
parseJSON =
    String
-> (Object -> Parser EventFeedbackType)
-> Value
-> Parser EventFeedbackType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EventFeedbackType"
      ( \Object
x ->
          Maybe POSIX -> FeedbackValueType -> Text -> EventFeedbackType
EventFeedbackType'
            (Maybe POSIX -> FeedbackValueType -> Text -> EventFeedbackType)
-> Parser (Maybe POSIX)
-> Parser (FeedbackValueType -> Text -> EventFeedbackType)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FeedbackDate")
            Parser (FeedbackValueType -> Text -> EventFeedbackType)
-> Parser FeedbackValueType -> Parser (Text -> EventFeedbackType)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser FeedbackValueType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"FeedbackValue")
            Parser (Text -> EventFeedbackType)
-> Parser Text -> Parser EventFeedbackType
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Provider")
      )

instance Prelude.Hashable EventFeedbackType

instance Prelude.NFData EventFeedbackType