{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.FraudDetector.Types.Variable where

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

-- | The variable.
--
-- /See:/ 'newVariable' smart constructor.
data Variable = Variable'
  { -- | The time when variable was last updated.
    Variable -> Maybe Text
lastUpdatedTime :: Prelude.Maybe Prelude.Text,
    -- | 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 name of the variable.
    Variable -> Maybe Text
name :: 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 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,
    -- | The description of the variable.
    Variable -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Variable -> Variable -> Bool
(Variable -> Variable -> Bool)
-> (Variable -> Variable -> Bool) -> Eq Variable
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]
(Int -> ReadS Variable)
-> ReadS [Variable]
-> ReadPrec Variable
-> ReadPrec [Variable]
-> Read 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
(Int -> Variable -> ShowS)
-> (Variable -> String) -> ([Variable] -> ShowS) -> Show Variable
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. Variable -> Rep Variable x)
-> (forall x. Rep Variable x -> Variable) -> Generic Variable
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:
--
-- 'lastUpdatedTime', 'variable_lastUpdatedTime' - The time when variable was last updated.
--
-- 'arn', 'variable_arn' - The ARN of the variable.
--
-- 'createdTime', 'variable_createdTime' - The time when the variable was created.
--
-- 'name', 'variable_name' - The name of the variable.
--
-- '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.
--
-- '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 @
--
-- 'description', 'variable_description' - The description of the variable.
newVariable ::
  Variable
newVariable :: Variable
newVariable =
  Variable' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DataSource
-> Maybe DataType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Variable
Variable'
    { $sel:lastUpdatedTime:Variable' :: Maybe Text
lastUpdatedTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Variable' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:Variable' :: Maybe Text
createdTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Variable' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSource:Variable' :: Maybe DataSource
dataSource = Maybe DataSource
forall a. Maybe a
Prelude.Nothing,
      $sel:dataType:Variable' :: Maybe DataType
dataType = Maybe DataType
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:Variable' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:variableType:Variable' :: Maybe Text
variableType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Variable' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The time when variable was last updated.
variable_lastUpdatedTime :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_lastUpdatedTime :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_lastUpdatedTime = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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 ARN of the variable.
variable_arn :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_arn :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_arn = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_createdTime = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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 name of the variable.
variable_name :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_name :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_name = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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 data source of the variable.
variable_dataSource :: Lens.Lens' Variable (Prelude.Maybe DataSource)
variable_dataSource :: (Maybe DataSource -> f (Maybe DataSource))
-> Variable -> f Variable
variable_dataSource = (Variable -> Maybe DataSource)
-> (Variable -> Maybe DataSource -> Variable)
-> Lens Variable Variable (Maybe DataSource) (Maybe 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 :: (Maybe DataType -> f (Maybe DataType)) -> Variable -> f Variable
variable_dataType = (Variable -> Maybe DataType)
-> (Variable -> Maybe DataType -> Variable)
-> Lens Variable Variable (Maybe DataType) (Maybe 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 :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_defaultValue = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_variableType = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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)

-- | The description of the variable.
variable_description :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_description :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_description = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON Variable where
  parseJSON :: Value -> Parser Variable
parseJSON =
    String -> (Object -> Parser Variable) -> Value -> Parser Variable
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Variable"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe DataSource
-> Maybe DataType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Variable
Variable'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe DataSource
 -> Maybe DataType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Variable)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe DataSource
      -> Maybe DataType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Variable)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedTime")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe DataSource
   -> Maybe DataType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Variable)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe DataSource
      -> Maybe DataType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe DataSource
   -> Maybe DataType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Variable)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe DataSource
      -> Maybe DataType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdTime")
            Parser
  (Maybe Text
   -> Maybe DataSource
   -> Maybe DataType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Variable)
-> Parser (Maybe Text)
-> Parser
     (Maybe DataSource
      -> Maybe DataType
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser
  (Maybe DataSource
   -> Maybe DataType
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Variable)
-> Parser (Maybe DataSource)
-> Parser
     (Maybe DataType
      -> Maybe Text -> Maybe Text -> Maybe Text -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DataSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataSource")
            Parser
  (Maybe DataType
   -> Maybe Text -> Maybe Text -> Maybe Text -> Variable)
-> Parser (Maybe DataType)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DataType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dataType")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> Variable)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"defaultValue")
            Parser (Maybe Text -> Maybe Text -> Variable)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"variableType")
            Parser (Maybe Text -> Variable)
-> Parser (Maybe Text) -> Parser Variable
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
      )

instance Prelude.Hashable Variable

instance Prelude.NFData Variable