{-# 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.CognitoIdentityProvider.Types.NumberAttributeConstraintsType
-- 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.CognitoIdentityProvider.Types.NumberAttributeConstraintsType 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

-- | The minimum and maximum values of an attribute that is of the number
-- data type.
--
-- /See:/ 'newNumberAttributeConstraintsType' smart constructor.
data NumberAttributeConstraintsType = NumberAttributeConstraintsType'
  { -- | The maximum value of an attribute that is of the number data type.
    NumberAttributeConstraintsType -> Maybe Text
maxValue :: Prelude.Maybe Prelude.Text,
    -- | The minimum value of an attribute that is of the number data type.
    NumberAttributeConstraintsType -> Maybe Text
minValue :: Prelude.Maybe Prelude.Text
  }
  deriving (NumberAttributeConstraintsType
-> NumberAttributeConstraintsType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NumberAttributeConstraintsType
-> NumberAttributeConstraintsType -> Bool
$c/= :: NumberAttributeConstraintsType
-> NumberAttributeConstraintsType -> Bool
== :: NumberAttributeConstraintsType
-> NumberAttributeConstraintsType -> Bool
$c== :: NumberAttributeConstraintsType
-> NumberAttributeConstraintsType -> Bool
Prelude.Eq, ReadPrec [NumberAttributeConstraintsType]
ReadPrec NumberAttributeConstraintsType
Int -> ReadS NumberAttributeConstraintsType
ReadS [NumberAttributeConstraintsType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NumberAttributeConstraintsType]
$creadListPrec :: ReadPrec [NumberAttributeConstraintsType]
readPrec :: ReadPrec NumberAttributeConstraintsType
$creadPrec :: ReadPrec NumberAttributeConstraintsType
readList :: ReadS [NumberAttributeConstraintsType]
$creadList :: ReadS [NumberAttributeConstraintsType]
readsPrec :: Int -> ReadS NumberAttributeConstraintsType
$creadsPrec :: Int -> ReadS NumberAttributeConstraintsType
Prelude.Read, Int -> NumberAttributeConstraintsType -> ShowS
[NumberAttributeConstraintsType] -> ShowS
NumberAttributeConstraintsType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NumberAttributeConstraintsType] -> ShowS
$cshowList :: [NumberAttributeConstraintsType] -> ShowS
show :: NumberAttributeConstraintsType -> String
$cshow :: NumberAttributeConstraintsType -> String
showsPrec :: Int -> NumberAttributeConstraintsType -> ShowS
$cshowsPrec :: Int -> NumberAttributeConstraintsType -> ShowS
Prelude.Show, forall x.
Rep NumberAttributeConstraintsType x
-> NumberAttributeConstraintsType
forall x.
NumberAttributeConstraintsType
-> Rep NumberAttributeConstraintsType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NumberAttributeConstraintsType x
-> NumberAttributeConstraintsType
$cfrom :: forall x.
NumberAttributeConstraintsType
-> Rep NumberAttributeConstraintsType x
Prelude.Generic)

-- |
-- Create a value of 'NumberAttributeConstraintsType' 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:
--
-- 'maxValue', 'numberAttributeConstraintsType_maxValue' - The maximum value of an attribute that is of the number data type.
--
-- 'minValue', 'numberAttributeConstraintsType_minValue' - The minimum value of an attribute that is of the number data type.
newNumberAttributeConstraintsType ::
  NumberAttributeConstraintsType
newNumberAttributeConstraintsType :: NumberAttributeConstraintsType
newNumberAttributeConstraintsType =
  NumberAttributeConstraintsType'
    { $sel:maxValue:NumberAttributeConstraintsType' :: Maybe Text
maxValue =
        forall a. Maybe a
Prelude.Nothing,
      $sel:minValue:NumberAttributeConstraintsType' :: Maybe Text
minValue = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum value of an attribute that is of the number data type.
numberAttributeConstraintsType_maxValue :: Lens.Lens' NumberAttributeConstraintsType (Prelude.Maybe Prelude.Text)
numberAttributeConstraintsType_maxValue :: Lens' NumberAttributeConstraintsType (Maybe Text)
numberAttributeConstraintsType_maxValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NumberAttributeConstraintsType' {Maybe Text
maxValue :: Maybe Text
$sel:maxValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
maxValue} -> Maybe Text
maxValue) (\s :: NumberAttributeConstraintsType
s@NumberAttributeConstraintsType' {} Maybe Text
a -> NumberAttributeConstraintsType
s {$sel:maxValue:NumberAttributeConstraintsType' :: Maybe Text
maxValue = Maybe Text
a} :: NumberAttributeConstraintsType)

-- | The minimum value of an attribute that is of the number data type.
numberAttributeConstraintsType_minValue :: Lens.Lens' NumberAttributeConstraintsType (Prelude.Maybe Prelude.Text)
numberAttributeConstraintsType_minValue :: Lens' NumberAttributeConstraintsType (Maybe Text)
numberAttributeConstraintsType_minValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NumberAttributeConstraintsType' {Maybe Text
minValue :: Maybe Text
$sel:minValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
minValue} -> Maybe Text
minValue) (\s :: NumberAttributeConstraintsType
s@NumberAttributeConstraintsType' {} Maybe Text
a -> NumberAttributeConstraintsType
s {$sel:minValue:NumberAttributeConstraintsType' :: Maybe Text
minValue = Maybe Text
a} :: NumberAttributeConstraintsType)

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

instance
  Prelude.Hashable
    NumberAttributeConstraintsType
  where
  hashWithSalt :: Int -> NumberAttributeConstraintsType -> Int
hashWithSalt
    Int
_salt
    NumberAttributeConstraintsType' {Maybe Text
minValue :: Maybe Text
maxValue :: Maybe Text
$sel:minValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
$sel:maxValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
maxValue
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
minValue

instance
  Prelude.NFData
    NumberAttributeConstraintsType
  where
  rnf :: NumberAttributeConstraintsType -> ()
rnf NumberAttributeConstraintsType' {Maybe Text
minValue :: Maybe Text
maxValue :: Maybe Text
$sel:minValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
$sel:maxValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
maxValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
minValue

instance Data.ToJSON NumberAttributeConstraintsType where
  toJSON :: NumberAttributeConstraintsType -> Value
toJSON NumberAttributeConstraintsType' {Maybe Text
minValue :: Maybe Text
maxValue :: Maybe Text
$sel:minValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
$sel:maxValue:NumberAttributeConstraintsType' :: NumberAttributeConstraintsType -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxValue,
            (Key
"MinValue" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
minValue
          ]
      )