{-# 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.LicenseManager.Types.ReportContext
-- 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.LicenseManager.Types.ReportContext 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

-- | Details of the license configuration that this generator reports on.
--
-- /See:/ 'newReportContext' smart constructor.
data ReportContext = ReportContext'
  { -- | Amazon Resource Name (ARN) of the license configuration that this
    -- generator reports on.
    ReportContext -> [Text]
licenseConfigurationArns :: [Prelude.Text]
  }
  deriving (ReportContext -> ReportContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportContext -> ReportContext -> Bool
$c/= :: ReportContext -> ReportContext -> Bool
== :: ReportContext -> ReportContext -> Bool
$c== :: ReportContext -> ReportContext -> Bool
Prelude.Eq, ReadPrec [ReportContext]
ReadPrec ReportContext
Int -> ReadS ReportContext
ReadS [ReportContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportContext]
$creadListPrec :: ReadPrec [ReportContext]
readPrec :: ReadPrec ReportContext
$creadPrec :: ReadPrec ReportContext
readList :: ReadS [ReportContext]
$creadList :: ReadS [ReportContext]
readsPrec :: Int -> ReadS ReportContext
$creadsPrec :: Int -> ReadS ReportContext
Prelude.Read, Int -> ReportContext -> ShowS
[ReportContext] -> ShowS
ReportContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportContext] -> ShowS
$cshowList :: [ReportContext] -> ShowS
show :: ReportContext -> String
$cshow :: ReportContext -> String
showsPrec :: Int -> ReportContext -> ShowS
$cshowsPrec :: Int -> ReportContext -> ShowS
Prelude.Show, forall x. Rep ReportContext x -> ReportContext
forall x. ReportContext -> Rep ReportContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportContext x -> ReportContext
$cfrom :: forall x. ReportContext -> Rep ReportContext x
Prelude.Generic)

-- |
-- Create a value of 'ReportContext' 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:
--
-- 'licenseConfigurationArns', 'reportContext_licenseConfigurationArns' - Amazon Resource Name (ARN) of the license configuration that this
-- generator reports on.
newReportContext ::
  ReportContext
newReportContext :: ReportContext
newReportContext =
  ReportContext'
    { $sel:licenseConfigurationArns:ReportContext' :: [Text]
licenseConfigurationArns =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | Amazon Resource Name (ARN) of the license configuration that this
-- generator reports on.
reportContext_licenseConfigurationArns :: Lens.Lens' ReportContext [Prelude.Text]
reportContext_licenseConfigurationArns :: Lens' ReportContext [Text]
reportContext_licenseConfigurationArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportContext' {[Text]
licenseConfigurationArns :: [Text]
$sel:licenseConfigurationArns:ReportContext' :: ReportContext -> [Text]
licenseConfigurationArns} -> [Text]
licenseConfigurationArns) (\s :: ReportContext
s@ReportContext' {} [Text]
a -> ReportContext
s {$sel:licenseConfigurationArns:ReportContext' :: [Text]
licenseConfigurationArns = [Text]
a} :: ReportContext) 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 ReportContext where
  parseJSON :: Value -> Parser ReportContext
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ReportContext"
      ( \Object
x ->
          [Text] -> ReportContext
ReportContext'
            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
"licenseConfigurationArns"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ReportContext where
  hashWithSalt :: Int -> ReportContext -> Int
hashWithSalt Int
_salt ReportContext' {[Text]
licenseConfigurationArns :: [Text]
$sel:licenseConfigurationArns:ReportContext' :: ReportContext -> [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
licenseConfigurationArns

instance Prelude.NFData ReportContext where
  rnf :: ReportContext -> ()
rnf ReportContext' {[Text]
licenseConfigurationArns :: [Text]
$sel:licenseConfigurationArns:ReportContext' :: ReportContext -> [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Text]
licenseConfigurationArns

instance Data.ToJSON ReportContext where
  toJSON :: ReportContext -> Value
toJSON ReportContext' {[Text]
licenseConfigurationArns :: [Text]
$sel:licenseConfigurationArns:ReportContext' :: ReportContext -> [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              ( Key
"licenseConfigurationArns"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
licenseConfigurationArns
              )
          ]
      )