{-# 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.FieldOptionError
-- 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.FieldOptionError where

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 for field Options errors.
--
-- /See:/ 'newFieldOptionError' smart constructor.
data FieldOptionError = FieldOptionError'
  { -- | Error code from creating or updating field option.
    FieldOptionError -> Text
errorCode :: Prelude.Text,
    -- | Error message from creating or updating field option.
    FieldOptionError -> Text
message :: Prelude.Text,
    -- | The field option value that caused the error.
    FieldOptionError -> Text
value :: Prelude.Text
  }
  deriving (FieldOptionError -> FieldOptionError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FieldOptionError -> FieldOptionError -> Bool
$c/= :: FieldOptionError -> FieldOptionError -> Bool
== :: FieldOptionError -> FieldOptionError -> Bool
$c== :: FieldOptionError -> FieldOptionError -> Bool
Prelude.Eq, ReadPrec [FieldOptionError]
ReadPrec FieldOptionError
Int -> ReadS FieldOptionError
ReadS [FieldOptionError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FieldOptionError]
$creadListPrec :: ReadPrec [FieldOptionError]
readPrec :: ReadPrec FieldOptionError
$creadPrec :: ReadPrec FieldOptionError
readList :: ReadS [FieldOptionError]
$creadList :: ReadS [FieldOptionError]
readsPrec :: Int -> ReadS FieldOptionError
$creadsPrec :: Int -> ReadS FieldOptionError
Prelude.Read, Int -> FieldOptionError -> ShowS
[FieldOptionError] -> ShowS
FieldOptionError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FieldOptionError] -> ShowS
$cshowList :: [FieldOptionError] -> ShowS
show :: FieldOptionError -> String
$cshow :: FieldOptionError -> String
showsPrec :: Int -> FieldOptionError -> ShowS
$cshowsPrec :: Int -> FieldOptionError -> ShowS
Prelude.Show, forall x. Rep FieldOptionError x -> FieldOptionError
forall x. FieldOptionError -> Rep FieldOptionError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FieldOptionError x -> FieldOptionError
$cfrom :: forall x. FieldOptionError -> Rep FieldOptionError x
Prelude.Generic)

-- |
-- Create a value of 'FieldOptionError' 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:
--
-- 'errorCode', 'fieldOptionError_errorCode' - Error code from creating or updating field option.
--
-- 'message', 'fieldOptionError_message' - Error message from creating or updating field option.
--
-- 'value', 'fieldOptionError_value' - The field option value that caused the error.
newFieldOptionError ::
  -- | 'errorCode'
  Prelude.Text ->
  -- | 'message'
  Prelude.Text ->
  -- | 'value'
  Prelude.Text ->
  FieldOptionError
newFieldOptionError :: Text -> Text -> Text -> FieldOptionError
newFieldOptionError Text
pErrorCode_ Text
pMessage_ Text
pValue_ =
  FieldOptionError'
    { $sel:errorCode:FieldOptionError' :: Text
errorCode = Text
pErrorCode_,
      $sel:message:FieldOptionError' :: Text
message = Text
pMessage_,
      $sel:value:FieldOptionError' :: Text
value = Text
pValue_
    }

-- | Error code from creating or updating field option.
fieldOptionError_errorCode :: Lens.Lens' FieldOptionError Prelude.Text
fieldOptionError_errorCode :: Lens' FieldOptionError Text
fieldOptionError_errorCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldOptionError' {Text
errorCode :: Text
$sel:errorCode:FieldOptionError' :: FieldOptionError -> Text
errorCode} -> Text
errorCode) (\s :: FieldOptionError
s@FieldOptionError' {} Text
a -> FieldOptionError
s {$sel:errorCode:FieldOptionError' :: Text
errorCode = Text
a} :: FieldOptionError)

-- | Error message from creating or updating field option.
fieldOptionError_message :: Lens.Lens' FieldOptionError Prelude.Text
fieldOptionError_message :: Lens' FieldOptionError Text
fieldOptionError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldOptionError' {Text
message :: Text
$sel:message:FieldOptionError' :: FieldOptionError -> Text
message} -> Text
message) (\s :: FieldOptionError
s@FieldOptionError' {} Text
a -> FieldOptionError
s {$sel:message:FieldOptionError' :: Text
message = Text
a} :: FieldOptionError)

-- | The field option value that caused the error.
fieldOptionError_value :: Lens.Lens' FieldOptionError Prelude.Text
fieldOptionError_value :: Lens' FieldOptionError Text
fieldOptionError_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FieldOptionError' {Text
value :: Text
$sel:value:FieldOptionError' :: FieldOptionError -> Text
value} -> Text
value) (\s :: FieldOptionError
s@FieldOptionError' {} Text
a -> FieldOptionError
s {$sel:value:FieldOptionError' :: Text
value = Text
a} :: FieldOptionError)

instance Data.FromJSON FieldOptionError where
  parseJSON :: Value -> Parser FieldOptionError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FieldOptionError"
      ( \Object
x ->
          Text -> Text -> Text -> FieldOptionError
FieldOptionError'
            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
"errorCode")
            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
"message")
            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
"value")
      )

instance Prelude.Hashable FieldOptionError where
  hashWithSalt :: Int -> FieldOptionError -> Int
hashWithSalt Int
_salt FieldOptionError' {Text
value :: Text
message :: Text
errorCode :: Text
$sel:value:FieldOptionError' :: FieldOptionError -> Text
$sel:message:FieldOptionError' :: FieldOptionError -> Text
$sel:errorCode:FieldOptionError' :: FieldOptionError -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
errorCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
message
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
value

instance Prelude.NFData FieldOptionError where
  rnf :: FieldOptionError -> ()
rnf FieldOptionError' {Text
value :: Text
message :: Text
errorCode :: Text
$sel:value:FieldOptionError' :: FieldOptionError -> Text
$sel:message:FieldOptionError' :: FieldOptionError -> Text
$sel:errorCode:FieldOptionError' :: FieldOptionError -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
errorCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
message
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
value