{-# 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 #-}
module Amazonka.Rekognition.Types.Label where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types.Instance
import Amazonka.Rekognition.Types.Parent
data Label = Label'
{
Label -> Maybe Double
confidence :: Prelude.Maybe Prelude.Double,
Label -> Maybe [Parent]
parents :: Prelude.Maybe [Parent],
Label -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Label -> Maybe [Instance]
instances :: Prelude.Maybe [Instance]
}
deriving (Label -> Label -> Bool
(Label -> Label -> Bool) -> (Label -> Label -> Bool) -> Eq Label
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Label -> Label -> Bool
$c/= :: Label -> Label -> Bool
== :: Label -> Label -> Bool
$c== :: Label -> Label -> Bool
Prelude.Eq, ReadPrec [Label]
ReadPrec Label
Int -> ReadS Label
ReadS [Label]
(Int -> ReadS Label)
-> ReadS [Label]
-> ReadPrec Label
-> ReadPrec [Label]
-> Read Label
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Label]
$creadListPrec :: ReadPrec [Label]
readPrec :: ReadPrec Label
$creadPrec :: ReadPrec Label
readList :: ReadS [Label]
$creadList :: ReadS [Label]
readsPrec :: Int -> ReadS Label
$creadsPrec :: Int -> ReadS Label
Prelude.Read, Int -> Label -> ShowS
[Label] -> ShowS
Label -> String
(Int -> Label -> ShowS)
-> (Label -> String) -> ([Label] -> ShowS) -> Show Label
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Label] -> ShowS
$cshowList :: [Label] -> ShowS
show :: Label -> String
$cshow :: Label -> String
showsPrec :: Int -> Label -> ShowS
$cshowsPrec :: Int -> Label -> ShowS
Prelude.Show, (forall x. Label -> Rep Label x)
-> (forall x. Rep Label x -> Label) -> Generic Label
forall x. Rep Label x -> Label
forall x. Label -> Rep Label x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Label x -> Label
$cfrom :: forall x. Label -> Rep Label x
Prelude.Generic)
newLabel ::
Label
newLabel :: Label
newLabel =
Label' :: Maybe Double
-> Maybe [Parent] -> Maybe Text -> Maybe [Instance] -> Label
Label'
{ $sel:confidence:Label' :: Maybe Double
confidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:parents:Label' :: Maybe [Parent]
parents = Maybe [Parent]
forall a. Maybe a
Prelude.Nothing,
$sel:name:Label' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instances:Label' :: Maybe [Instance]
instances = Maybe [Instance]
forall a. Maybe a
Prelude.Nothing
}
label_confidence :: Lens.Lens' Label (Prelude.Maybe Prelude.Double)
label_confidence :: (Maybe Double -> f (Maybe Double)) -> Label -> f Label
label_confidence = (Label -> Maybe Double)
-> (Label -> Maybe Double -> Label)
-> Lens Label Label (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Label' {Maybe Double
confidence :: Maybe Double
$sel:confidence:Label' :: Label -> Maybe Double
confidence} -> Maybe Double
confidence) (\s :: Label
s@Label' {} Maybe Double
a -> Label
s {$sel:confidence:Label' :: Maybe Double
confidence = Maybe Double
a} :: Label)
label_parents :: Lens.Lens' Label (Prelude.Maybe [Parent])
label_parents :: (Maybe [Parent] -> f (Maybe [Parent])) -> Label -> f Label
label_parents = (Label -> Maybe [Parent])
-> (Label -> Maybe [Parent] -> Label)
-> Lens Label Label (Maybe [Parent]) (Maybe [Parent])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Label' {Maybe [Parent]
parents :: Maybe [Parent]
$sel:parents:Label' :: Label -> Maybe [Parent]
parents} -> Maybe [Parent]
parents) (\s :: Label
s@Label' {} Maybe [Parent]
a -> Label
s {$sel:parents:Label' :: Maybe [Parent]
parents = Maybe [Parent]
a} :: Label) ((Maybe [Parent] -> f (Maybe [Parent])) -> Label -> f Label)
-> ((Maybe [Parent] -> f (Maybe [Parent]))
-> Maybe [Parent] -> f (Maybe [Parent]))
-> (Maybe [Parent] -> f (Maybe [Parent]))
-> Label
-> f Label
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Parent] [Parent] [Parent] [Parent]
-> Iso
(Maybe [Parent]) (Maybe [Parent]) (Maybe [Parent]) (Maybe [Parent])
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 AnIso [Parent] [Parent] [Parent] [Parent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
label_name :: Lens.Lens' Label (Prelude.Maybe Prelude.Text)
label_name :: (Maybe Text -> f (Maybe Text)) -> Label -> f Label
label_name = (Label -> Maybe Text)
-> (Label -> Maybe Text -> Label)
-> Lens Label Label (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Label' {Maybe Text
name :: Maybe Text
$sel:name:Label' :: Label -> Maybe Text
name} -> Maybe Text
name) (\s :: Label
s@Label' {} Maybe Text
a -> Label
s {$sel:name:Label' :: Maybe Text
name = Maybe Text
a} :: Label)
label_instances :: Lens.Lens' Label (Prelude.Maybe [Instance])
label_instances :: (Maybe [Instance] -> f (Maybe [Instance])) -> Label -> f Label
label_instances = (Label -> Maybe [Instance])
-> (Label -> Maybe [Instance] -> Label)
-> Lens Label Label (Maybe [Instance]) (Maybe [Instance])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Label' {Maybe [Instance]
instances :: Maybe [Instance]
$sel:instances:Label' :: Label -> Maybe [Instance]
instances} -> Maybe [Instance]
instances) (\s :: Label
s@Label' {} Maybe [Instance]
a -> Label
s {$sel:instances:Label' :: Maybe [Instance]
instances = Maybe [Instance]
a} :: Label) ((Maybe [Instance] -> f (Maybe [Instance])) -> Label -> f Label)
-> ((Maybe [Instance] -> f (Maybe [Instance]))
-> Maybe [Instance] -> f (Maybe [Instance]))
-> (Maybe [Instance] -> f (Maybe [Instance]))
-> Label
-> f Label
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Instance] [Instance] [Instance] [Instance]
-> Iso
(Maybe [Instance])
(Maybe [Instance])
(Maybe [Instance])
(Maybe [Instance])
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 AnIso [Instance] [Instance] [Instance] [Instance]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Label where
parseJSON :: Value -> Parser Label
parseJSON =
String -> (Object -> Parser Label) -> Value -> Parser Label
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Label"
( \Object
x ->
Maybe Double
-> Maybe [Parent] -> Maybe Text -> Maybe [Instance] -> Label
Label'
(Maybe Double
-> Maybe [Parent] -> Maybe Text -> Maybe [Instance] -> Label)
-> Parser (Maybe Double)
-> Parser
(Maybe [Parent] -> Maybe Text -> Maybe [Instance] -> Label)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Confidence")
Parser (Maybe [Parent] -> Maybe Text -> Maybe [Instance] -> Label)
-> Parser (Maybe [Parent])
-> Parser (Maybe Text -> Maybe [Instance] -> Label)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Parent]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parents" Parser (Maybe (Maybe [Parent]))
-> Maybe [Parent] -> Parser (Maybe [Parent])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Parent]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe Text -> Maybe [Instance] -> Label)
-> Parser (Maybe Text) -> Parser (Maybe [Instance] -> Label)
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 [Instance] -> Label)
-> Parser (Maybe [Instance]) -> Parser Label
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Instance]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Instances" Parser (Maybe (Maybe [Instance]))
-> Maybe [Instance] -> Parser (Maybe [Instance])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Instance]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Label
instance Prelude.NFData Label