{-# 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.LexV2Models.Types.SampleValue
-- 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.LexV2Models.Types.SampleValue 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

-- | Defines one of the values for a slot type.
--
-- /See:/ 'newSampleValue' smart constructor.
data SampleValue = SampleValue'
  { -- | The value that can be used for a slot type.
    SampleValue -> Text
value :: Prelude.Text
  }
  deriving (SampleValue -> SampleValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SampleValue -> SampleValue -> Bool
$c/= :: SampleValue -> SampleValue -> Bool
== :: SampleValue -> SampleValue -> Bool
$c== :: SampleValue -> SampleValue -> Bool
Prelude.Eq, ReadPrec [SampleValue]
ReadPrec SampleValue
Int -> ReadS SampleValue
ReadS [SampleValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SampleValue]
$creadListPrec :: ReadPrec [SampleValue]
readPrec :: ReadPrec SampleValue
$creadPrec :: ReadPrec SampleValue
readList :: ReadS [SampleValue]
$creadList :: ReadS [SampleValue]
readsPrec :: Int -> ReadS SampleValue
$creadsPrec :: Int -> ReadS SampleValue
Prelude.Read, Int -> SampleValue -> ShowS
[SampleValue] -> ShowS
SampleValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SampleValue] -> ShowS
$cshowList :: [SampleValue] -> ShowS
show :: SampleValue -> String
$cshow :: SampleValue -> String
showsPrec :: Int -> SampleValue -> ShowS
$cshowsPrec :: Int -> SampleValue -> ShowS
Prelude.Show, forall x. Rep SampleValue x -> SampleValue
forall x. SampleValue -> Rep SampleValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SampleValue x -> SampleValue
$cfrom :: forall x. SampleValue -> Rep SampleValue x
Prelude.Generic)

-- |
-- Create a value of 'SampleValue' 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:
--
-- 'value', 'sampleValue_value' - The value that can be used for a slot type.
newSampleValue ::
  -- | 'value'
  Prelude.Text ->
  SampleValue
newSampleValue :: Text -> SampleValue
newSampleValue Text
pValue_ =
  SampleValue' {$sel:value:SampleValue' :: Text
value = Text
pValue_}

-- | The value that can be used for a slot type.
sampleValue_value :: Lens.Lens' SampleValue Prelude.Text
sampleValue_value :: Lens' SampleValue Text
sampleValue_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SampleValue' {Text
value :: Text
$sel:value:SampleValue' :: SampleValue -> Text
value} -> Text
value) (\s :: SampleValue
s@SampleValue' {} Text
a -> SampleValue
s {$sel:value:SampleValue' :: Text
value = Text
a} :: SampleValue)

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

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

instance Prelude.NFData SampleValue where
  rnf :: SampleValue -> ()
rnf SampleValue' {Text
value :: Text
$sel:value:SampleValue' :: SampleValue -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
value

instance Data.ToJSON SampleValue where
  toJSON :: SampleValue -> Value
toJSON SampleValue' {Text
value :: Text
$sel:value:SampleValue' :: SampleValue -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"value" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
value)]
      )