{-# 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.FraudDetector.Types.Variable
-- 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.FraudDetector.Types.Variable where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types.DataSource
import Amazonka.FraudDetector.Types.DataType
import qualified Amazonka.Prelude as Prelude

-- | The variable.
--
-- /See:/ 'newVariable' smart constructor.
data Variable = Variable'
  { -- | The ARN of the variable.
    Variable -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The time when the variable was created.
    Variable -> Maybe Text
createdTime :: Prelude.Maybe Prelude.Text,
    -- | The data source of the variable.
    Variable -> Maybe DataSource
dataSource :: Prelude.Maybe DataSource,
    -- | The data type of the variable. For more information see
    -- <https://docs.aws.amazon.com/frauddetector/latest/ug/create-a-variable.html#variable-types Variable types>.
    Variable -> Maybe DataType
dataType :: Prelude.Maybe DataType,
    -- | The default value of the variable.
    Variable -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text,
    -- | The description of the variable.
    Variable -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The time when variable was last updated.
    Variable -> Maybe Text
lastUpdatedTime :: Prelude.Maybe Prelude.Text,
    -- | The name of the variable.
    Variable -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The variable type of the variable.
    --
    -- Valid Values:
    -- @AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT @
    Variable -> Maybe Text
variableType :: Prelude.Maybe Prelude.Text
  }
  deriving (Variable -> Variable -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Variable -> Variable -> Bool
$c/= :: Variable -> Variable -> Bool
== :: Variable -> Variable -> Bool
$c== :: Variable -> Variable -> Bool
Prelude.Eq, ReadPrec [Variable]
ReadPrec Variable
Int -> ReadS Variable
ReadS [Variable]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Variable]
$creadListPrec :: ReadPrec [Variable]
readPrec :: ReadPrec Variable
$creadPrec :: ReadPrec Variable
readList :: ReadS [Variable]
$creadList :: ReadS [Variable]
readsPrec :: Int -> ReadS Variable
$creadsPrec :: Int -> ReadS Variable
Prelude.Read, Int -> Variable -> ShowS
[Variable] -> ShowS
Variable -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Variable] -> ShowS
$cshowList :: [Variable] -> ShowS
show :: Variable -> String
$cshow :: Variable -> String
showsPrec :: Int -> Variable -> ShowS
$cshowsPrec :: Int -> Variable -> ShowS
Prelude.Show, forall x. Rep Variable x -> Variable
forall x. Variable -> Rep Variable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Variable x -> Variable
$cfrom :: forall x. Variable -> Rep Variable x
Prelude.Generic)

-- |
-- Create a value of 'Variable' 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:
--
-- 'arn', 'variable_arn' - The ARN of the variable.
--
-- 'createdTime', 'variable_createdTime' - The time when the variable was created.
--
-- 'dataSource', 'variable_dataSource' - The data source of the variable.
--
-- 'dataType', 'variable_dataType' - The data type of the variable. For more information see
-- <https://docs.aws.amazon.com/frauddetector/latest/ug/create-a-variable.html#variable-types Variable types>.
--
-- 'defaultValue', 'variable_defaultValue' - The default value of the variable.
--
-- 'description', 'variable_description' - The description of the variable.
--
-- 'lastUpdatedTime', 'variable_lastUpdatedTime' - The time when variable was last updated.
--
-- 'name', 'variable_name' - The name of the variable.
--
-- 'variableType', 'variable_variableType' - The variable type of the variable.
--
-- Valid Values:
-- @AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT @
newVariable ::
  Variable
newVariable :: Variable
newVariable =
  Variable'
    { $sel:arn:Variable' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:Variable' :: Maybe Text
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:dataSource:Variable' :: Maybe DataSource
dataSource = forall a. Maybe a
Prelude.Nothing,
      $sel:dataType:Variable' :: Maybe DataType
dataType = forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:Variable' :: Maybe Text
defaultValue = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Variable' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:Variable' :: Maybe Text
lastUpdatedTime = forall a. Maybe a
Prelude.Nothing,
      $sel:name:Variable' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:variableType:Variable' :: Maybe Text
variableType = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the variable.
variable_arn :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_arn :: Lens' Variable (Maybe Text)
variable_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
arn :: Maybe Text
$sel:arn:Variable' :: Variable -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:arn:Variable' :: Maybe Text
arn = Maybe Text
a} :: Variable)

-- | The time when the variable was created.
variable_createdTime :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_createdTime :: Lens' Variable (Maybe Text)
variable_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
createdTime :: Maybe Text
$sel:createdTime:Variable' :: Variable -> Maybe Text
createdTime} -> Maybe Text
createdTime) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:createdTime:Variable' :: Maybe Text
createdTime = Maybe Text
a} :: Variable)

-- | The data source of the variable.
variable_dataSource :: Lens.Lens' Variable (Prelude.Maybe DataSource)
variable_dataSource :: Lens' Variable (Maybe DataSource)
variable_dataSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe DataSource
dataSource :: Maybe DataSource
$sel:dataSource:Variable' :: Variable -> Maybe DataSource
dataSource} -> Maybe DataSource
dataSource) (\s :: Variable
s@Variable' {} Maybe DataSource
a -> Variable
s {$sel:dataSource:Variable' :: Maybe DataSource
dataSource = Maybe DataSource
a} :: Variable)

-- | The data type of the variable. For more information see
-- <https://docs.aws.amazon.com/frauddetector/latest/ug/create-a-variable.html#variable-types Variable types>.
variable_dataType :: Lens.Lens' Variable (Prelude.Maybe DataType)
variable_dataType :: Lens' Variable (Maybe DataType)
variable_dataType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe DataType
dataType :: Maybe DataType
$sel:dataType:Variable' :: Variable -> Maybe DataType
dataType} -> Maybe DataType
dataType) (\s :: Variable
s@Variable' {} Maybe DataType
a -> Variable
s {$sel:dataType:Variable' :: Maybe DataType
dataType = Maybe DataType
a} :: Variable)

-- | The default value of the variable.
variable_defaultValue :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_defaultValue :: Lens' Variable (Maybe Text)
variable_defaultValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:Variable' :: Variable -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:defaultValue:Variable' :: Maybe Text
defaultValue = Maybe Text
a} :: Variable)

-- | The description of the variable.
variable_description :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_description :: Lens' Variable (Maybe Text)
variable_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
description :: Maybe Text
$sel:description:Variable' :: Variable -> Maybe Text
description} -> Maybe Text
description) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:description:Variable' :: Maybe Text
description = Maybe Text
a} :: Variable)

-- | The time when variable was last updated.
variable_lastUpdatedTime :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_lastUpdatedTime :: Lens' Variable (Maybe Text)
variable_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
lastUpdatedTime :: Maybe Text
$sel:lastUpdatedTime:Variable' :: Variable -> Maybe Text
lastUpdatedTime} -> Maybe Text
lastUpdatedTime) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:lastUpdatedTime:Variable' :: Maybe Text
lastUpdatedTime = Maybe Text
a} :: Variable)

-- | The name of the variable.
variable_name :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_name :: Lens' Variable (Maybe Text)
variable_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
name :: Maybe Text
$sel:name:Variable' :: Variable -> Maybe Text
name} -> Maybe Text
name) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:name:Variable' :: Maybe Text
name = Maybe Text
a} :: Variable)

-- | The variable type of the variable.
--
-- Valid Values:
-- @AUTH_CODE | AVS | BILLING_ADDRESS_L1 | BILLING_ADDRESS_L2 | BILLING_CITY | BILLING_COUNTRY | BILLING_NAME | BILLING_PHONE | BILLING_STATE | BILLING_ZIP | CARD_BIN | CATEGORICAL | CURRENCY_CODE | EMAIL_ADDRESS | FINGERPRINT | FRAUD_LABEL | FREE_FORM_TEXT | IP_ADDRESS | NUMERIC | ORDER_ID | PAYMENT_TYPE | PHONE_NUMBER | PRICE | PRODUCT_CATEGORY | SHIPPING_ADDRESS_L1 | SHIPPING_ADDRESS_L2 | SHIPPING_CITY | SHIPPING_COUNTRY | SHIPPING_NAME | SHIPPING_PHONE | SHIPPING_STATE | SHIPPING_ZIP | USERAGENT @
variable_variableType :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_variableType :: Lens' Variable (Maybe Text)
variable_variableType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
variableType :: Maybe Text
$sel:variableType:Variable' :: Variable -> Maybe Text
variableType} -> Maybe Text
variableType) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:variableType:Variable' :: Maybe Text
variableType = Maybe Text
a} :: Variable)

instance Data.FromJSON Variable where
  parseJSON :: Value -> Parser Variable
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Variable"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe DataSource
-> Maybe DataType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Variable
Variable'
            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
"arn")
            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
"createdTime")
            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
"dataSource")
            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
"dataType")
            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
"defaultValue")
            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
"description")
            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
"lastUpdatedTime")
            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
"name")
            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
"variableType")
      )

instance Prelude.Hashable Variable where
  hashWithSalt :: Int -> Variable -> Int
hashWithSalt Int
_salt Variable' {Maybe Text
Maybe DataSource
Maybe DataType
variableType :: Maybe Text
name :: Maybe Text
lastUpdatedTime :: Maybe Text
description :: Maybe Text
defaultValue :: Maybe Text
dataType :: Maybe DataType
dataSource :: Maybe DataSource
createdTime :: Maybe Text
arn :: Maybe Text
$sel:variableType:Variable' :: Variable -> Maybe Text
$sel:name:Variable' :: Variable -> Maybe Text
$sel:lastUpdatedTime:Variable' :: Variable -> Maybe Text
$sel:description:Variable' :: Variable -> Maybe Text
$sel:defaultValue:Variable' :: Variable -> Maybe Text
$sel:dataType:Variable' :: Variable -> Maybe DataType
$sel:dataSource:Variable' :: Variable -> Maybe DataSource
$sel:createdTime:Variable' :: Variable -> Maybe Text
$sel:arn:Variable' :: Variable -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataSource
dataSource
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataType
dataType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
defaultValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
lastUpdatedTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
variableType

instance Prelude.NFData Variable where
  rnf :: Variable -> ()
rnf Variable' {Maybe Text
Maybe DataSource
Maybe DataType
variableType :: Maybe Text
name :: Maybe Text
lastUpdatedTime :: Maybe Text
description :: Maybe Text
defaultValue :: Maybe Text
dataType :: Maybe DataType
dataSource :: Maybe DataSource
createdTime :: Maybe Text
arn :: Maybe Text
$sel:variableType:Variable' :: Variable -> Maybe Text
$sel:name:Variable' :: Variable -> Maybe Text
$sel:lastUpdatedTime:Variable' :: Variable -> Maybe Text
$sel:description:Variable' :: Variable -> Maybe Text
$sel:defaultValue:Variable' :: Variable -> Maybe Text
$sel:dataType:Variable' :: Variable -> Maybe DataType
$sel:dataSource:Variable' :: Variable -> Maybe DataSource
$sel:createdTime:Variable' :: Variable -> Maybe Text
$sel:arn:Variable' :: Variable -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataSource
dataSource
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataType
dataType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
defaultValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
lastUpdatedTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
variableType