{-# 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.Inspector2.Types.FreeTrialAccountInfo
-- 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.Inspector2.Types.FreeTrialAccountInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.FreeTrialInfo
import qualified Amazonka.Prelude as Prelude

-- | Information about the Amazon Inspector free trial for an account.
--
-- /See:/ 'newFreeTrialAccountInfo' smart constructor.
data FreeTrialAccountInfo = FreeTrialAccountInfo'
  { -- | The account associated with the Amazon Inspector free trial information.
    FreeTrialAccountInfo -> Text
accountId :: Prelude.Text,
    -- | Contains information about the Amazon Inspector free trial for an
    -- account.
    FreeTrialAccountInfo -> [FreeTrialInfo]
freeTrialInfo :: [FreeTrialInfo]
  }
  deriving (FreeTrialAccountInfo -> FreeTrialAccountInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FreeTrialAccountInfo -> FreeTrialAccountInfo -> Bool
$c/= :: FreeTrialAccountInfo -> FreeTrialAccountInfo -> Bool
== :: FreeTrialAccountInfo -> FreeTrialAccountInfo -> Bool
$c== :: FreeTrialAccountInfo -> FreeTrialAccountInfo -> Bool
Prelude.Eq, ReadPrec [FreeTrialAccountInfo]
ReadPrec FreeTrialAccountInfo
Int -> ReadS FreeTrialAccountInfo
ReadS [FreeTrialAccountInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FreeTrialAccountInfo]
$creadListPrec :: ReadPrec [FreeTrialAccountInfo]
readPrec :: ReadPrec FreeTrialAccountInfo
$creadPrec :: ReadPrec FreeTrialAccountInfo
readList :: ReadS [FreeTrialAccountInfo]
$creadList :: ReadS [FreeTrialAccountInfo]
readsPrec :: Int -> ReadS FreeTrialAccountInfo
$creadsPrec :: Int -> ReadS FreeTrialAccountInfo
Prelude.Read, Int -> FreeTrialAccountInfo -> ShowS
[FreeTrialAccountInfo] -> ShowS
FreeTrialAccountInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FreeTrialAccountInfo] -> ShowS
$cshowList :: [FreeTrialAccountInfo] -> ShowS
show :: FreeTrialAccountInfo -> String
$cshow :: FreeTrialAccountInfo -> String
showsPrec :: Int -> FreeTrialAccountInfo -> ShowS
$cshowsPrec :: Int -> FreeTrialAccountInfo -> ShowS
Prelude.Show, forall x. Rep FreeTrialAccountInfo x -> FreeTrialAccountInfo
forall x. FreeTrialAccountInfo -> Rep FreeTrialAccountInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FreeTrialAccountInfo x -> FreeTrialAccountInfo
$cfrom :: forall x. FreeTrialAccountInfo -> Rep FreeTrialAccountInfo x
Prelude.Generic)

-- |
-- Create a value of 'FreeTrialAccountInfo' 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:
--
-- 'accountId', 'freeTrialAccountInfo_accountId' - The account associated with the Amazon Inspector free trial information.
--
-- 'freeTrialInfo', 'freeTrialAccountInfo_freeTrialInfo' - Contains information about the Amazon Inspector free trial for an
-- account.
newFreeTrialAccountInfo ::
  -- | 'accountId'
  Prelude.Text ->
  FreeTrialAccountInfo
newFreeTrialAccountInfo :: Text -> FreeTrialAccountInfo
newFreeTrialAccountInfo Text
pAccountId_ =
  FreeTrialAccountInfo'
    { $sel:accountId:FreeTrialAccountInfo' :: Text
accountId = Text
pAccountId_,
      $sel:freeTrialInfo:FreeTrialAccountInfo' :: [FreeTrialInfo]
freeTrialInfo = forall a. Monoid a => a
Prelude.mempty
    }

-- | The account associated with the Amazon Inspector free trial information.
freeTrialAccountInfo_accountId :: Lens.Lens' FreeTrialAccountInfo Prelude.Text
freeTrialAccountInfo_accountId :: Lens' FreeTrialAccountInfo Text
freeTrialAccountInfo_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeTrialAccountInfo' {Text
accountId :: Text
$sel:accountId:FreeTrialAccountInfo' :: FreeTrialAccountInfo -> Text
accountId} -> Text
accountId) (\s :: FreeTrialAccountInfo
s@FreeTrialAccountInfo' {} Text
a -> FreeTrialAccountInfo
s {$sel:accountId:FreeTrialAccountInfo' :: Text
accountId = Text
a} :: FreeTrialAccountInfo)

-- | Contains information about the Amazon Inspector free trial for an
-- account.
freeTrialAccountInfo_freeTrialInfo :: Lens.Lens' FreeTrialAccountInfo [FreeTrialInfo]
freeTrialAccountInfo_freeTrialInfo :: Lens' FreeTrialAccountInfo [FreeTrialInfo]
freeTrialAccountInfo_freeTrialInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeTrialAccountInfo' {[FreeTrialInfo]
freeTrialInfo :: [FreeTrialInfo]
$sel:freeTrialInfo:FreeTrialAccountInfo' :: FreeTrialAccountInfo -> [FreeTrialInfo]
freeTrialInfo} -> [FreeTrialInfo]
freeTrialInfo) (\s :: FreeTrialAccountInfo
s@FreeTrialAccountInfo' {} [FreeTrialInfo]
a -> FreeTrialAccountInfo
s {$sel:freeTrialInfo:FreeTrialAccountInfo' :: [FreeTrialInfo]
freeTrialInfo = [FreeTrialInfo]
a} :: FreeTrialAccountInfo) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON FreeTrialAccountInfo where
  parseJSON :: Value -> Parser FreeTrialAccountInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FreeTrialAccountInfo"
      ( \Object
x ->
          Text -> [FreeTrialInfo] -> FreeTrialAccountInfo
FreeTrialAccountInfo'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"accountId")
            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
"freeTrialInfo" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable FreeTrialAccountInfo where
  hashWithSalt :: Int -> FreeTrialAccountInfo -> Int
hashWithSalt Int
_salt FreeTrialAccountInfo' {[FreeTrialInfo]
Text
freeTrialInfo :: [FreeTrialInfo]
accountId :: Text
$sel:freeTrialInfo:FreeTrialAccountInfo' :: FreeTrialAccountInfo -> [FreeTrialInfo]
$sel:accountId:FreeTrialAccountInfo' :: FreeTrialAccountInfo -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [FreeTrialInfo]
freeTrialInfo

instance Prelude.NFData FreeTrialAccountInfo where
  rnf :: FreeTrialAccountInfo -> ()
rnf FreeTrialAccountInfo' {[FreeTrialInfo]
Text
freeTrialInfo :: [FreeTrialInfo]
accountId :: Text
$sel:freeTrialInfo:FreeTrialAccountInfo' :: FreeTrialAccountInfo -> [FreeTrialInfo]
$sel:accountId:FreeTrialAccountInfo' :: FreeTrialAccountInfo -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [FreeTrialInfo]
freeTrialInfo