{-# 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.FraudDetector.Types.FieldValidationMessage
-- 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.FraudDetector.Types.FieldValidationMessage where

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

-- | The message details.
--
-- /See:/ 'newFieldValidationMessage' smart constructor.
data FieldValidationMessage = FieldValidationMessage'
  { -- | The message ID.
    FieldValidationMessage -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | The message content.
    FieldValidationMessage -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
    -- | The field name.
    FieldValidationMessage -> Maybe Text
fieldName :: Prelude.Maybe Prelude.Text,
    -- | The message title.
    FieldValidationMessage -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | The message type.
    FieldValidationMessage -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (FieldValidationMessage -> FieldValidationMessage -> Bool
(FieldValidationMessage -> FieldValidationMessage -> Bool)
-> (FieldValidationMessage -> FieldValidationMessage -> Bool)
-> Eq FieldValidationMessage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldValidationMessage -> FieldValidationMessage -> Bool
$c/= :: FieldValidationMessage -> FieldValidationMessage -> Bool
== :: FieldValidationMessage -> FieldValidationMessage -> Bool
$c== :: FieldValidationMessage -> FieldValidationMessage -> Bool
Prelude.Eq, ReadPrec [FieldValidationMessage]
ReadPrec FieldValidationMessage
Int -> ReadS FieldValidationMessage
ReadS [FieldValidationMessage]
(Int -> ReadS FieldValidationMessage)
-> ReadS [FieldValidationMessage]
-> ReadPrec FieldValidationMessage
-> ReadPrec [FieldValidationMessage]
-> Read FieldValidationMessage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldValidationMessage]
$creadListPrec :: ReadPrec [FieldValidationMessage]
readPrec :: ReadPrec FieldValidationMessage
$creadPrec :: ReadPrec FieldValidationMessage
readList :: ReadS [FieldValidationMessage]
$creadList :: ReadS [FieldValidationMessage]
readsPrec :: Int -> ReadS FieldValidationMessage
$creadsPrec :: Int -> ReadS FieldValidationMessage
Prelude.Read, Int -> FieldValidationMessage -> ShowS
[FieldValidationMessage] -> ShowS
FieldValidationMessage -> String
(Int -> FieldValidationMessage -> ShowS)
-> (FieldValidationMessage -> String)
-> ([FieldValidationMessage] -> ShowS)
-> Show FieldValidationMessage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldValidationMessage] -> ShowS
$cshowList :: [FieldValidationMessage] -> ShowS
show :: FieldValidationMessage -> String
$cshow :: FieldValidationMessage -> String
showsPrec :: Int -> FieldValidationMessage -> ShowS
$cshowsPrec :: Int -> FieldValidationMessage -> ShowS
Prelude.Show, (forall x. FieldValidationMessage -> Rep FieldValidationMessage x)
-> (forall x.
    Rep FieldValidationMessage x -> FieldValidationMessage)
-> Generic FieldValidationMessage
forall x. Rep FieldValidationMessage x -> FieldValidationMessage
forall x. FieldValidationMessage -> Rep FieldValidationMessage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FieldValidationMessage x -> FieldValidationMessage
$cfrom :: forall x. FieldValidationMessage -> Rep FieldValidationMessage x
Prelude.Generic)

-- |
-- Create a value of 'FieldValidationMessage' 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:
--
-- 'identifier', 'fieldValidationMessage_identifier' - The message ID.
--
-- 'content', 'fieldValidationMessage_content' - The message content.
--
-- 'fieldName', 'fieldValidationMessage_fieldName' - The field name.
--
-- 'title', 'fieldValidationMessage_title' - The message title.
--
-- 'type'', 'fieldValidationMessage_type' - The message type.
newFieldValidationMessage ::
  FieldValidationMessage
newFieldValidationMessage :: FieldValidationMessage
newFieldValidationMessage =
  FieldValidationMessage' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> FieldValidationMessage
FieldValidationMessage'
    { $sel:identifier:FieldValidationMessage' :: Maybe Text
identifier =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:content:FieldValidationMessage' :: Maybe Text
content = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fieldName:FieldValidationMessage' :: Maybe Text
fieldName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:title:FieldValidationMessage' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':FieldValidationMessage' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The message ID.
fieldValidationMessage_identifier :: Lens.Lens' FieldValidationMessage (Prelude.Maybe Prelude.Text)
fieldValidationMessage_identifier :: (Maybe Text -> f (Maybe Text))
-> FieldValidationMessage -> f FieldValidationMessage
fieldValidationMessage_identifier = (FieldValidationMessage -> Maybe Text)
-> (FieldValidationMessage -> Maybe Text -> FieldValidationMessage)
-> Lens
     FieldValidationMessage
     FieldValidationMessage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldValidationMessage' {Maybe Text
identifier :: Maybe Text
$sel:identifier:FieldValidationMessage' :: FieldValidationMessage -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: FieldValidationMessage
s@FieldValidationMessage' {} Maybe Text
a -> FieldValidationMessage
s {$sel:identifier:FieldValidationMessage' :: Maybe Text
identifier = Maybe Text
a} :: FieldValidationMessage)

-- | The message content.
fieldValidationMessage_content :: Lens.Lens' FieldValidationMessage (Prelude.Maybe Prelude.Text)
fieldValidationMessage_content :: (Maybe Text -> f (Maybe Text))
-> FieldValidationMessage -> f FieldValidationMessage
fieldValidationMessage_content = (FieldValidationMessage -> Maybe Text)
-> (FieldValidationMessage -> Maybe Text -> FieldValidationMessage)
-> Lens
     FieldValidationMessage
     FieldValidationMessage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldValidationMessage' {Maybe Text
content :: Maybe Text
$sel:content:FieldValidationMessage' :: FieldValidationMessage -> Maybe Text
content} -> Maybe Text
content) (\s :: FieldValidationMessage
s@FieldValidationMessage' {} Maybe Text
a -> FieldValidationMessage
s {$sel:content:FieldValidationMessage' :: Maybe Text
content = Maybe Text
a} :: FieldValidationMessage)

-- | The field name.
fieldValidationMessage_fieldName :: Lens.Lens' FieldValidationMessage (Prelude.Maybe Prelude.Text)
fieldValidationMessage_fieldName :: (Maybe Text -> f (Maybe Text))
-> FieldValidationMessage -> f FieldValidationMessage
fieldValidationMessage_fieldName = (FieldValidationMessage -> Maybe Text)
-> (FieldValidationMessage -> Maybe Text -> FieldValidationMessage)
-> Lens
     FieldValidationMessage
     FieldValidationMessage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldValidationMessage' {Maybe Text
fieldName :: Maybe Text
$sel:fieldName:FieldValidationMessage' :: FieldValidationMessage -> Maybe Text
fieldName} -> Maybe Text
fieldName) (\s :: FieldValidationMessage
s@FieldValidationMessage' {} Maybe Text
a -> FieldValidationMessage
s {$sel:fieldName:FieldValidationMessage' :: Maybe Text
fieldName = Maybe Text
a} :: FieldValidationMessage)

-- | The message title.
fieldValidationMessage_title :: Lens.Lens' FieldValidationMessage (Prelude.Maybe Prelude.Text)
fieldValidationMessage_title :: (Maybe Text -> f (Maybe Text))
-> FieldValidationMessage -> f FieldValidationMessage
fieldValidationMessage_title = (FieldValidationMessage -> Maybe Text)
-> (FieldValidationMessage -> Maybe Text -> FieldValidationMessage)
-> Lens
     FieldValidationMessage
     FieldValidationMessage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldValidationMessage' {Maybe Text
title :: Maybe Text
$sel:title:FieldValidationMessage' :: FieldValidationMessage -> Maybe Text
title} -> Maybe Text
title) (\s :: FieldValidationMessage
s@FieldValidationMessage' {} Maybe Text
a -> FieldValidationMessage
s {$sel:title:FieldValidationMessage' :: Maybe Text
title = Maybe Text
a} :: FieldValidationMessage)

-- | The message type.
fieldValidationMessage_type :: Lens.Lens' FieldValidationMessage (Prelude.Maybe Prelude.Text)
fieldValidationMessage_type :: (Maybe Text -> f (Maybe Text))
-> FieldValidationMessage -> f FieldValidationMessage
fieldValidationMessage_type = (FieldValidationMessage -> Maybe Text)
-> (FieldValidationMessage -> Maybe Text -> FieldValidationMessage)
-> Lens
     FieldValidationMessage
     FieldValidationMessage
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldValidationMessage' {Maybe Text
type' :: Maybe Text
$sel:type':FieldValidationMessage' :: FieldValidationMessage -> Maybe Text
type'} -> Maybe Text
type') (\s :: FieldValidationMessage
s@FieldValidationMessage' {} Maybe Text
a -> FieldValidationMessage
s {$sel:type':FieldValidationMessage' :: Maybe Text
type' = Maybe Text
a} :: FieldValidationMessage)

instance Core.FromJSON FieldValidationMessage where
  parseJSON :: Value -> Parser FieldValidationMessage
parseJSON =
    String
-> (Object -> Parser FieldValidationMessage)
-> Value
-> Parser FieldValidationMessage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FieldValidationMessage"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> FieldValidationMessage
FieldValidationMessage'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> FieldValidationMessage)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> FieldValidationMessage)
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
"identifier")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> FieldValidationMessage)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> FieldValidationMessage)
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
"content")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> FieldValidationMessage)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> FieldValidationMessage)
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
"fieldName")
            Parser (Maybe Text -> Maybe Text -> FieldValidationMessage)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> FieldValidationMessage)
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
"title")
            Parser (Maybe Text -> FieldValidationMessage)
-> Parser (Maybe Text) -> Parser FieldValidationMessage
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
"type")
      )

instance Prelude.Hashable FieldValidationMessage

instance Prelude.NFData FieldValidationMessage