{-# 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.Nimble.Types.EulaAcceptance
-- 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.Nimble.Types.EulaAcceptance where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- |
--
-- /See:/ 'newEulaAcceptance' smart constructor.
data EulaAcceptance = EulaAcceptance'
  { -- | The ID of the acceptee.
    EulaAcceptance -> Maybe Text
accepteeId :: Prelude.Maybe Prelude.Text,
    -- | The EULA ID.
    EulaAcceptance -> Maybe Text
eulaId :: Prelude.Maybe Prelude.Text,
    -- | The Unix epoch timestamp in seconds for when the EULA was accepted.
    EulaAcceptance -> Maybe POSIX
acceptedAt :: Prelude.Maybe Core.POSIX,
    -- | The ID of the person who accepted the EULA.
    EulaAcceptance -> Maybe Text
acceptedBy :: Prelude.Maybe Prelude.Text,
    -- | The EULA acceptance ID.
    EulaAcceptance -> Maybe Text
eulaAcceptanceId :: Prelude.Maybe Prelude.Text
  }
  deriving (EulaAcceptance -> EulaAcceptance -> Bool
(EulaAcceptance -> EulaAcceptance -> Bool)
-> (EulaAcceptance -> EulaAcceptance -> Bool) -> Eq EulaAcceptance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EulaAcceptance -> EulaAcceptance -> Bool
$c/= :: EulaAcceptance -> EulaAcceptance -> Bool
== :: EulaAcceptance -> EulaAcceptance -> Bool
$c== :: EulaAcceptance -> EulaAcceptance -> Bool
Prelude.Eq, ReadPrec [EulaAcceptance]
ReadPrec EulaAcceptance
Int -> ReadS EulaAcceptance
ReadS [EulaAcceptance]
(Int -> ReadS EulaAcceptance)
-> ReadS [EulaAcceptance]
-> ReadPrec EulaAcceptance
-> ReadPrec [EulaAcceptance]
-> Read EulaAcceptance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EulaAcceptance]
$creadListPrec :: ReadPrec [EulaAcceptance]
readPrec :: ReadPrec EulaAcceptance
$creadPrec :: ReadPrec EulaAcceptance
readList :: ReadS [EulaAcceptance]
$creadList :: ReadS [EulaAcceptance]
readsPrec :: Int -> ReadS EulaAcceptance
$creadsPrec :: Int -> ReadS EulaAcceptance
Prelude.Read, Int -> EulaAcceptance -> ShowS
[EulaAcceptance] -> ShowS
EulaAcceptance -> String
(Int -> EulaAcceptance -> ShowS)
-> (EulaAcceptance -> String)
-> ([EulaAcceptance] -> ShowS)
-> Show EulaAcceptance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EulaAcceptance] -> ShowS
$cshowList :: [EulaAcceptance] -> ShowS
show :: EulaAcceptance -> String
$cshow :: EulaAcceptance -> String
showsPrec :: Int -> EulaAcceptance -> ShowS
$cshowsPrec :: Int -> EulaAcceptance -> ShowS
Prelude.Show, (forall x. EulaAcceptance -> Rep EulaAcceptance x)
-> (forall x. Rep EulaAcceptance x -> EulaAcceptance)
-> Generic EulaAcceptance
forall x. Rep EulaAcceptance x -> EulaAcceptance
forall x. EulaAcceptance -> Rep EulaAcceptance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EulaAcceptance x -> EulaAcceptance
$cfrom :: forall x. EulaAcceptance -> Rep EulaAcceptance x
Prelude.Generic)

-- |
-- Create a value of 'EulaAcceptance' 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:
--
-- 'accepteeId', 'eulaAcceptance_accepteeId' - The ID of the acceptee.
--
-- 'eulaId', 'eulaAcceptance_eulaId' - The EULA ID.
--
-- 'acceptedAt', 'eulaAcceptance_acceptedAt' - The Unix epoch timestamp in seconds for when the EULA was accepted.
--
-- 'acceptedBy', 'eulaAcceptance_acceptedBy' - The ID of the person who accepted the EULA.
--
-- 'eulaAcceptanceId', 'eulaAcceptance_eulaAcceptanceId' - The EULA acceptance ID.
newEulaAcceptance ::
  EulaAcceptance
newEulaAcceptance :: EulaAcceptance
newEulaAcceptance =
  EulaAcceptance' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> EulaAcceptance
EulaAcceptance'
    { $sel:accepteeId:EulaAcceptance' :: Maybe Text
accepteeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eulaId:EulaAcceptance' :: Maybe Text
eulaId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptedAt:EulaAcceptance' :: Maybe POSIX
acceptedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:acceptedBy:EulaAcceptance' :: Maybe Text
acceptedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eulaAcceptanceId:EulaAcceptance' :: Maybe Text
eulaAcceptanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the acceptee.
eulaAcceptance_accepteeId :: Lens.Lens' EulaAcceptance (Prelude.Maybe Prelude.Text)
eulaAcceptance_accepteeId :: (Maybe Text -> f (Maybe Text))
-> EulaAcceptance -> f EulaAcceptance
eulaAcceptance_accepteeId = (EulaAcceptance -> Maybe Text)
-> (EulaAcceptance -> Maybe Text -> EulaAcceptance)
-> Lens EulaAcceptance EulaAcceptance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EulaAcceptance' {Maybe Text
accepteeId :: Maybe Text
$sel:accepteeId:EulaAcceptance' :: EulaAcceptance -> Maybe Text
accepteeId} -> Maybe Text
accepteeId) (\s :: EulaAcceptance
s@EulaAcceptance' {} Maybe Text
a -> EulaAcceptance
s {$sel:accepteeId:EulaAcceptance' :: Maybe Text
accepteeId = Maybe Text
a} :: EulaAcceptance)

-- | The EULA ID.
eulaAcceptance_eulaId :: Lens.Lens' EulaAcceptance (Prelude.Maybe Prelude.Text)
eulaAcceptance_eulaId :: (Maybe Text -> f (Maybe Text))
-> EulaAcceptance -> f EulaAcceptance
eulaAcceptance_eulaId = (EulaAcceptance -> Maybe Text)
-> (EulaAcceptance -> Maybe Text -> EulaAcceptance)
-> Lens EulaAcceptance EulaAcceptance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EulaAcceptance' {Maybe Text
eulaId :: Maybe Text
$sel:eulaId:EulaAcceptance' :: EulaAcceptance -> Maybe Text
eulaId} -> Maybe Text
eulaId) (\s :: EulaAcceptance
s@EulaAcceptance' {} Maybe Text
a -> EulaAcceptance
s {$sel:eulaId:EulaAcceptance' :: Maybe Text
eulaId = Maybe Text
a} :: EulaAcceptance)

-- | The Unix epoch timestamp in seconds for when the EULA was accepted.
eulaAcceptance_acceptedAt :: Lens.Lens' EulaAcceptance (Prelude.Maybe Prelude.UTCTime)
eulaAcceptance_acceptedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EulaAcceptance -> f EulaAcceptance
eulaAcceptance_acceptedAt = (EulaAcceptance -> Maybe POSIX)
-> (EulaAcceptance -> Maybe POSIX -> EulaAcceptance)
-> Lens EulaAcceptance EulaAcceptance (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EulaAcceptance' {Maybe POSIX
acceptedAt :: Maybe POSIX
$sel:acceptedAt:EulaAcceptance' :: EulaAcceptance -> Maybe POSIX
acceptedAt} -> Maybe POSIX
acceptedAt) (\s :: EulaAcceptance
s@EulaAcceptance' {} Maybe POSIX
a -> EulaAcceptance
s {$sel:acceptedAt:EulaAcceptance' :: Maybe POSIX
acceptedAt = Maybe POSIX
a} :: EulaAcceptance) ((Maybe POSIX -> f (Maybe POSIX))
 -> EulaAcceptance -> f EulaAcceptance)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EulaAcceptance
-> f EulaAcceptance
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 ID of the person who accepted the EULA.
eulaAcceptance_acceptedBy :: Lens.Lens' EulaAcceptance (Prelude.Maybe Prelude.Text)
eulaAcceptance_acceptedBy :: (Maybe Text -> f (Maybe Text))
-> EulaAcceptance -> f EulaAcceptance
eulaAcceptance_acceptedBy = (EulaAcceptance -> Maybe Text)
-> (EulaAcceptance -> Maybe Text -> EulaAcceptance)
-> Lens EulaAcceptance EulaAcceptance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EulaAcceptance' {Maybe Text
acceptedBy :: Maybe Text
$sel:acceptedBy:EulaAcceptance' :: EulaAcceptance -> Maybe Text
acceptedBy} -> Maybe Text
acceptedBy) (\s :: EulaAcceptance
s@EulaAcceptance' {} Maybe Text
a -> EulaAcceptance
s {$sel:acceptedBy:EulaAcceptance' :: Maybe Text
acceptedBy = Maybe Text
a} :: EulaAcceptance)

-- | The EULA acceptance ID.
eulaAcceptance_eulaAcceptanceId :: Lens.Lens' EulaAcceptance (Prelude.Maybe Prelude.Text)
eulaAcceptance_eulaAcceptanceId :: (Maybe Text -> f (Maybe Text))
-> EulaAcceptance -> f EulaAcceptance
eulaAcceptance_eulaAcceptanceId = (EulaAcceptance -> Maybe Text)
-> (EulaAcceptance -> Maybe Text -> EulaAcceptance)
-> Lens EulaAcceptance EulaAcceptance (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EulaAcceptance' {Maybe Text
eulaAcceptanceId :: Maybe Text
$sel:eulaAcceptanceId:EulaAcceptance' :: EulaAcceptance -> Maybe Text
eulaAcceptanceId} -> Maybe Text
eulaAcceptanceId) (\s :: EulaAcceptance
s@EulaAcceptance' {} Maybe Text
a -> EulaAcceptance
s {$sel:eulaAcceptanceId:EulaAcceptance' :: Maybe Text
eulaAcceptanceId = Maybe Text
a} :: EulaAcceptance)

instance Core.FromJSON EulaAcceptance where
  parseJSON :: Value -> Parser EulaAcceptance
parseJSON =
    String
-> (Object -> Parser EulaAcceptance)
-> Value
-> Parser EulaAcceptance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EulaAcceptance"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> EulaAcceptance
EulaAcceptance'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> EulaAcceptance)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX -> Maybe Text -> Maybe Text -> EulaAcceptance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"accepteeId")
            Parser
  (Maybe Text
   -> Maybe POSIX -> Maybe Text -> Maybe Text -> EulaAcceptance)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX -> Maybe Text -> Maybe Text -> EulaAcceptance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eulaId")
            Parser (Maybe POSIX -> Maybe Text -> Maybe Text -> EulaAcceptance)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> EulaAcceptance)
forall (f :: * -> *) a b. Applicative f => 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
"acceptedAt")
            Parser (Maybe Text -> Maybe Text -> EulaAcceptance)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EulaAcceptance)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"acceptedBy")
            Parser (Maybe Text -> EulaAcceptance)
-> Parser (Maybe Text) -> Parser EulaAcceptance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"eulaAcceptanceId")
      )

instance Prelude.Hashable EulaAcceptance

instance Prelude.NFData EulaAcceptance