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

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

-- | Summary information about a TagOption.
--
-- /See:/ 'newTagOptionSummary' smart constructor.
data TagOptionSummary = TagOptionSummary'
  { -- | The TagOption value.
    TagOptionSummary -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text],
    -- | The TagOption key.
    TagOptionSummary -> Maybe Text
key :: Prelude.Maybe Prelude.Text
  }
  deriving (TagOptionSummary -> TagOptionSummary -> Bool
(TagOptionSummary -> TagOptionSummary -> Bool)
-> (TagOptionSummary -> TagOptionSummary -> Bool)
-> Eq TagOptionSummary
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]
(Int -> ReadS TagOptionSummary)
-> ReadS [TagOptionSummary]
-> ReadPrec TagOptionSummary
-> ReadPrec [TagOptionSummary]
-> Read 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
(Int -> TagOptionSummary -> ShowS)
-> (TagOptionSummary -> String)
-> ([TagOptionSummary] -> ShowS)
-> Show TagOptionSummary
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. TagOptionSummary -> Rep TagOptionSummary x)
-> (forall x. Rep TagOptionSummary x -> TagOptionSummary)
-> Generic TagOptionSummary
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:
--
-- 'values', 'tagOptionSummary_values' - The TagOption value.
--
-- 'key', 'tagOptionSummary_key' - The TagOption key.
newTagOptionSummary ::
  TagOptionSummary
newTagOptionSummary :: TagOptionSummary
newTagOptionSummary =
  TagOptionSummary' :: Maybe [Text] -> Maybe Text -> TagOptionSummary
TagOptionSummary'
    { $sel:values:TagOptionSummary' :: Maybe [Text]
values = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:key:TagOptionSummary' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The TagOption value.
tagOptionSummary_values :: Lens.Lens' TagOptionSummary (Prelude.Maybe [Prelude.Text])
tagOptionSummary_values :: (Maybe [Text] -> f (Maybe [Text]))
-> TagOptionSummary -> f TagOptionSummary
tagOptionSummary_values = (TagOptionSummary -> Maybe [Text])
-> (TagOptionSummary -> Maybe [Text] -> TagOptionSummary)
-> Lens
     TagOptionSummary TagOptionSummary (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> TagOptionSummary -> f TagOptionSummary)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> TagOptionSummary
-> f TagOptionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The TagOption key.
tagOptionSummary_key :: Lens.Lens' TagOptionSummary (Prelude.Maybe Prelude.Text)
tagOptionSummary_key :: (Maybe Text -> f (Maybe Text))
-> TagOptionSummary -> f TagOptionSummary
tagOptionSummary_key = (TagOptionSummary -> Maybe Text)
-> (TagOptionSummary -> Maybe Text -> TagOptionSummary)
-> Lens TagOptionSummary TagOptionSummary (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable TagOptionSummary

instance Prelude.NFData TagOptionSummary