{-# 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.Route53Domains.Types.OperationSummary
-- 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.Route53Domains.Types.OperationSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53Domains.Types.OperationStatus
import Amazonka.Route53Domains.Types.OperationType

-- | OperationSummary includes the following elements.
--
-- /See:/ 'newOperationSummary' smart constructor.
data OperationSummary = OperationSummary'
  { -- | Identifier returned to track the requested action.
    OperationSummary -> Text
operationId :: Prelude.Text,
    -- | The current status of the requested operation in the system.
    OperationSummary -> OperationStatus
status :: OperationStatus,
    -- | Type of the action requested.
    OperationSummary -> OperationType
type' :: OperationType,
    -- | The date when the request was submitted.
    OperationSummary -> POSIX
submittedDate :: Core.POSIX
  }
  deriving (OperationSummary -> OperationSummary -> Bool
(OperationSummary -> OperationSummary -> Bool)
-> (OperationSummary -> OperationSummary -> Bool)
-> Eq OperationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OperationSummary -> OperationSummary -> Bool
$c/= :: OperationSummary -> OperationSummary -> Bool
== :: OperationSummary -> OperationSummary -> Bool
$c== :: OperationSummary -> OperationSummary -> Bool
Prelude.Eq, ReadPrec [OperationSummary]
ReadPrec OperationSummary
Int -> ReadS OperationSummary
ReadS [OperationSummary]
(Int -> ReadS OperationSummary)
-> ReadS [OperationSummary]
-> ReadPrec OperationSummary
-> ReadPrec [OperationSummary]
-> Read OperationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OperationSummary]
$creadListPrec :: ReadPrec [OperationSummary]
readPrec :: ReadPrec OperationSummary
$creadPrec :: ReadPrec OperationSummary
readList :: ReadS [OperationSummary]
$creadList :: ReadS [OperationSummary]
readsPrec :: Int -> ReadS OperationSummary
$creadsPrec :: Int -> ReadS OperationSummary
Prelude.Read, Int -> OperationSummary -> ShowS
[OperationSummary] -> ShowS
OperationSummary -> String
(Int -> OperationSummary -> ShowS)
-> (OperationSummary -> String)
-> ([OperationSummary] -> ShowS)
-> Show OperationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OperationSummary] -> ShowS
$cshowList :: [OperationSummary] -> ShowS
show :: OperationSummary -> String
$cshow :: OperationSummary -> String
showsPrec :: Int -> OperationSummary -> ShowS
$cshowsPrec :: Int -> OperationSummary -> ShowS
Prelude.Show, (forall x. OperationSummary -> Rep OperationSummary x)
-> (forall x. Rep OperationSummary x -> OperationSummary)
-> Generic OperationSummary
forall x. Rep OperationSummary x -> OperationSummary
forall x. OperationSummary -> Rep OperationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OperationSummary x -> OperationSummary
$cfrom :: forall x. OperationSummary -> Rep OperationSummary x
Prelude.Generic)

-- |
-- Create a value of 'OperationSummary' 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:
--
-- 'operationId', 'operationSummary_operationId' - Identifier returned to track the requested action.
--
-- 'status', 'operationSummary_status' - The current status of the requested operation in the system.
--
-- 'type'', 'operationSummary_type' - Type of the action requested.
--
-- 'submittedDate', 'operationSummary_submittedDate' - The date when the request was submitted.
newOperationSummary ::
  -- | 'operationId'
  Prelude.Text ->
  -- | 'status'
  OperationStatus ->
  -- | 'type''
  OperationType ->
  -- | 'submittedDate'
  Prelude.UTCTime ->
  OperationSummary
newOperationSummary :: Text
-> OperationStatus -> OperationType -> UTCTime -> OperationSummary
newOperationSummary
  Text
pOperationId_
  OperationStatus
pStatus_
  OperationType
pType_
  UTCTime
pSubmittedDate_ =
    OperationSummary' :: Text
-> OperationStatus -> OperationType -> POSIX -> OperationSummary
OperationSummary'
      { $sel:operationId:OperationSummary' :: Text
operationId = Text
pOperationId_,
        $sel:status:OperationSummary' :: OperationStatus
status = OperationStatus
pStatus_,
        $sel:type':OperationSummary' :: OperationType
type' = OperationType
pType_,
        $sel:submittedDate:OperationSummary' :: POSIX
submittedDate = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pSubmittedDate_
      }

-- | Identifier returned to track the requested action.
operationSummary_operationId :: Lens.Lens' OperationSummary Prelude.Text
operationSummary_operationId :: (Text -> f Text) -> OperationSummary -> f OperationSummary
operationSummary_operationId = (OperationSummary -> Text)
-> (OperationSummary -> Text -> OperationSummary)
-> Lens OperationSummary OperationSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {Text
operationId :: Text
$sel:operationId:OperationSummary' :: OperationSummary -> Text
operationId} -> Text
operationId) (\s :: OperationSummary
s@OperationSummary' {} Text
a -> OperationSummary
s {$sel:operationId:OperationSummary' :: Text
operationId = Text
a} :: OperationSummary)

-- | The current status of the requested operation in the system.
operationSummary_status :: Lens.Lens' OperationSummary OperationStatus
operationSummary_status :: (OperationStatus -> f OperationStatus)
-> OperationSummary -> f OperationSummary
operationSummary_status = (OperationSummary -> OperationStatus)
-> (OperationSummary -> OperationStatus -> OperationSummary)
-> Lens
     OperationSummary OperationSummary OperationStatus OperationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {OperationStatus
status :: OperationStatus
$sel:status:OperationSummary' :: OperationSummary -> OperationStatus
status} -> OperationStatus
status) (\s :: OperationSummary
s@OperationSummary' {} OperationStatus
a -> OperationSummary
s {$sel:status:OperationSummary' :: OperationStatus
status = OperationStatus
a} :: OperationSummary)

-- | Type of the action requested.
operationSummary_type :: Lens.Lens' OperationSummary OperationType
operationSummary_type :: (OperationType -> f OperationType)
-> OperationSummary -> f OperationSummary
operationSummary_type = (OperationSummary -> OperationType)
-> (OperationSummary -> OperationType -> OperationSummary)
-> Lens
     OperationSummary OperationSummary OperationType OperationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {OperationType
type' :: OperationType
$sel:type':OperationSummary' :: OperationSummary -> OperationType
type'} -> OperationType
type') (\s :: OperationSummary
s@OperationSummary' {} OperationType
a -> OperationSummary
s {$sel:type':OperationSummary' :: OperationType
type' = OperationType
a} :: OperationSummary)

-- | The date when the request was submitted.
operationSummary_submittedDate :: Lens.Lens' OperationSummary Prelude.UTCTime
operationSummary_submittedDate :: (UTCTime -> f UTCTime) -> OperationSummary -> f OperationSummary
operationSummary_submittedDate = (OperationSummary -> POSIX)
-> (OperationSummary -> POSIX -> OperationSummary)
-> Lens OperationSummary OperationSummary POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperationSummary' {POSIX
submittedDate :: POSIX
$sel:submittedDate:OperationSummary' :: OperationSummary -> POSIX
submittedDate} -> POSIX
submittedDate) (\s :: OperationSummary
s@OperationSummary' {} POSIX
a -> OperationSummary
s {$sel:submittedDate:OperationSummary' :: POSIX
submittedDate = POSIX
a} :: OperationSummary) ((POSIX -> f POSIX) -> OperationSummary -> f OperationSummary)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> OperationSummary
-> f OperationSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON OperationSummary where
  parseJSON :: Value -> Parser OperationSummary
parseJSON =
    String
-> (Object -> Parser OperationSummary)
-> Value
-> Parser OperationSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OperationSummary"
      ( \Object
x ->
          Text
-> OperationStatus -> OperationType -> POSIX -> OperationSummary
OperationSummary'
            (Text
 -> OperationStatus -> OperationType -> POSIX -> OperationSummary)
-> Parser Text
-> Parser
     (OperationStatus -> OperationType -> POSIX -> OperationSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"OperationId")
            Parser
  (OperationStatus -> OperationType -> POSIX -> OperationSummary)
-> Parser OperationStatus
-> Parser (OperationType -> POSIX -> OperationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OperationStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Status")
            Parser (OperationType -> POSIX -> OperationSummary)
-> Parser OperationType -> Parser (POSIX -> OperationSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser OperationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
            Parser (POSIX -> OperationSummary)
-> Parser POSIX -> Parser OperationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SubmittedDate")
      )

instance Prelude.Hashable OperationSummary

instance Prelude.NFData OperationSummary