{-# 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.Rekognition.Types.TestingData
-- 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.Rekognition.Types.TestingData 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
import Amazonka.Rekognition.Types.Asset

-- | The dataset used for testing. Optionally, if @AutoCreate@ is set, Amazon
-- Rekognition Custom Labels uses the training dataset to create a test
-- dataset with a temporary split of the training dataset.
--
-- /See:/ 'newTestingData' smart constructor.
data TestingData = TestingData'
  { -- | The assets used for testing.
    TestingData -> Maybe [Asset]
assets :: Prelude.Maybe [Asset],
    -- | If specified, Amazon Rekognition Custom Labels temporarily splits the
    -- training dataset (80%) to create a test dataset (20%) for the training
    -- job. After training completes, the test dataset is not stored and the
    -- training dataset reverts to its previous size.
    TestingData -> Maybe Bool
autoCreate :: Prelude.Maybe Prelude.Bool
  }
  deriving (TestingData -> TestingData -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestingData -> TestingData -> Bool
$c/= :: TestingData -> TestingData -> Bool
== :: TestingData -> TestingData -> Bool
$c== :: TestingData -> TestingData -> Bool
Prelude.Eq, ReadPrec [TestingData]
ReadPrec TestingData
Int -> ReadS TestingData
ReadS [TestingData]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TestingData]
$creadListPrec :: ReadPrec [TestingData]
readPrec :: ReadPrec TestingData
$creadPrec :: ReadPrec TestingData
readList :: ReadS [TestingData]
$creadList :: ReadS [TestingData]
readsPrec :: Int -> ReadS TestingData
$creadsPrec :: Int -> ReadS TestingData
Prelude.Read, Int -> TestingData -> ShowS
[TestingData] -> ShowS
TestingData -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestingData] -> ShowS
$cshowList :: [TestingData] -> ShowS
show :: TestingData -> String
$cshow :: TestingData -> String
showsPrec :: Int -> TestingData -> ShowS
$cshowsPrec :: Int -> TestingData -> ShowS
Prelude.Show, forall x. Rep TestingData x -> TestingData
forall x. TestingData -> Rep TestingData x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestingData x -> TestingData
$cfrom :: forall x. TestingData -> Rep TestingData x
Prelude.Generic)

-- |
-- Create a value of 'TestingData' 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:
--
-- 'assets', 'testingData_assets' - The assets used for testing.
--
-- 'autoCreate', 'testingData_autoCreate' - If specified, Amazon Rekognition Custom Labels temporarily splits the
-- training dataset (80%) to create a test dataset (20%) for the training
-- job. After training completes, the test dataset is not stored and the
-- training dataset reverts to its previous size.
newTestingData ::
  TestingData
newTestingData :: TestingData
newTestingData =
  TestingData'
    { $sel:assets:TestingData' :: Maybe [Asset]
assets = forall a. Maybe a
Prelude.Nothing,
      $sel:autoCreate:TestingData' :: Maybe Bool
autoCreate = forall a. Maybe a
Prelude.Nothing
    }

-- | The assets used for testing.
testingData_assets :: Lens.Lens' TestingData (Prelude.Maybe [Asset])
testingData_assets :: Lens' TestingData (Maybe [Asset])
testingData_assets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestingData' {Maybe [Asset]
assets :: Maybe [Asset]
$sel:assets:TestingData' :: TestingData -> Maybe [Asset]
assets} -> Maybe [Asset]
assets) (\s :: TestingData
s@TestingData' {} Maybe [Asset]
a -> TestingData
s {$sel:assets:TestingData' :: Maybe [Asset]
assets = Maybe [Asset]
a} :: TestingData) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If specified, Amazon Rekognition Custom Labels temporarily splits the
-- training dataset (80%) to create a test dataset (20%) for the training
-- job. After training completes, the test dataset is not stored and the
-- training dataset reverts to its previous size.
testingData_autoCreate :: Lens.Lens' TestingData (Prelude.Maybe Prelude.Bool)
testingData_autoCreate :: Lens' TestingData (Maybe Bool)
testingData_autoCreate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TestingData' {Maybe Bool
autoCreate :: Maybe Bool
$sel:autoCreate:TestingData' :: TestingData -> Maybe Bool
autoCreate} -> Maybe Bool
autoCreate) (\s :: TestingData
s@TestingData' {} Maybe Bool
a -> TestingData
s {$sel:autoCreate:TestingData' :: Maybe Bool
autoCreate = Maybe Bool
a} :: TestingData)

instance Data.FromJSON TestingData where
  parseJSON :: Value -> Parser TestingData
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TestingData"
      ( \Object
x ->
          Maybe [Asset] -> Maybe Bool -> TestingData
TestingData'
            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
"Assets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"AutoCreate")
      )

instance Prelude.Hashable TestingData where
  hashWithSalt :: Int -> TestingData -> Int
hashWithSalt Int
_salt TestingData' {Maybe Bool
Maybe [Asset]
autoCreate :: Maybe Bool
assets :: Maybe [Asset]
$sel:autoCreate:TestingData' :: TestingData -> Maybe Bool
$sel:assets:TestingData' :: TestingData -> Maybe [Asset]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Asset]
assets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
autoCreate

instance Prelude.NFData TestingData where
  rnf :: TestingData -> ()
rnf TestingData' {Maybe Bool
Maybe [Asset]
autoCreate :: Maybe Bool
assets :: Maybe [Asset]
$sel:autoCreate:TestingData' :: TestingData -> Maybe Bool
$sel:assets:TestingData' :: TestingData -> Maybe [Asset]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Asset]
assets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
autoCreate

instance Data.ToJSON TestingData where
  toJSON :: TestingData -> Value
toJSON TestingData' {Maybe Bool
Maybe [Asset]
autoCreate :: Maybe Bool
assets :: Maybe [Asset]
$sel:autoCreate:TestingData' :: TestingData -> Maybe Bool
$sel:assets:TestingData' :: TestingData -> Maybe [Asset]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Assets" 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 [Asset]
assets,
            (Key
"AutoCreate" 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 Bool
autoCreate
          ]
      )