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

import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types.ModelTypeEnum
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The model.
--
-- /See:/ 'newModel' smart constructor.
data Model = Model'
  { -- | The model type.
    Model -> Maybe ModelTypeEnum
modelType :: Prelude.Maybe ModelTypeEnum,
    -- | Timestamp of last time the model was updated.
    Model -> Maybe Text
lastUpdatedTime :: Prelude.Maybe Prelude.Text,
    -- | The model ID.
    Model -> Maybe Text
modelId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the model.
    Model -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | Timestamp of when the model was created.
    Model -> Maybe Text
createdTime :: Prelude.Maybe Prelude.Text,
    -- | The name of the event type.
    Model -> Maybe Text
eventTypeName :: Prelude.Maybe Prelude.Text,
    -- | The model description.
    Model -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (Model -> Model -> Bool
(Model -> Model -> Bool) -> (Model -> Model -> Bool) -> Eq Model
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Model -> Model -> Bool
$c/= :: Model -> Model -> Bool
== :: Model -> Model -> Bool
$c== :: Model -> Model -> Bool
Prelude.Eq, ReadPrec [Model]
ReadPrec Model
Int -> ReadS Model
ReadS [Model]
(Int -> ReadS Model)
-> ReadS [Model]
-> ReadPrec Model
-> ReadPrec [Model]
-> Read Model
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Model]
$creadListPrec :: ReadPrec [Model]
readPrec :: ReadPrec Model
$creadPrec :: ReadPrec Model
readList :: ReadS [Model]
$creadList :: ReadS [Model]
readsPrec :: Int -> ReadS Model
$creadsPrec :: Int -> ReadS Model
Prelude.Read, Int -> Model -> ShowS
[Model] -> ShowS
Model -> String
(Int -> Model -> ShowS)
-> (Model -> String) -> ([Model] -> ShowS) -> Show Model
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Model] -> ShowS
$cshowList :: [Model] -> ShowS
show :: Model -> String
$cshow :: Model -> String
showsPrec :: Int -> Model -> ShowS
$cshowsPrec :: Int -> Model -> ShowS
Prelude.Show, (forall x. Model -> Rep Model x)
-> (forall x. Rep Model x -> Model) -> Generic Model
forall x. Rep Model x -> Model
forall x. Model -> Rep Model x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Model x -> Model
$cfrom :: forall x. Model -> Rep Model x
Prelude.Generic)

-- |
-- Create a value of 'Model' 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:
--
-- 'modelType', 'model_modelType' - The model type.
--
-- 'lastUpdatedTime', 'model_lastUpdatedTime' - Timestamp of last time the model was updated.
--
-- 'modelId', 'model_modelId' - The model ID.
--
-- 'arn', 'model_arn' - The ARN of the model.
--
-- 'createdTime', 'model_createdTime' - Timestamp of when the model was created.
--
-- 'eventTypeName', 'model_eventTypeName' - The name of the event type.
--
-- 'description', 'model_description' - The model description.
newModel ::
  Model
newModel :: Model
newModel =
  Model' :: Maybe ModelTypeEnum
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Model
Model'
    { $sel:modelType:Model' :: Maybe ModelTypeEnum
modelType = Maybe ModelTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTime:Model' :: Maybe Text
lastUpdatedTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:modelId:Model' :: Maybe Text
modelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Model' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:Model' :: Maybe Text
createdTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventTypeName:Model' :: Maybe Text
eventTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Model' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The model type.
model_modelType :: Lens.Lens' Model (Prelude.Maybe ModelTypeEnum)
model_modelType :: (Maybe ModelTypeEnum -> f (Maybe ModelTypeEnum))
-> Model -> f Model
model_modelType = (Model -> Maybe ModelTypeEnum)
-> (Model -> Maybe ModelTypeEnum -> Model)
-> Lens Model Model (Maybe ModelTypeEnum) (Maybe ModelTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Model' {Maybe ModelTypeEnum
modelType :: Maybe ModelTypeEnum
$sel:modelType:Model' :: Model -> Maybe ModelTypeEnum
modelType} -> Maybe ModelTypeEnum
modelType) (\s :: Model
s@Model' {} Maybe ModelTypeEnum
a -> Model
s {$sel:modelType:Model' :: Maybe ModelTypeEnum
modelType = Maybe ModelTypeEnum
a} :: Model)

-- | Timestamp of last time the model was updated.
model_lastUpdatedTime :: Lens.Lens' Model (Prelude.Maybe Prelude.Text)
model_lastUpdatedTime :: (Maybe Text -> f (Maybe Text)) -> Model -> f Model
model_lastUpdatedTime = (Model -> Maybe Text)
-> (Model -> Maybe Text -> Model)
-> Lens Model Model (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Model' {Maybe Text
lastUpdatedTime :: Maybe Text
$sel:lastUpdatedTime:Model' :: Model -> Maybe Text
lastUpdatedTime} -> Maybe Text
lastUpdatedTime) (\s :: Model
s@Model' {} Maybe Text
a -> Model
s {$sel:lastUpdatedTime:Model' :: Maybe Text
lastUpdatedTime = Maybe Text
a} :: Model)

-- | The model ID.
model_modelId :: Lens.Lens' Model (Prelude.Maybe Prelude.Text)
model_modelId :: (Maybe Text -> f (Maybe Text)) -> Model -> f Model
model_modelId = (Model -> Maybe Text)
-> (Model -> Maybe Text -> Model)
-> Lens Model Model (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Model' {Maybe Text
modelId :: Maybe Text
$sel:modelId:Model' :: Model -> Maybe Text
modelId} -> Maybe Text
modelId) (\s :: Model
s@Model' {} Maybe Text
a -> Model
s {$sel:modelId:Model' :: Maybe Text
modelId = Maybe Text
a} :: Model)

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

-- | Timestamp of when the model was created.
model_createdTime :: Lens.Lens' Model (Prelude.Maybe Prelude.Text)
model_createdTime :: (Maybe Text -> f (Maybe Text)) -> Model -> f Model
model_createdTime = (Model -> Maybe Text)
-> (Model -> Maybe Text -> Model)
-> Lens Model Model (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Model' {Maybe Text
createdTime :: Maybe Text
$sel:createdTime:Model' :: Model -> Maybe Text
createdTime} -> Maybe Text
createdTime) (\s :: Model
s@Model' {} Maybe Text
a -> Model
s {$sel:createdTime:Model' :: Maybe Text
createdTime = Maybe Text
a} :: Model)

-- | The name of the event type.
model_eventTypeName :: Lens.Lens' Model (Prelude.Maybe Prelude.Text)
model_eventTypeName :: (Maybe Text -> f (Maybe Text)) -> Model -> f Model
model_eventTypeName = (Model -> Maybe Text)
-> (Model -> Maybe Text -> Model)
-> Lens Model Model (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Model' {Maybe Text
eventTypeName :: Maybe Text
$sel:eventTypeName:Model' :: Model -> Maybe Text
eventTypeName} -> Maybe Text
eventTypeName) (\s :: Model
s@Model' {} Maybe Text
a -> Model
s {$sel:eventTypeName:Model' :: Maybe Text
eventTypeName = Maybe Text
a} :: Model)

-- | The model description.
model_description :: Lens.Lens' Model (Prelude.Maybe Prelude.Text)
model_description :: (Maybe Text -> f (Maybe Text)) -> Model -> f Model
model_description = (Model -> Maybe Text)
-> (Model -> Maybe Text -> Model)
-> Lens Model Model (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Model' {Maybe Text
description :: Maybe Text
$sel:description:Model' :: Model -> Maybe Text
description} -> Maybe Text
description) (\s :: Model
s@Model' {} Maybe Text
a -> Model
s {$sel:description:Model' :: Maybe Text
description = Maybe Text
a} :: Model)

instance Core.FromJSON Model where
  parseJSON :: Value -> Parser Model
parseJSON =
    String -> (Object -> Parser Model) -> Value -> Parser Model
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Model"
      ( \Object
x ->
          Maybe ModelTypeEnum
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Model
Model'
            (Maybe ModelTypeEnum
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Model)
-> Parser (Maybe ModelTypeEnum)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Model)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ModelTypeEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"modelType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Model)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Model)
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
"lastUpdatedTime")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Model)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Model)
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
"modelId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> Model)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Model)
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 Text -> Model)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Model)
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 Text -> Model)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Model)
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
"eventTypeName")
            Parser (Maybe Text -> Model) -> Parser (Maybe Text) -> Parser Model
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 Model

instance Prelude.NFData Model