{-# 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.ConnectCases.Types.GetFieldResponse
-- 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.ConnectCases.Types.GetFieldResponse where

import Amazonka.ConnectCases.Types.FieldNamespace
import Amazonka.ConnectCases.Types.FieldType
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

-- | Object to store detailed field information.
--
-- /See:/ 'newGetFieldResponse' smart constructor.
data GetFieldResponse = GetFieldResponse'
  { -- | Description of the field.
    GetFieldResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A map of of key-value pairs that represent tags on a resource. Tags are
    -- used to organize, track, or control access for this resource.
    GetFieldResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Resource Name (ARN) of the field.
    GetFieldResponse -> Text
fieldArn :: Prelude.Text,
    -- | Unique identifier of the field.
    GetFieldResponse -> Text
fieldId :: Prelude.Text,
    -- | Name of the field.
    GetFieldResponse -> Text
name :: Prelude.Text,
    -- | Namespace of the field.
    GetFieldResponse -> FieldNamespace
namespace :: FieldNamespace,
    -- | Type of the field.
    GetFieldResponse -> FieldType
type' :: FieldType
  }
  deriving (GetFieldResponse -> GetFieldResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFieldResponse -> GetFieldResponse -> Bool
$c/= :: GetFieldResponse -> GetFieldResponse -> Bool
== :: GetFieldResponse -> GetFieldResponse -> Bool
$c== :: GetFieldResponse -> GetFieldResponse -> Bool
Prelude.Eq, ReadPrec [GetFieldResponse]
ReadPrec GetFieldResponse
Int -> ReadS GetFieldResponse
ReadS [GetFieldResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFieldResponse]
$creadListPrec :: ReadPrec [GetFieldResponse]
readPrec :: ReadPrec GetFieldResponse
$creadPrec :: ReadPrec GetFieldResponse
readList :: ReadS [GetFieldResponse]
$creadList :: ReadS [GetFieldResponse]
readsPrec :: Int -> ReadS GetFieldResponse
$creadsPrec :: Int -> ReadS GetFieldResponse
Prelude.Read, Int -> GetFieldResponse -> ShowS
[GetFieldResponse] -> ShowS
GetFieldResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFieldResponse] -> ShowS
$cshowList :: [GetFieldResponse] -> ShowS
show :: GetFieldResponse -> String
$cshow :: GetFieldResponse -> String
showsPrec :: Int -> GetFieldResponse -> ShowS
$cshowsPrec :: Int -> GetFieldResponse -> ShowS
Prelude.Show, forall x. Rep GetFieldResponse x -> GetFieldResponse
forall x. GetFieldResponse -> Rep GetFieldResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFieldResponse x -> GetFieldResponse
$cfrom :: forall x. GetFieldResponse -> Rep GetFieldResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFieldResponse' 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:
--
-- 'description', 'getFieldResponse_description' - Description of the field.
--
-- 'tags', 'getFieldResponse_tags' - A map of of key-value pairs that represent tags on a resource. Tags are
-- used to organize, track, or control access for this resource.
--
-- 'fieldArn', 'getFieldResponse_fieldArn' - The Amazon Resource Name (ARN) of the field.
--
-- 'fieldId', 'getFieldResponse_fieldId' - Unique identifier of the field.
--
-- 'name', 'getFieldResponse_name' - Name of the field.
--
-- 'namespace', 'getFieldResponse_namespace' - Namespace of the field.
--
-- 'type'', 'getFieldResponse_type' - Type of the field.
newGetFieldResponse ::
  -- | 'fieldArn'
  Prelude.Text ->
  -- | 'fieldId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'namespace'
  FieldNamespace ->
  -- | 'type''
  FieldType ->
  GetFieldResponse
newGetFieldResponse :: Text
-> Text -> Text -> FieldNamespace -> FieldType -> GetFieldResponse
newGetFieldResponse
  Text
pFieldArn_
  Text
pFieldId_
  Text
pName_
  FieldNamespace
pNamespace_
  FieldType
pType_ =
    GetFieldResponse'
      { $sel:description:GetFieldResponse' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:GetFieldResponse' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:fieldArn:GetFieldResponse' :: Text
fieldArn = Text
pFieldArn_,
        $sel:fieldId:GetFieldResponse' :: Text
fieldId = Text
pFieldId_,
        $sel:name:GetFieldResponse' :: Text
name = Text
pName_,
        $sel:namespace:GetFieldResponse' :: FieldNamespace
namespace = FieldNamespace
pNamespace_,
        $sel:type':GetFieldResponse' :: FieldType
type' = FieldType
pType_
      }

-- | Description of the field.
getFieldResponse_description :: Lens.Lens' GetFieldResponse (Prelude.Maybe Prelude.Text)
getFieldResponse_description :: Lens' GetFieldResponse (Maybe Text)
getFieldResponse_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldResponse' {Maybe Text
description :: Maybe Text
$sel:description:GetFieldResponse' :: GetFieldResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: GetFieldResponse
s@GetFieldResponse' {} Maybe Text
a -> GetFieldResponse
s {$sel:description:GetFieldResponse' :: Maybe Text
description = Maybe Text
a} :: GetFieldResponse)

-- | A map of of key-value pairs that represent tags on a resource. Tags are
-- used to organize, track, or control access for this resource.
getFieldResponse_tags :: Lens.Lens' GetFieldResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getFieldResponse_tags :: Lens' GetFieldResponse (Maybe (HashMap Text Text))
getFieldResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:GetFieldResponse' :: GetFieldResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: GetFieldResponse
s@GetFieldResponse' {} Maybe (HashMap Text Text)
a -> GetFieldResponse
s {$sel:tags:GetFieldResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: GetFieldResponse) 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

-- | The Amazon Resource Name (ARN) of the field.
getFieldResponse_fieldArn :: Lens.Lens' GetFieldResponse Prelude.Text
getFieldResponse_fieldArn :: Lens' GetFieldResponse Text
getFieldResponse_fieldArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldResponse' {Text
fieldArn :: Text
$sel:fieldArn:GetFieldResponse' :: GetFieldResponse -> Text
fieldArn} -> Text
fieldArn) (\s :: GetFieldResponse
s@GetFieldResponse' {} Text
a -> GetFieldResponse
s {$sel:fieldArn:GetFieldResponse' :: Text
fieldArn = Text
a} :: GetFieldResponse)

-- | Unique identifier of the field.
getFieldResponse_fieldId :: Lens.Lens' GetFieldResponse Prelude.Text
getFieldResponse_fieldId :: Lens' GetFieldResponse Text
getFieldResponse_fieldId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldResponse' {Text
fieldId :: Text
$sel:fieldId:GetFieldResponse' :: GetFieldResponse -> Text
fieldId} -> Text
fieldId) (\s :: GetFieldResponse
s@GetFieldResponse' {} Text
a -> GetFieldResponse
s {$sel:fieldId:GetFieldResponse' :: Text
fieldId = Text
a} :: GetFieldResponse)

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

-- | Namespace of the field.
getFieldResponse_namespace :: Lens.Lens' GetFieldResponse FieldNamespace
getFieldResponse_namespace :: Lens' GetFieldResponse FieldNamespace
getFieldResponse_namespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldResponse' {FieldNamespace
namespace :: FieldNamespace
$sel:namespace:GetFieldResponse' :: GetFieldResponse -> FieldNamespace
namespace} -> FieldNamespace
namespace) (\s :: GetFieldResponse
s@GetFieldResponse' {} FieldNamespace
a -> GetFieldResponse
s {$sel:namespace:GetFieldResponse' :: FieldNamespace
namespace = FieldNamespace
a} :: GetFieldResponse)

-- | Type of the field.
getFieldResponse_type :: Lens.Lens' GetFieldResponse FieldType
getFieldResponse_type :: Lens' GetFieldResponse FieldType
getFieldResponse_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFieldResponse' {FieldType
type' :: FieldType
$sel:type':GetFieldResponse' :: GetFieldResponse -> FieldType
type'} -> FieldType
type') (\s :: GetFieldResponse
s@GetFieldResponse' {} FieldType
a -> GetFieldResponse
s {$sel:type':GetFieldResponse' :: FieldType
type' = FieldType
a} :: GetFieldResponse)

instance Data.FromJSON GetFieldResponse where
  parseJSON :: Value -> Parser GetFieldResponse
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"GetFieldResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> FieldNamespace
-> FieldType
-> GetFieldResponse
GetFieldResponse'
            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
"description")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"fieldArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"fieldId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"namespace")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
      )

instance Prelude.Hashable GetFieldResponse where
  hashWithSalt :: Int -> GetFieldResponse -> Int
hashWithSalt Int
_salt GetFieldResponse' {Maybe Text
Maybe (HashMap Text Text)
Text
FieldNamespace
FieldType
type' :: FieldType
namespace :: FieldNamespace
name :: Text
fieldId :: Text
fieldArn :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:type':GetFieldResponse' :: GetFieldResponse -> FieldType
$sel:namespace:GetFieldResponse' :: GetFieldResponse -> FieldNamespace
$sel:name:GetFieldResponse' :: GetFieldResponse -> Text
$sel:fieldId:GetFieldResponse' :: GetFieldResponse -> Text
$sel:fieldArn:GetFieldResponse' :: GetFieldResponse -> Text
$sel:tags:GetFieldResponse' :: GetFieldResponse -> Maybe (HashMap Text Text)
$sel:description:GetFieldResponse' :: GetFieldResponse -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fieldArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fieldId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FieldNamespace
namespace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FieldType
type'

instance Prelude.NFData GetFieldResponse where
  rnf :: GetFieldResponse -> ()
rnf GetFieldResponse' {Maybe Text
Maybe (HashMap Text Text)
Text
FieldNamespace
FieldType
type' :: FieldType
namespace :: FieldNamespace
name :: Text
fieldId :: Text
fieldArn :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:type':GetFieldResponse' :: GetFieldResponse -> FieldType
$sel:namespace:GetFieldResponse' :: GetFieldResponse -> FieldNamespace
$sel:name:GetFieldResponse' :: GetFieldResponse -> Text
$sel:fieldId:GetFieldResponse' :: GetFieldResponse -> Text
$sel:fieldArn:GetFieldResponse' :: GetFieldResponse -> Text
$sel:tags:GetFieldResponse' :: GetFieldResponse -> Maybe (HashMap Text Text)
$sel:description:GetFieldResponse' :: GetFieldResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fieldArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fieldId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FieldNamespace
namespace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf FieldType
type'