{-# 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.Personalize.Types.AutoMLResult
-- 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.Personalize.Types.AutoMLResult 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

-- | When the solution performs AutoML (@performAutoML@ is true in
-- <https://docs.aws.amazon.com/personalize/latest/dg/API_CreateSolution.html CreateSolution>),
-- specifies the recipe that best optimized the specified metric.
--
-- /See:/ 'newAutoMLResult' smart constructor.
data AutoMLResult = AutoMLResult'
  { -- | The Amazon Resource Name (ARN) of the best recipe.
    AutoMLResult -> Maybe Text
bestRecipeArn :: Prelude.Maybe Prelude.Text
  }
  deriving (AutoMLResult -> AutoMLResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AutoMLResult -> AutoMLResult -> Bool
$c/= :: AutoMLResult -> AutoMLResult -> Bool
== :: AutoMLResult -> AutoMLResult -> Bool
$c== :: AutoMLResult -> AutoMLResult -> Bool
Prelude.Eq, ReadPrec [AutoMLResult]
ReadPrec AutoMLResult
Int -> ReadS AutoMLResult
ReadS [AutoMLResult]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AutoMLResult]
$creadListPrec :: ReadPrec [AutoMLResult]
readPrec :: ReadPrec AutoMLResult
$creadPrec :: ReadPrec AutoMLResult
readList :: ReadS [AutoMLResult]
$creadList :: ReadS [AutoMLResult]
readsPrec :: Int -> ReadS AutoMLResult
$creadsPrec :: Int -> ReadS AutoMLResult
Prelude.Read, Int -> AutoMLResult -> ShowS
[AutoMLResult] -> ShowS
AutoMLResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AutoMLResult] -> ShowS
$cshowList :: [AutoMLResult] -> ShowS
show :: AutoMLResult -> String
$cshow :: AutoMLResult -> String
showsPrec :: Int -> AutoMLResult -> ShowS
$cshowsPrec :: Int -> AutoMLResult -> ShowS
Prelude.Show, forall x. Rep AutoMLResult x -> AutoMLResult
forall x. AutoMLResult -> Rep AutoMLResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AutoMLResult x -> AutoMLResult
$cfrom :: forall x. AutoMLResult -> Rep AutoMLResult x
Prelude.Generic)

-- |
-- Create a value of 'AutoMLResult' 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:
--
-- 'bestRecipeArn', 'autoMLResult_bestRecipeArn' - The Amazon Resource Name (ARN) of the best recipe.
newAutoMLResult ::
  AutoMLResult
newAutoMLResult :: AutoMLResult
newAutoMLResult =
  AutoMLResult' {$sel:bestRecipeArn:AutoMLResult' :: Maybe Text
bestRecipeArn = forall a. Maybe a
Prelude.Nothing}

-- | The Amazon Resource Name (ARN) of the best recipe.
autoMLResult_bestRecipeArn :: Lens.Lens' AutoMLResult (Prelude.Maybe Prelude.Text)
autoMLResult_bestRecipeArn :: Lens' AutoMLResult (Maybe Text)
autoMLResult_bestRecipeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AutoMLResult' {Maybe Text
bestRecipeArn :: Maybe Text
$sel:bestRecipeArn:AutoMLResult' :: AutoMLResult -> Maybe Text
bestRecipeArn} -> Maybe Text
bestRecipeArn) (\s :: AutoMLResult
s@AutoMLResult' {} Maybe Text
a -> AutoMLResult
s {$sel:bestRecipeArn:AutoMLResult' :: Maybe Text
bestRecipeArn = Maybe Text
a} :: AutoMLResult)

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

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

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