{-# 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.LexModels.Types.MigrationAlert
-- 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.LexModels.Types.MigrationAlert where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexModels.Types.MigrationAlertType
import qualified Amazonka.Prelude as Prelude

-- | Provides information about alerts and warnings that Amazon Lex sends
-- during a migration. The alerts include information about how to resolve
-- the issue.
--
-- /See:/ 'newMigrationAlert' smart constructor.
data MigrationAlert = MigrationAlert'
  { -- | Additional details about the alert.
    MigrationAlert -> Maybe [Text]
details :: Prelude.Maybe [Prelude.Text],
    -- | A message that describes why the alert was issued.
    MigrationAlert -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | A link to the Amazon Lex documentation that describes how to resolve the
    -- alert.
    MigrationAlert -> Maybe [Text]
referenceURLs :: Prelude.Maybe [Prelude.Text],
    -- | The type of alert. There are two kinds of alerts:
    --
    -- -   @ERROR@ - There was an issue with the migration that can\'t be
    --     resolved. The migration stops.
    --
    -- -   @WARN@ - There was an issue with the migration that requires manual
    --     changes to the new Amazon Lex V2 bot. The migration continues.
    MigrationAlert -> Maybe MigrationAlertType
type' :: Prelude.Maybe MigrationAlertType
  }
  deriving (MigrationAlert -> MigrationAlert -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MigrationAlert -> MigrationAlert -> Bool
$c/= :: MigrationAlert -> MigrationAlert -> Bool
== :: MigrationAlert -> MigrationAlert -> Bool
$c== :: MigrationAlert -> MigrationAlert -> Bool
Prelude.Eq, ReadPrec [MigrationAlert]
ReadPrec MigrationAlert
Int -> ReadS MigrationAlert
ReadS [MigrationAlert]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MigrationAlert]
$creadListPrec :: ReadPrec [MigrationAlert]
readPrec :: ReadPrec MigrationAlert
$creadPrec :: ReadPrec MigrationAlert
readList :: ReadS [MigrationAlert]
$creadList :: ReadS [MigrationAlert]
readsPrec :: Int -> ReadS MigrationAlert
$creadsPrec :: Int -> ReadS MigrationAlert
Prelude.Read, Int -> MigrationAlert -> ShowS
[MigrationAlert] -> ShowS
MigrationAlert -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MigrationAlert] -> ShowS
$cshowList :: [MigrationAlert] -> ShowS
show :: MigrationAlert -> String
$cshow :: MigrationAlert -> String
showsPrec :: Int -> MigrationAlert -> ShowS
$cshowsPrec :: Int -> MigrationAlert -> ShowS
Prelude.Show, forall x. Rep MigrationAlert x -> MigrationAlert
forall x. MigrationAlert -> Rep MigrationAlert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MigrationAlert x -> MigrationAlert
$cfrom :: forall x. MigrationAlert -> Rep MigrationAlert x
Prelude.Generic)

-- |
-- Create a value of 'MigrationAlert' 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:
--
-- 'details', 'migrationAlert_details' - Additional details about the alert.
--
-- 'message', 'migrationAlert_message' - A message that describes why the alert was issued.
--
-- 'referenceURLs', 'migrationAlert_referenceURLs' - A link to the Amazon Lex documentation that describes how to resolve the
-- alert.
--
-- 'type'', 'migrationAlert_type' - The type of alert. There are two kinds of alerts:
--
-- -   @ERROR@ - There was an issue with the migration that can\'t be
--     resolved. The migration stops.
--
-- -   @WARN@ - There was an issue with the migration that requires manual
--     changes to the new Amazon Lex V2 bot. The migration continues.
newMigrationAlert ::
  MigrationAlert
newMigrationAlert :: MigrationAlert
newMigrationAlert =
  MigrationAlert'
    { $sel:details:MigrationAlert' :: Maybe [Text]
details = forall a. Maybe a
Prelude.Nothing,
      $sel:message:MigrationAlert' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing,
      $sel:referenceURLs:MigrationAlert' :: Maybe [Text]
referenceURLs = forall a. Maybe a
Prelude.Nothing,
      $sel:type':MigrationAlert' :: Maybe MigrationAlertType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | Additional details about the alert.
migrationAlert_details :: Lens.Lens' MigrationAlert (Prelude.Maybe [Prelude.Text])
migrationAlert_details :: Lens' MigrationAlert (Maybe [Text])
migrationAlert_details = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe [Text]
details :: Maybe [Text]
$sel:details:MigrationAlert' :: MigrationAlert -> Maybe [Text]
details} -> Maybe [Text]
details) (\s :: MigrationAlert
s@MigrationAlert' {} Maybe [Text]
a -> MigrationAlert
s {$sel:details:MigrationAlert' :: Maybe [Text]
details = Maybe [Text]
a} :: MigrationAlert) 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

-- | A message that describes why the alert was issued.
migrationAlert_message :: Lens.Lens' MigrationAlert (Prelude.Maybe Prelude.Text)
migrationAlert_message :: Lens' MigrationAlert (Maybe Text)
migrationAlert_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe Text
message :: Maybe Text
$sel:message:MigrationAlert' :: MigrationAlert -> Maybe Text
message} -> Maybe Text
message) (\s :: MigrationAlert
s@MigrationAlert' {} Maybe Text
a -> MigrationAlert
s {$sel:message:MigrationAlert' :: Maybe Text
message = Maybe Text
a} :: MigrationAlert)

-- | A link to the Amazon Lex documentation that describes how to resolve the
-- alert.
migrationAlert_referenceURLs :: Lens.Lens' MigrationAlert (Prelude.Maybe [Prelude.Text])
migrationAlert_referenceURLs :: Lens' MigrationAlert (Maybe [Text])
migrationAlert_referenceURLs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe [Text]
referenceURLs :: Maybe [Text]
$sel:referenceURLs:MigrationAlert' :: MigrationAlert -> Maybe [Text]
referenceURLs} -> Maybe [Text]
referenceURLs) (\s :: MigrationAlert
s@MigrationAlert' {} Maybe [Text]
a -> MigrationAlert
s {$sel:referenceURLs:MigrationAlert' :: Maybe [Text]
referenceURLs = Maybe [Text]
a} :: MigrationAlert) 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 type of alert. There are two kinds of alerts:
--
-- -   @ERROR@ - There was an issue with the migration that can\'t be
--     resolved. The migration stops.
--
-- -   @WARN@ - There was an issue with the migration that requires manual
--     changes to the new Amazon Lex V2 bot. The migration continues.
migrationAlert_type :: Lens.Lens' MigrationAlert (Prelude.Maybe MigrationAlertType)
migrationAlert_type :: Lens' MigrationAlert (Maybe MigrationAlertType)
migrationAlert_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrationAlert' {Maybe MigrationAlertType
type' :: Maybe MigrationAlertType
$sel:type':MigrationAlert' :: MigrationAlert -> Maybe MigrationAlertType
type'} -> Maybe MigrationAlertType
type') (\s :: MigrationAlert
s@MigrationAlert' {} Maybe MigrationAlertType
a -> MigrationAlert
s {$sel:type':MigrationAlert' :: Maybe MigrationAlertType
type' = Maybe MigrationAlertType
a} :: MigrationAlert)

instance Data.FromJSON MigrationAlert where
  parseJSON :: Value -> Parser MigrationAlert
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MigrationAlert"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe [Text]
-> Maybe MigrationAlertType
-> MigrationAlert
MigrationAlert'
            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
"details" 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 (Maybe a)
Data..:? Key
"message")
            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
"referenceURLs" 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 (Maybe a)
Data..:? Key
"type")
      )

instance Prelude.Hashable MigrationAlert where
  hashWithSalt :: Int -> MigrationAlert -> Int
hashWithSalt Int
_salt MigrationAlert' {Maybe [Text]
Maybe Text
Maybe MigrationAlertType
type' :: Maybe MigrationAlertType
referenceURLs :: Maybe [Text]
message :: Maybe Text
details :: Maybe [Text]
$sel:type':MigrationAlert' :: MigrationAlert -> Maybe MigrationAlertType
$sel:referenceURLs:MigrationAlert' :: MigrationAlert -> Maybe [Text]
$sel:message:MigrationAlert' :: MigrationAlert -> Maybe Text
$sel:details:MigrationAlert' :: MigrationAlert -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
details
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
referenceURLs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MigrationAlertType
type'

instance Prelude.NFData MigrationAlert where
  rnf :: MigrationAlert -> ()
rnf MigrationAlert' {Maybe [Text]
Maybe Text
Maybe MigrationAlertType
type' :: Maybe MigrationAlertType
referenceURLs :: Maybe [Text]
message :: Maybe Text
details :: Maybe [Text]
$sel:type':MigrationAlert' :: MigrationAlert -> Maybe MigrationAlertType
$sel:referenceURLs:MigrationAlert' :: MigrationAlert -> Maybe [Text]
$sel:message:MigrationAlert' :: MigrationAlert -> Maybe Text
$sel:details:MigrationAlert' :: MigrationAlert -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
details
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
referenceURLs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MigrationAlertType
type'