{-# 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.IoTSiteWise.Types.JobSummary
-- 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.IoTSiteWise.Types.JobSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTSiteWise.Types.JobStatus
import qualified Amazonka.Prelude as Prelude

-- | Contains a job summary information.
--
-- /See:/ 'newJobSummary' smart constructor.
data JobSummary = JobSummary'
  { -- | The ID of the job.
    JobSummary -> Text
id :: Prelude.Text,
    -- | The unique name that helps identify the job request.
    JobSummary -> Text
name :: Prelude.Text,
    -- | The status of the bulk import job can be one of following values.
    --
    -- -   @PENDING@ – IoT SiteWise is waiting for the current bulk import job
    --     to finish.
    --
    -- -   @CANCELLED@ – The bulk import job has been canceled.
    --
    -- -   @RUNNING@ – IoT SiteWise is processing your request to import your
    --     data from Amazon S3.
    --
    -- -   @COMPLETED@ – IoT SiteWise successfully completed your request to
    --     import data from Amazon S3.
    --
    -- -   @FAILED@ – IoT SiteWise couldn\'t process your request to import
    --     data from Amazon S3. You can use logs saved in the specified error
    --     report location in Amazon S3 to troubleshoot issues.
    --
    -- -   @COMPLETED_WITH_FAILURES@ – IoT SiteWise completed your request to
    --     import data from Amazon S3 with errors. You can use logs saved in
    --     the specified error report location in Amazon S3 to troubleshoot
    --     issues.
    JobSummary -> JobStatus
status :: JobStatus
  }
  deriving (JobSummary -> JobSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobSummary -> JobSummary -> Bool
$c/= :: JobSummary -> JobSummary -> Bool
== :: JobSummary -> JobSummary -> Bool
$c== :: JobSummary -> JobSummary -> Bool
Prelude.Eq, ReadPrec [JobSummary]
ReadPrec JobSummary
Int -> ReadS JobSummary
ReadS [JobSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobSummary]
$creadListPrec :: ReadPrec [JobSummary]
readPrec :: ReadPrec JobSummary
$creadPrec :: ReadPrec JobSummary
readList :: ReadS [JobSummary]
$creadList :: ReadS [JobSummary]
readsPrec :: Int -> ReadS JobSummary
$creadsPrec :: Int -> ReadS JobSummary
Prelude.Read, Int -> JobSummary -> ShowS
[JobSummary] -> ShowS
JobSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobSummary] -> ShowS
$cshowList :: [JobSummary] -> ShowS
show :: JobSummary -> String
$cshow :: JobSummary -> String
showsPrec :: Int -> JobSummary -> ShowS
$cshowsPrec :: Int -> JobSummary -> ShowS
Prelude.Show, forall x. Rep JobSummary x -> JobSummary
forall x. JobSummary -> Rep JobSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobSummary x -> JobSummary
$cfrom :: forall x. JobSummary -> Rep JobSummary x
Prelude.Generic)

-- |
-- Create a value of 'JobSummary' 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:
--
-- 'id', 'jobSummary_id' - The ID of the job.
--
-- 'name', 'jobSummary_name' - The unique name that helps identify the job request.
--
-- 'status', 'jobSummary_status' - The status of the bulk import job can be one of following values.
--
-- -   @PENDING@ – IoT SiteWise is waiting for the current bulk import job
--     to finish.
--
-- -   @CANCELLED@ – The bulk import job has been canceled.
--
-- -   @RUNNING@ – IoT SiteWise is processing your request to import your
--     data from Amazon S3.
--
-- -   @COMPLETED@ – IoT SiteWise successfully completed your request to
--     import data from Amazon S3.
--
-- -   @FAILED@ – IoT SiteWise couldn\'t process your request to import
--     data from Amazon S3. You can use logs saved in the specified error
--     report location in Amazon S3 to troubleshoot issues.
--
-- -   @COMPLETED_WITH_FAILURES@ – IoT SiteWise completed your request to
--     import data from Amazon S3 with errors. You can use logs saved in
--     the specified error report location in Amazon S3 to troubleshoot
--     issues.
newJobSummary ::
  -- | 'id'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'status'
  JobStatus ->
  JobSummary
newJobSummary :: Text -> Text -> JobStatus -> JobSummary
newJobSummary Text
pId_ Text
pName_ JobStatus
pStatus_ =
  JobSummary'
    { $sel:id:JobSummary' :: Text
id = Text
pId_,
      $sel:name:JobSummary' :: Text
name = Text
pName_,
      $sel:status:JobSummary' :: JobStatus
status = JobStatus
pStatus_
    }

-- | The ID of the job.
jobSummary_id :: Lens.Lens' JobSummary Prelude.Text
jobSummary_id :: Lens' JobSummary Text
jobSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Text
id :: Text
$sel:id:JobSummary' :: JobSummary -> Text
id} -> Text
id) (\s :: JobSummary
s@JobSummary' {} Text
a -> JobSummary
s {$sel:id:JobSummary' :: Text
id = Text
a} :: JobSummary)

-- | The unique name that helps identify the job request.
jobSummary_name :: Lens.Lens' JobSummary Prelude.Text
jobSummary_name :: Lens' JobSummary Text
jobSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {Text
name :: Text
$sel:name:JobSummary' :: JobSummary -> Text
name} -> Text
name) (\s :: JobSummary
s@JobSummary' {} Text
a -> JobSummary
s {$sel:name:JobSummary' :: Text
name = Text
a} :: JobSummary)

-- | The status of the bulk import job can be one of following values.
--
-- -   @PENDING@ – IoT SiteWise is waiting for the current bulk import job
--     to finish.
--
-- -   @CANCELLED@ – The bulk import job has been canceled.
--
-- -   @RUNNING@ – IoT SiteWise is processing your request to import your
--     data from Amazon S3.
--
-- -   @COMPLETED@ – IoT SiteWise successfully completed your request to
--     import data from Amazon S3.
--
-- -   @FAILED@ – IoT SiteWise couldn\'t process your request to import
--     data from Amazon S3. You can use logs saved in the specified error
--     report location in Amazon S3 to troubleshoot issues.
--
-- -   @COMPLETED_WITH_FAILURES@ – IoT SiteWise completed your request to
--     import data from Amazon S3 with errors. You can use logs saved in
--     the specified error report location in Amazon S3 to troubleshoot
--     issues.
jobSummary_status :: Lens.Lens' JobSummary JobStatus
jobSummary_status :: Lens' JobSummary JobStatus
jobSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobSummary' {JobStatus
status :: JobStatus
$sel:status:JobSummary' :: JobSummary -> JobStatus
status} -> JobStatus
status) (\s :: JobSummary
s@JobSummary' {} JobStatus
a -> JobSummary
s {$sel:status:JobSummary' :: JobStatus
status = JobStatus
a} :: JobSummary)

instance Data.FromJSON JobSummary where
  parseJSON :: Value -> Parser JobSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JobSummary"
      ( \Object
x ->
          Text -> Text -> JobStatus -> JobSummary
JobSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
      )

instance Prelude.Hashable JobSummary where
  hashWithSalt :: Int -> JobSummary -> Int
hashWithSalt Int
_salt JobSummary' {Text
JobStatus
status :: JobStatus
name :: Text
id :: Text
$sel:status:JobSummary' :: JobSummary -> JobStatus
$sel:name:JobSummary' :: JobSummary -> Text
$sel:id:JobSummary' :: JobSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` JobStatus
status

instance Prelude.NFData JobSummary where
  rnf :: JobSummary -> ()
rnf JobSummary' {Text
JobStatus
status :: JobStatus
name :: Text
id :: Text
$sel:status:JobSummary' :: JobSummary -> JobStatus
$sel:name:JobSummary' :: JobSummary -> Text
$sel:id:JobSummary' :: JobSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf JobStatus
status