{-# 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.Pose
-- 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.Pose 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

-- | Indicates the pose of the face as determined by its pitch, roll, and
-- yaw.
--
-- /See:/ 'newPose' smart constructor.
data Pose = Pose'
  { -- | Value representing the face rotation on the pitch axis.
    Pose -> Maybe Double
pitch :: Prelude.Maybe Prelude.Double,
    -- | Value representing the face rotation on the roll axis.
    Pose -> Maybe Double
roll :: Prelude.Maybe Prelude.Double,
    -- | Value representing the face rotation on the yaw axis.
    Pose -> Maybe Double
yaw :: Prelude.Maybe Prelude.Double
  }
  deriving (Pose -> Pose -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pose -> Pose -> Bool
$c/= :: Pose -> Pose -> Bool
== :: Pose -> Pose -> Bool
$c== :: Pose -> Pose -> Bool
Prelude.Eq, ReadPrec [Pose]
ReadPrec Pose
Int -> ReadS Pose
ReadS [Pose]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Pose]
$creadListPrec :: ReadPrec [Pose]
readPrec :: ReadPrec Pose
$creadPrec :: ReadPrec Pose
readList :: ReadS [Pose]
$creadList :: ReadS [Pose]
readsPrec :: Int -> ReadS Pose
$creadsPrec :: Int -> ReadS Pose
Prelude.Read, Int -> Pose -> ShowS
[Pose] -> ShowS
Pose -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pose] -> ShowS
$cshowList :: [Pose] -> ShowS
show :: Pose -> String
$cshow :: Pose -> String
showsPrec :: Int -> Pose -> ShowS
$cshowsPrec :: Int -> Pose -> ShowS
Prelude.Show, forall x. Rep Pose x -> Pose
forall x. Pose -> Rep Pose x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Pose x -> Pose
$cfrom :: forall x. Pose -> Rep Pose x
Prelude.Generic)

-- |
-- Create a value of 'Pose' 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:
--
-- 'pitch', 'pose_pitch' - Value representing the face rotation on the pitch axis.
--
-- 'roll', 'pose_roll' - Value representing the face rotation on the roll axis.
--
-- 'yaw', 'pose_yaw' - Value representing the face rotation on the yaw axis.
newPose ::
  Pose
newPose :: Pose
newPose =
  Pose'
    { $sel:pitch:Pose' :: Maybe Double
pitch = forall a. Maybe a
Prelude.Nothing,
      $sel:roll:Pose' :: Maybe Double
roll = forall a. Maybe a
Prelude.Nothing,
      $sel:yaw:Pose' :: Maybe Double
yaw = forall a. Maybe a
Prelude.Nothing
    }

-- | Value representing the face rotation on the pitch axis.
pose_pitch :: Lens.Lens' Pose (Prelude.Maybe Prelude.Double)
pose_pitch :: Lens' Pose (Maybe Double)
pose_pitch = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pose' {Maybe Double
pitch :: Maybe Double
$sel:pitch:Pose' :: Pose -> Maybe Double
pitch} -> Maybe Double
pitch) (\s :: Pose
s@Pose' {} Maybe Double
a -> Pose
s {$sel:pitch:Pose' :: Maybe Double
pitch = Maybe Double
a} :: Pose)

-- | Value representing the face rotation on the roll axis.
pose_roll :: Lens.Lens' Pose (Prelude.Maybe Prelude.Double)
pose_roll :: Lens' Pose (Maybe Double)
pose_roll = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pose' {Maybe Double
roll :: Maybe Double
$sel:roll:Pose' :: Pose -> Maybe Double
roll} -> Maybe Double
roll) (\s :: Pose
s@Pose' {} Maybe Double
a -> Pose
s {$sel:roll:Pose' :: Maybe Double
roll = Maybe Double
a} :: Pose)

-- | Value representing the face rotation on the yaw axis.
pose_yaw :: Lens.Lens' Pose (Prelude.Maybe Prelude.Double)
pose_yaw :: Lens' Pose (Maybe Double)
pose_yaw = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Pose' {Maybe Double
yaw :: Maybe Double
$sel:yaw:Pose' :: Pose -> Maybe Double
yaw} -> Maybe Double
yaw) (\s :: Pose
s@Pose' {} Maybe Double
a -> Pose
s {$sel:yaw:Pose' :: Maybe Double
yaw = Maybe Double
a} :: Pose)

instance Data.FromJSON Pose where
  parseJSON :: Value -> Parser Pose
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Pose"
      ( \Object
x ->
          Maybe Double -> Maybe Double -> Maybe Double -> Pose
Pose'
            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
"Pitch")
            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
"Roll")
            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
"Yaw")
      )

instance Prelude.Hashable Pose where
  hashWithSalt :: Int -> Pose -> Int
hashWithSalt Int
_salt Pose' {Maybe Double
yaw :: Maybe Double
roll :: Maybe Double
pitch :: Maybe Double
$sel:yaw:Pose' :: Pose -> Maybe Double
$sel:roll:Pose' :: Pose -> Maybe Double
$sel:pitch:Pose' :: Pose -> Maybe Double
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
pitch
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
roll
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
yaw

instance Prelude.NFData Pose where
  rnf :: Pose -> ()
rnf Pose' {Maybe Double
yaw :: Maybe Double
roll :: Maybe Double
pitch :: Maybe Double
$sel:yaw:Pose' :: Pose -> Maybe Double
$sel:roll:Pose' :: Pose -> Maybe Double
$sel:pitch:Pose' :: Pose -> Maybe Double
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
pitch
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
roll
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
yaw