{-# 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.Eula
-- 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.Eula where

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

-- | Represents a EULA resource.
--
-- /See:/ 'newEula' smart constructor.
data Eula = Eula'
  { -- | The Unix epoch timestamp in seconds for when the resource was created.
    Eula -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The EULA ID.
    Eula -> Maybe Text
eulaId :: Prelude.Maybe Prelude.Text,
    -- | The EULA content.
    Eula -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The name for the EULA.
    Eula -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Unix epoch timestamp in seconds for when the resource was updated.
    Eula -> Maybe POSIX
updatedAt :: Prelude.Maybe Core.POSIX
  }
  deriving (Eula -> Eula -> Bool
(Eula -> Eula -> Bool) -> (Eula -> Eula -> Bool) -> Eq Eula
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Eula -> Eula -> Bool
$c/= :: Eula -> Eula -> Bool
== :: Eula -> Eula -> Bool
$c== :: Eula -> Eula -> Bool
Prelude.Eq, ReadPrec [Eula]
ReadPrec Eula
Int -> ReadS Eula
ReadS [Eula]
(Int -> ReadS Eula)
-> ReadS [Eula] -> ReadPrec Eula -> ReadPrec [Eula] -> Read Eula
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Eula]
$creadListPrec :: ReadPrec [Eula]
readPrec :: ReadPrec Eula
$creadPrec :: ReadPrec Eula
readList :: ReadS [Eula]
$creadList :: ReadS [Eula]
readsPrec :: Int -> ReadS Eula
$creadsPrec :: Int -> ReadS Eula
Prelude.Read, Int -> Eula -> ShowS
[Eula] -> ShowS
Eula -> String
(Int -> Eula -> ShowS)
-> (Eula -> String) -> ([Eula] -> ShowS) -> Show Eula
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Eula] -> ShowS
$cshowList :: [Eula] -> ShowS
show :: Eula -> String
$cshow :: Eula -> String
showsPrec :: Int -> Eula -> ShowS
$cshowsPrec :: Int -> Eula -> ShowS
Prelude.Show, (forall x. Eula -> Rep Eula x)
-> (forall x. Rep Eula x -> Eula) -> Generic Eula
forall x. Rep Eula x -> Eula
forall x. Eula -> Rep Eula x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Eula x -> Eula
$cfrom :: forall x. Eula -> Rep Eula x
Prelude.Generic)

-- |
-- Create a value of 'Eula' 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:
--
-- 'createdAt', 'eula_createdAt' - The Unix epoch timestamp in seconds for when the resource was created.
--
-- 'eulaId', 'eula_eulaId' - The EULA ID.
--
-- 'content', 'eula_content' - The EULA content.
--
-- 'name', 'eula_name' - The name for the EULA.
--
-- 'updatedAt', 'eula_updatedAt' - The Unix epoch timestamp in seconds for when the resource was updated.
newEula ::
  Eula
newEula :: Eula
newEula =
  Eula' :: Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Eula
Eula'
    { $sel:createdAt:Eula' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:eulaId:Eula' :: Maybe Text
eulaId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:content:Eula' :: Maybe Text
content = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Eula' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:Eula' :: Maybe POSIX
updatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The Unix epoch timestamp in seconds for when the resource was created.
eula_createdAt :: Lens.Lens' Eula (Prelude.Maybe Prelude.UTCTime)
eula_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Eula -> f Eula
eula_createdAt = (Eula -> Maybe POSIX)
-> (Eula -> Maybe POSIX -> Eula)
-> Lens Eula Eula (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eula' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Eula' :: Eula -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Eula
s@Eula' {} Maybe POSIX
a -> Eula
s {$sel:createdAt:Eula' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Eula) ((Maybe POSIX -> f (Maybe POSIX)) -> Eula -> f Eula)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Eula
-> f Eula
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 EULA ID.
eula_eulaId :: Lens.Lens' Eula (Prelude.Maybe Prelude.Text)
eula_eulaId :: (Maybe Text -> f (Maybe Text)) -> Eula -> f Eula
eula_eulaId = (Eula -> Maybe Text)
-> (Eula -> Maybe Text -> Eula)
-> Lens Eula Eula (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eula' {Maybe Text
eulaId :: Maybe Text
$sel:eulaId:Eula' :: Eula -> Maybe Text
eulaId} -> Maybe Text
eulaId) (\s :: Eula
s@Eula' {} Maybe Text
a -> Eula
s {$sel:eulaId:Eula' :: Maybe Text
eulaId = Maybe Text
a} :: Eula)

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

-- | The name for the EULA.
eula_name :: Lens.Lens' Eula (Prelude.Maybe Prelude.Text)
eula_name :: (Maybe Text -> f (Maybe Text)) -> Eula -> f Eula
eula_name = (Eula -> Maybe Text)
-> (Eula -> Maybe Text -> Eula)
-> Lens Eula Eula (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eula' {Maybe Text
name :: Maybe Text
$sel:name:Eula' :: Eula -> Maybe Text
name} -> Maybe Text
name) (\s :: Eula
s@Eula' {} Maybe Text
a -> Eula
s {$sel:name:Eula' :: Maybe Text
name = Maybe Text
a} :: Eula)

-- | The Unix epoch timestamp in seconds for when the resource was updated.
eula_updatedAt :: Lens.Lens' Eula (Prelude.Maybe Prelude.UTCTime)
eula_updatedAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Eula -> f Eula
eula_updatedAt = (Eula -> Maybe POSIX)
-> (Eula -> Maybe POSIX -> Eula)
-> Lens Eula Eula (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eula' {Maybe POSIX
updatedAt :: Maybe POSIX
$sel:updatedAt:Eula' :: Eula -> Maybe POSIX
updatedAt} -> Maybe POSIX
updatedAt) (\s :: Eula
s@Eula' {} Maybe POSIX
a -> Eula
s {$sel:updatedAt:Eula' :: Maybe POSIX
updatedAt = Maybe POSIX
a} :: Eula) ((Maybe POSIX -> f (Maybe POSIX)) -> Eula -> f Eula)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Eula
-> f Eula
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

instance Core.FromJSON Eula where
  parseJSON :: Value -> Parser Eula
parseJSON =
    String -> (Object -> Parser Eula) -> Value -> Parser Eula
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Eula"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Eula
Eula'
            (Maybe POSIX
 -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Eula)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Eula)
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
"createdAt")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> Maybe POSIX -> Eula)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> Eula)
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 Text -> Maybe Text -> Maybe POSIX -> Eula)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> Eula)
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
"content")
            Parser (Maybe Text -> Maybe POSIX -> Eula)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> Eula)
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
"name")
            Parser (Maybe POSIX -> Eula) -> Parser (Maybe POSIX) -> Parser Eula
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
"updatedAt")
      )

instance Prelude.Hashable Eula

instance Prelude.NFData Eula