{-# 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.ServiceCatalog.Types.TagOptionSummary
-- 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.ServiceCatalog.Types.TagOptionSummary 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

-- | Summary information about a TagOption.
--
-- /See:/ 'newTagOptionSummary' smart constructor.
data TagOptionSummary = TagOptionSummary'
  { -- | The TagOption key.
    TagOptionSummary -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The TagOption value.
    TagOptionSummary -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text]
  }
  deriving (TagOptionSummary -> TagOptionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TagOptionSummary -> TagOptionSummary -> Bool
$c/= :: TagOptionSummary -> TagOptionSummary -> Bool
== :: TagOptionSummary -> TagOptionSummary -> Bool
$c== :: TagOptionSummary -> TagOptionSummary -> Bool
Prelude.Eq, ReadPrec [TagOptionSummary]
ReadPrec TagOptionSummary
Int -> ReadS TagOptionSummary
ReadS [TagOptionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TagOptionSummary]
$creadListPrec :: ReadPrec [TagOptionSummary]
readPrec :: ReadPrec TagOptionSummary
$creadPrec :: ReadPrec TagOptionSummary
readList :: ReadS [TagOptionSummary]
$creadList :: ReadS [TagOptionSummary]
readsPrec :: Int -> ReadS TagOptionSummary
$creadsPrec :: Int -> ReadS TagOptionSummary
Prelude.Read, Int -> TagOptionSummary -> ShowS
[TagOptionSummary] -> ShowS
TagOptionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TagOptionSummary] -> ShowS
$cshowList :: [TagOptionSummary] -> ShowS
show :: TagOptionSummary -> String
$cshow :: TagOptionSummary -> String
showsPrec :: Int -> TagOptionSummary -> ShowS
$cshowsPrec :: Int -> TagOptionSummary -> ShowS
Prelude.Show, forall x. Rep TagOptionSummary x -> TagOptionSummary
forall x. TagOptionSummary -> Rep TagOptionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TagOptionSummary x -> TagOptionSummary
$cfrom :: forall x. TagOptionSummary -> Rep TagOptionSummary x
Prelude.Generic)

-- |
-- Create a value of 'TagOptionSummary' 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:
--
-- 'key', 'tagOptionSummary_key' - The TagOption key.
--
-- 'values', 'tagOptionSummary_values' - The TagOption value.
newTagOptionSummary ::
  TagOptionSummary
newTagOptionSummary :: TagOptionSummary
newTagOptionSummary =
  TagOptionSummary'
    { $sel:key:TagOptionSummary' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:values:TagOptionSummary' :: Maybe [Text]
values = forall a. Maybe a
Prelude.Nothing
    }

-- | The TagOption key.
tagOptionSummary_key :: Lens.Lens' TagOptionSummary (Prelude.Maybe Prelude.Text)
tagOptionSummary_key :: Lens' TagOptionSummary (Maybe Text)
tagOptionSummary_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagOptionSummary' {Maybe Text
key :: Maybe Text
$sel:key:TagOptionSummary' :: TagOptionSummary -> Maybe Text
key} -> Maybe Text
key) (\s :: TagOptionSummary
s@TagOptionSummary' {} Maybe Text
a -> TagOptionSummary
s {$sel:key:TagOptionSummary' :: Maybe Text
key = Maybe Text
a} :: TagOptionSummary)

-- | The TagOption value.
tagOptionSummary_values :: Lens.Lens' TagOptionSummary (Prelude.Maybe [Prelude.Text])
tagOptionSummary_values :: Lens' TagOptionSummary (Maybe [Text])
tagOptionSummary_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TagOptionSummary' {Maybe [Text]
values :: Maybe [Text]
$sel:values:TagOptionSummary' :: TagOptionSummary -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: TagOptionSummary
s@TagOptionSummary' {} Maybe [Text]
a -> TagOptionSummary
s {$sel:values:TagOptionSummary' :: Maybe [Text]
values = Maybe [Text]
a} :: TagOptionSummary) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON TagOptionSummary where
  parseJSON :: Value -> Parser TagOptionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TagOptionSummary"
      ( \Object
x ->
          Maybe Text -> Maybe [Text] -> TagOptionSummary
TagOptionSummary'
            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
"Key")
            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
"Values" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable TagOptionSummary where
  hashWithSalt :: Int -> TagOptionSummary -> Int
hashWithSalt Int
_salt TagOptionSummary' {Maybe [Text]
Maybe Text
values :: Maybe [Text]
key :: Maybe Text
$sel:values:TagOptionSummary' :: TagOptionSummary -> Maybe [Text]
$sel:key:TagOptionSummary' :: TagOptionSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
values

instance Prelude.NFData TagOptionSummary where
  rnf :: TagOptionSummary -> ()
rnf TagOptionSummary' {Maybe [Text]
Maybe Text
values :: Maybe [Text]
key :: Maybe Text
$sel:values:TagOptionSummary' :: TagOptionSummary -> Maybe [Text]
$sel:key:TagOptionSummary' :: TagOptionSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
values