{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Nimble.Types.Eula where

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

-- | Represents a EULA resource.
--
-- /See:/ 'newEula' smart constructor.
data Eula = Eula'
  { -- | The EULA content.
    Eula -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The ISO timestamp in seconds for when the resource was created.
    Eula -> Maybe ISO8601
createdAt :: Prelude.Maybe Data.ISO8601,
    -- | The EULA ID.
    Eula -> Maybe Text
eulaId :: Prelude.Maybe Prelude.Text,
    -- | The name for the EULA.
    Eula -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ISO timestamp in seconds for when the resource was updated.
    Eula -> Maybe ISO8601
updatedAt :: Prelude.Maybe Data.ISO8601
  }
  deriving (Eula -> Eula -> Bool
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]
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
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. 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:
--
-- 'content', 'eula_content' - The EULA content.
--
-- 'createdAt', 'eula_createdAt' - The ISO timestamp in seconds for when the resource was created.
--
-- 'eulaId', 'eula_eulaId' - The EULA ID.
--
-- 'name', 'eula_name' - The name for the EULA.
--
-- 'updatedAt', 'eula_updatedAt' - The ISO timestamp in seconds for when the resource was updated.
newEula ::
  Eula
newEula :: Eula
newEula =
  Eula'
    { $sel:content:Eula' :: Maybe Text
content = forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Eula' :: Maybe ISO8601
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:eulaId:Eula' :: Maybe Text
eulaId = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Eula' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:updatedAt:Eula' :: Maybe ISO8601
updatedAt = forall a. Maybe a
Prelude.Nothing
    }

-- | The EULA content.
eula_content :: Lens.Lens' Eula (Prelude.Maybe Prelude.Text)
eula_content :: Lens' Eula (Maybe Text)
eula_content = 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 ISO timestamp in seconds for when the resource was created.
eula_createdAt :: Lens.Lens' Eula (Prelude.Maybe Prelude.UTCTime)
eula_createdAt :: Lens' Eula (Maybe UTCTime)
eula_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eula' {Maybe ISO8601
createdAt :: Maybe ISO8601
$sel:createdAt:Eula' :: Eula -> Maybe ISO8601
createdAt} -> Maybe ISO8601
createdAt) (\s :: Eula
s@Eula' {} Maybe ISO8601
a -> Eula
s {$sel:createdAt:Eula' :: Maybe ISO8601
createdAt = Maybe ISO8601
a} :: Eula) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The EULA ID.
eula_eulaId :: Lens.Lens' Eula (Prelude.Maybe Prelude.Text)
eula_eulaId :: Lens' Eula (Maybe Text)
eula_eulaId = 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 name for the EULA.
eula_name :: Lens.Lens' Eula (Prelude.Maybe Prelude.Text)
eula_name :: Lens' Eula (Maybe Text)
eula_name = 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 ISO timestamp in seconds for when the resource was updated.
eula_updatedAt :: Lens.Lens' Eula (Prelude.Maybe Prelude.UTCTime)
eula_updatedAt :: Lens' Eula (Maybe UTCTime)
eula_updatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Eula' {Maybe ISO8601
updatedAt :: Maybe ISO8601
$sel:updatedAt:Eula' :: Eula -> Maybe ISO8601
updatedAt} -> Maybe ISO8601
updatedAt) (\s :: Eula
s@Eula' {} Maybe ISO8601
a -> Eula
s {$sel:updatedAt:Eula' :: Maybe ISO8601
updatedAt = Maybe ISO8601
a} :: Eula) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON Eula where
  parseJSON :: Value -> Parser Eula
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Eula"
      ( \Object
x ->
          Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Eula
Eula'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"content")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"createdAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"eulaId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"updatedAt")
      )

instance Prelude.Hashable Eula where
  hashWithSalt :: Int -> Eula -> Int
hashWithSalt Int
_salt Eula' {Maybe Text
Maybe ISO8601
updatedAt :: Maybe ISO8601
name :: Maybe Text
eulaId :: Maybe Text
createdAt :: Maybe ISO8601
content :: Maybe Text
$sel:updatedAt:Eula' :: Eula -> Maybe ISO8601
$sel:name:Eula' :: Eula -> Maybe Text
$sel:eulaId:Eula' :: Eula -> Maybe Text
$sel:createdAt:Eula' :: Eula -> Maybe ISO8601
$sel:content:Eula' :: Eula -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
content
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
eulaId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
updatedAt

instance Prelude.NFData Eula where
  rnf :: Eula -> ()
rnf Eula' {Maybe Text
Maybe ISO8601
updatedAt :: Maybe ISO8601
name :: Maybe Text
eulaId :: Maybe Text
createdAt :: Maybe ISO8601
content :: Maybe Text
$sel:updatedAt:Eula' :: Eula -> Maybe ISO8601
$sel:name:Eula' :: Eula -> Maybe Text
$sel:eulaId:Eula' :: Eula -> Maybe Text
$sel:createdAt:Eula' :: Eula -> Maybe ISO8601
$sel:content:Eula' :: Eula -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
eulaId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
updatedAt