{-# 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.Asset
-- 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.Rekognition.Types.Asset where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.GroundTruthManifest

-- | Assets are the images that you use to train and evaluate a model
-- version. Assets can also contain validation information that you use to
-- debug a failed model training.
--
-- /See:/ 'newAsset' smart constructor.
data Asset = Asset'
  { Asset -> Maybe GroundTruthManifest
groundTruthManifest :: Prelude.Maybe GroundTruthManifest
  }
  deriving (Asset -> Asset -> Bool
(Asset -> Asset -> Bool) -> (Asset -> Asset -> Bool) -> Eq Asset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Asset -> Asset -> Bool
$c/= :: Asset -> Asset -> Bool
== :: Asset -> Asset -> Bool
$c== :: Asset -> Asset -> Bool
Prelude.Eq, ReadPrec [Asset]
ReadPrec Asset
Int -> ReadS Asset
ReadS [Asset]
(Int -> ReadS Asset)
-> ReadS [Asset]
-> ReadPrec Asset
-> ReadPrec [Asset]
-> Read Asset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Asset]
$creadListPrec :: ReadPrec [Asset]
readPrec :: ReadPrec Asset
$creadPrec :: ReadPrec Asset
readList :: ReadS [Asset]
$creadList :: ReadS [Asset]
readsPrec :: Int -> ReadS Asset
$creadsPrec :: Int -> ReadS Asset
Prelude.Read, Int -> Asset -> ShowS
[Asset] -> ShowS
Asset -> String
(Int -> Asset -> ShowS)
-> (Asset -> String) -> ([Asset] -> ShowS) -> Show Asset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Asset] -> ShowS
$cshowList :: [Asset] -> ShowS
show :: Asset -> String
$cshow :: Asset -> String
showsPrec :: Int -> Asset -> ShowS
$cshowsPrec :: Int -> Asset -> ShowS
Prelude.Show, (forall x. Asset -> Rep Asset x)
-> (forall x. Rep Asset x -> Asset) -> Generic Asset
forall x. Rep Asset x -> Asset
forall x. Asset -> Rep Asset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Asset x -> Asset
$cfrom :: forall x. Asset -> Rep Asset x
Prelude.Generic)

-- |
-- Create a value of 'Asset' 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:
--
-- 'groundTruthManifest', 'asset_groundTruthManifest' - Undocumented member.
newAsset ::
  Asset
newAsset :: Asset
newAsset =
  Asset' :: Maybe GroundTruthManifest -> Asset
Asset' {$sel:groundTruthManifest:Asset' :: Maybe GroundTruthManifest
groundTruthManifest = Maybe GroundTruthManifest
forall a. Maybe a
Prelude.Nothing}

-- | Undocumented member.
asset_groundTruthManifest :: Lens.Lens' Asset (Prelude.Maybe GroundTruthManifest)
asset_groundTruthManifest :: (Maybe GroundTruthManifest -> f (Maybe GroundTruthManifest))
-> Asset -> f Asset
asset_groundTruthManifest = (Asset -> Maybe GroundTruthManifest)
-> (Asset -> Maybe GroundTruthManifest -> Asset)
-> Lens
     Asset Asset (Maybe GroundTruthManifest) (Maybe GroundTruthManifest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Asset' {Maybe GroundTruthManifest
groundTruthManifest :: Maybe GroundTruthManifest
$sel:groundTruthManifest:Asset' :: Asset -> Maybe GroundTruthManifest
groundTruthManifest} -> Maybe GroundTruthManifest
groundTruthManifest) (\s :: Asset
s@Asset' {} Maybe GroundTruthManifest
a -> Asset
s {$sel:groundTruthManifest:Asset' :: Maybe GroundTruthManifest
groundTruthManifest = Maybe GroundTruthManifest
a} :: Asset)

instance Core.FromJSON Asset where
  parseJSON :: Value -> Parser Asset
parseJSON =
    String -> (Object -> Parser Asset) -> Value -> Parser Asset
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Asset"
      ( \Object
x ->
          Maybe GroundTruthManifest -> Asset
Asset'
            (Maybe GroundTruthManifest -> Asset)
-> Parser (Maybe GroundTruthManifest) -> Parser Asset
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe GroundTruthManifest)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"GroundTruthManifest")
      )

instance Prelude.Hashable Asset

instance Prelude.NFData Asset

instance Core.ToJSON Asset where
  toJSON :: Asset -> Value
toJSON Asset' {Maybe GroundTruthManifest
groundTruthManifest :: Maybe GroundTruthManifest
$sel:groundTruthManifest:Asset' :: Asset -> Maybe GroundTruthManifest
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"GroundTruthManifest" Text -> GroundTruthManifest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (GroundTruthManifest -> Pair)
-> Maybe GroundTruthManifest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GroundTruthManifest
groundTruthManifest
          ]
      )