{-# 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.PinpointSmsVoiceV2.Types.KeywordInformation
-- 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.PinpointSmsVoiceV2.Types.KeywordInformation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types.KeywordAction
import qualified Amazonka.Prelude as Prelude

-- | The information for all keywords in a pool.
--
-- /See:/ 'newKeywordInformation' smart constructor.
data KeywordInformation = KeywordInformation'
  { -- | The keyword as a string.
    KeywordInformation -> Text
keyword :: Prelude.Text,
    -- | A custom message that can be used with the keyword.
    KeywordInformation -> Text
keywordMessage :: Prelude.Text,
    -- | The action to perform for the keyword.
    KeywordInformation -> KeywordAction
keywordAction :: KeywordAction
  }
  deriving (KeywordInformation -> KeywordInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeywordInformation -> KeywordInformation -> Bool
$c/= :: KeywordInformation -> KeywordInformation -> Bool
== :: KeywordInformation -> KeywordInformation -> Bool
$c== :: KeywordInformation -> KeywordInformation -> Bool
Prelude.Eq, ReadPrec [KeywordInformation]
ReadPrec KeywordInformation
Int -> ReadS KeywordInformation
ReadS [KeywordInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeywordInformation]
$creadListPrec :: ReadPrec [KeywordInformation]
readPrec :: ReadPrec KeywordInformation
$creadPrec :: ReadPrec KeywordInformation
readList :: ReadS [KeywordInformation]
$creadList :: ReadS [KeywordInformation]
readsPrec :: Int -> ReadS KeywordInformation
$creadsPrec :: Int -> ReadS KeywordInformation
Prelude.Read, Int -> KeywordInformation -> ShowS
[KeywordInformation] -> ShowS
KeywordInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeywordInformation] -> ShowS
$cshowList :: [KeywordInformation] -> ShowS
show :: KeywordInformation -> String
$cshow :: KeywordInformation -> String
showsPrec :: Int -> KeywordInformation -> ShowS
$cshowsPrec :: Int -> KeywordInformation -> ShowS
Prelude.Show, forall x. Rep KeywordInformation x -> KeywordInformation
forall x. KeywordInformation -> Rep KeywordInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeywordInformation x -> KeywordInformation
$cfrom :: forall x. KeywordInformation -> Rep KeywordInformation x
Prelude.Generic)

-- |
-- Create a value of 'KeywordInformation' 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:
--
-- 'keyword', 'keywordInformation_keyword' - The keyword as a string.
--
-- 'keywordMessage', 'keywordInformation_keywordMessage' - A custom message that can be used with the keyword.
--
-- 'keywordAction', 'keywordInformation_keywordAction' - The action to perform for the keyword.
newKeywordInformation ::
  -- | 'keyword'
  Prelude.Text ->
  -- | 'keywordMessage'
  Prelude.Text ->
  -- | 'keywordAction'
  KeywordAction ->
  KeywordInformation
newKeywordInformation :: Text -> Text -> KeywordAction -> KeywordInformation
newKeywordInformation
  Text
pKeyword_
  Text
pKeywordMessage_
  KeywordAction
pKeywordAction_ =
    KeywordInformation'
      { $sel:keyword:KeywordInformation' :: Text
keyword = Text
pKeyword_,
        $sel:keywordMessage:KeywordInformation' :: Text
keywordMessage = Text
pKeywordMessage_,
        $sel:keywordAction:KeywordInformation' :: KeywordAction
keywordAction = KeywordAction
pKeywordAction_
      }

-- | The keyword as a string.
keywordInformation_keyword :: Lens.Lens' KeywordInformation Prelude.Text
keywordInformation_keyword :: Lens' KeywordInformation Text
keywordInformation_keyword = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeywordInformation' {Text
keyword :: Text
$sel:keyword:KeywordInformation' :: KeywordInformation -> Text
keyword} -> Text
keyword) (\s :: KeywordInformation
s@KeywordInformation' {} Text
a -> KeywordInformation
s {$sel:keyword:KeywordInformation' :: Text
keyword = Text
a} :: KeywordInformation)

-- | A custom message that can be used with the keyword.
keywordInformation_keywordMessage :: Lens.Lens' KeywordInformation Prelude.Text
keywordInformation_keywordMessage :: Lens' KeywordInformation Text
keywordInformation_keywordMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeywordInformation' {Text
keywordMessage :: Text
$sel:keywordMessage:KeywordInformation' :: KeywordInformation -> Text
keywordMessage} -> Text
keywordMessage) (\s :: KeywordInformation
s@KeywordInformation' {} Text
a -> KeywordInformation
s {$sel:keywordMessage:KeywordInformation' :: Text
keywordMessage = Text
a} :: KeywordInformation)

-- | The action to perform for the keyword.
keywordInformation_keywordAction :: Lens.Lens' KeywordInformation KeywordAction
keywordInformation_keywordAction :: Lens' KeywordInformation KeywordAction
keywordInformation_keywordAction = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeywordInformation' {KeywordAction
keywordAction :: KeywordAction
$sel:keywordAction:KeywordInformation' :: KeywordInformation -> KeywordAction
keywordAction} -> KeywordAction
keywordAction) (\s :: KeywordInformation
s@KeywordInformation' {} KeywordAction
a -> KeywordInformation
s {$sel:keywordAction:KeywordInformation' :: KeywordAction
keywordAction = KeywordAction
a} :: KeywordInformation)

instance Data.FromJSON KeywordInformation where
  parseJSON :: Value -> Parser KeywordInformation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"KeywordInformation"
      ( \Object
x ->
          Text -> Text -> KeywordAction -> KeywordInformation
KeywordInformation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Keyword")
            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
"KeywordMessage")
            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
"KeywordAction")
      )

instance Prelude.Hashable KeywordInformation where
  hashWithSalt :: Int -> KeywordInformation -> Int
hashWithSalt Int
_salt KeywordInformation' {Text
KeywordAction
keywordAction :: KeywordAction
keywordMessage :: Text
keyword :: Text
$sel:keywordAction:KeywordInformation' :: KeywordInformation -> KeywordAction
$sel:keywordMessage:KeywordInformation' :: KeywordInformation -> Text
$sel:keyword:KeywordInformation' :: KeywordInformation -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyword
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keywordMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` KeywordAction
keywordAction

instance Prelude.NFData KeywordInformation where
  rnf :: KeywordInformation -> ()
rnf KeywordInformation' {Text
KeywordAction
keywordAction :: KeywordAction
keywordMessage :: Text
keyword :: Text
$sel:keywordAction:KeywordInformation' :: KeywordInformation -> KeywordAction
$sel:keywordMessage:KeywordInformation' :: KeywordInformation -> Text
$sel:keyword:KeywordInformation' :: KeywordInformation -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
keyword
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
keywordMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf KeywordAction
keywordAction