{-# 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.Config.Types.FieldInfo
-- 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.Config.Types.FieldInfo where

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

-- | Details about the fields such as name of the field.
--
-- /See:/ 'newFieldInfo' smart constructor.
data FieldInfo = FieldInfo'
  { -- | Name of the field.
    FieldInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (FieldInfo -> FieldInfo -> Bool
(FieldInfo -> FieldInfo -> Bool)
-> (FieldInfo -> FieldInfo -> Bool) -> Eq FieldInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldInfo -> FieldInfo -> Bool
$c/= :: FieldInfo -> FieldInfo -> Bool
== :: FieldInfo -> FieldInfo -> Bool
$c== :: FieldInfo -> FieldInfo -> Bool
Prelude.Eq, ReadPrec [FieldInfo]
ReadPrec FieldInfo
Int -> ReadS FieldInfo
ReadS [FieldInfo]
(Int -> ReadS FieldInfo)
-> ReadS [FieldInfo]
-> ReadPrec FieldInfo
-> ReadPrec [FieldInfo]
-> Read FieldInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldInfo]
$creadListPrec :: ReadPrec [FieldInfo]
readPrec :: ReadPrec FieldInfo
$creadPrec :: ReadPrec FieldInfo
readList :: ReadS [FieldInfo]
$creadList :: ReadS [FieldInfo]
readsPrec :: Int -> ReadS FieldInfo
$creadsPrec :: Int -> ReadS FieldInfo
Prelude.Read, Int -> FieldInfo -> ShowS
[FieldInfo] -> ShowS
FieldInfo -> String
(Int -> FieldInfo -> ShowS)
-> (FieldInfo -> String)
-> ([FieldInfo] -> ShowS)
-> Show FieldInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldInfo] -> ShowS
$cshowList :: [FieldInfo] -> ShowS
show :: FieldInfo -> String
$cshow :: FieldInfo -> String
showsPrec :: Int -> FieldInfo -> ShowS
$cshowsPrec :: Int -> FieldInfo -> ShowS
Prelude.Show, (forall x. FieldInfo -> Rep FieldInfo x)
-> (forall x. Rep FieldInfo x -> FieldInfo) -> Generic FieldInfo
forall x. Rep FieldInfo x -> FieldInfo
forall x. FieldInfo -> Rep FieldInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FieldInfo x -> FieldInfo
$cfrom :: forall x. FieldInfo -> Rep FieldInfo x
Prelude.Generic)

-- |
-- Create a value of 'FieldInfo' 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:
--
-- 'name', 'fieldInfo_name' - Name of the field.
newFieldInfo ::
  FieldInfo
newFieldInfo :: FieldInfo
newFieldInfo = FieldInfo' :: Maybe Text -> FieldInfo
FieldInfo' {$sel:name:FieldInfo' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | Name of the field.
fieldInfo_name :: Lens.Lens' FieldInfo (Prelude.Maybe Prelude.Text)
fieldInfo_name :: (Maybe Text -> f (Maybe Text)) -> FieldInfo -> f FieldInfo
fieldInfo_name = (FieldInfo -> Maybe Text)
-> (FieldInfo -> Maybe Text -> FieldInfo)
-> Lens FieldInfo FieldInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldInfo' {Maybe Text
name :: Maybe Text
$sel:name:FieldInfo' :: FieldInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: FieldInfo
s@FieldInfo' {} Maybe Text
a -> FieldInfo
s {$sel:name:FieldInfo' :: Maybe Text
name = Maybe Text
a} :: FieldInfo)

instance Core.FromJSON FieldInfo where
  parseJSON :: Value -> Parser FieldInfo
parseJSON =
    String -> (Object -> Parser FieldInfo) -> Value -> Parser FieldInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FieldInfo"
      (\Object
x -> Maybe Text -> FieldInfo
FieldInfo' (Maybe Text -> FieldInfo)
-> Parser (Maybe Text) -> Parser FieldInfo
forall (f :: * -> *) a b. Functor 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
"Name"))

instance Prelude.Hashable FieldInfo

instance Prelude.NFData FieldInfo