{-# 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.IoTFleetWise.Types.CampaignSummary
-- 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.IoTFleetWise.Types.CampaignSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTFleetWise.Types.CampaignStatus
import qualified Amazonka.Prelude as Prelude

-- | Information about a campaign.
--
-- You can use the API operation to return this information about multiple
-- created campaigns.
--
-- /See:/ 'newCampaignSummary' smart constructor.
data CampaignSummary = CampaignSummary'
  { -- | The Amazon Resource Name (ARN) of a campaign.
    CampaignSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The description of the campaign.
    CampaignSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of a campaign.
    CampaignSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the signal catalog associated with the campaign.
    CampaignSummary -> Maybe Text
signalCatalogArn :: Prelude.Maybe Prelude.Text,
    -- | The state of a campaign. The status can be one of the following:
    --
    -- -   @CREATING@ - Amazon Web Services IoT FleetWise is processing your
    --     request to create the campaign.
    --
    -- -   @WAITING_FOR_APPROVAL@ - After a campaign is created, it enters the
    --     @WAITING_FOR_APPROVAL@ state. To allow Amazon Web Services IoT
    --     FleetWise to deploy the campaign to the target vehicle or fleet, use
    --     the API operation to approve the campaign.
    --
    -- -   @RUNNING@ - The campaign is active.
    --
    -- -   @SUSPENDED@ - The campaign is suspended. To resume the campaign, use
    --     the API operation.
    CampaignSummary -> Maybe CampaignStatus
status :: Prelude.Maybe CampaignStatus,
    -- | The ARN of a vehicle or fleet to which the campaign is deployed.
    CampaignSummary -> Maybe Text
targetArn :: Prelude.Maybe Prelude.Text,
    -- | The time the campaign was created.
    CampaignSummary -> POSIX
creationTime :: Data.POSIX,
    -- | The last time the campaign was modified.
    CampaignSummary -> POSIX
lastModificationTime :: Data.POSIX
  }
  deriving (CampaignSummary -> CampaignSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CampaignSummary -> CampaignSummary -> Bool
$c/= :: CampaignSummary -> CampaignSummary -> Bool
== :: CampaignSummary -> CampaignSummary -> Bool
$c== :: CampaignSummary -> CampaignSummary -> Bool
Prelude.Eq, ReadPrec [CampaignSummary]
ReadPrec CampaignSummary
Int -> ReadS CampaignSummary
ReadS [CampaignSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CampaignSummary]
$creadListPrec :: ReadPrec [CampaignSummary]
readPrec :: ReadPrec CampaignSummary
$creadPrec :: ReadPrec CampaignSummary
readList :: ReadS [CampaignSummary]
$creadList :: ReadS [CampaignSummary]
readsPrec :: Int -> ReadS CampaignSummary
$creadsPrec :: Int -> ReadS CampaignSummary
Prelude.Read, Int -> CampaignSummary -> ShowS
[CampaignSummary] -> ShowS
CampaignSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CampaignSummary] -> ShowS
$cshowList :: [CampaignSummary] -> ShowS
show :: CampaignSummary -> String
$cshow :: CampaignSummary -> String
showsPrec :: Int -> CampaignSummary -> ShowS
$cshowsPrec :: Int -> CampaignSummary -> ShowS
Prelude.Show, forall x. Rep CampaignSummary x -> CampaignSummary
forall x. CampaignSummary -> Rep CampaignSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CampaignSummary x -> CampaignSummary
$cfrom :: forall x. CampaignSummary -> Rep CampaignSummary x
Prelude.Generic)

-- |
-- Create a value of 'CampaignSummary' 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:
--
-- 'arn', 'campaignSummary_arn' - The Amazon Resource Name (ARN) of a campaign.
--
-- 'description', 'campaignSummary_description' - The description of the campaign.
--
-- 'name', 'campaignSummary_name' - The name of a campaign.
--
-- 'signalCatalogArn', 'campaignSummary_signalCatalogArn' - The ARN of the signal catalog associated with the campaign.
--
-- 'status', 'campaignSummary_status' - The state of a campaign. The status can be one of the following:
--
-- -   @CREATING@ - Amazon Web Services IoT FleetWise is processing your
--     request to create the campaign.
--
-- -   @WAITING_FOR_APPROVAL@ - After a campaign is created, it enters the
--     @WAITING_FOR_APPROVAL@ state. To allow Amazon Web Services IoT
--     FleetWise to deploy the campaign to the target vehicle or fleet, use
--     the API operation to approve the campaign.
--
-- -   @RUNNING@ - The campaign is active.
--
-- -   @SUSPENDED@ - The campaign is suspended. To resume the campaign, use
--     the API operation.
--
-- 'targetArn', 'campaignSummary_targetArn' - The ARN of a vehicle or fleet to which the campaign is deployed.
--
-- 'creationTime', 'campaignSummary_creationTime' - The time the campaign was created.
--
-- 'lastModificationTime', 'campaignSummary_lastModificationTime' - The last time the campaign was modified.
newCampaignSummary ::
  -- | 'creationTime'
  Prelude.UTCTime ->
  -- | 'lastModificationTime'
  Prelude.UTCTime ->
  CampaignSummary
newCampaignSummary :: UTCTime -> UTCTime -> CampaignSummary
newCampaignSummary
  UTCTime
pCreationTime_
  UTCTime
pLastModificationTime_ =
    CampaignSummary'
      { $sel:arn:CampaignSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
        $sel:description:CampaignSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:name:CampaignSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
        $sel:signalCatalogArn:CampaignSummary' :: Maybe Text
signalCatalogArn = forall a. Maybe a
Prelude.Nothing,
        $sel:status:CampaignSummary' :: Maybe CampaignStatus
status = forall a. Maybe a
Prelude.Nothing,
        $sel:targetArn:CampaignSummary' :: Maybe Text
targetArn = forall a. Maybe a
Prelude.Nothing,
        $sel:creationTime:CampaignSummary' :: POSIX
creationTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationTime_,
        $sel:lastModificationTime:CampaignSummary' :: POSIX
lastModificationTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastModificationTime_
      }

-- | The Amazon Resource Name (ARN) of a campaign.
campaignSummary_arn :: Lens.Lens' CampaignSummary (Prelude.Maybe Prelude.Text)
campaignSummary_arn :: Lens' CampaignSummary (Maybe Text)
campaignSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:CampaignSummary' :: CampaignSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CampaignSummary
s@CampaignSummary' {} Maybe Text
a -> CampaignSummary
s {$sel:arn:CampaignSummary' :: Maybe Text
arn = Maybe Text
a} :: CampaignSummary)

-- | The description of the campaign.
campaignSummary_description :: Lens.Lens' CampaignSummary (Prelude.Maybe Prelude.Text)
campaignSummary_description :: Lens' CampaignSummary (Maybe Text)
campaignSummary_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {Maybe Text
description :: Maybe Text
$sel:description:CampaignSummary' :: CampaignSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: CampaignSummary
s@CampaignSummary' {} Maybe Text
a -> CampaignSummary
s {$sel:description:CampaignSummary' :: Maybe Text
description = Maybe Text
a} :: CampaignSummary)

-- | The name of a campaign.
campaignSummary_name :: Lens.Lens' CampaignSummary (Prelude.Maybe Prelude.Text)
campaignSummary_name :: Lens' CampaignSummary (Maybe Text)
campaignSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {Maybe Text
name :: Maybe Text
$sel:name:CampaignSummary' :: CampaignSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: CampaignSummary
s@CampaignSummary' {} Maybe Text
a -> CampaignSummary
s {$sel:name:CampaignSummary' :: Maybe Text
name = Maybe Text
a} :: CampaignSummary)

-- | The ARN of the signal catalog associated with the campaign.
campaignSummary_signalCatalogArn :: Lens.Lens' CampaignSummary (Prelude.Maybe Prelude.Text)
campaignSummary_signalCatalogArn :: Lens' CampaignSummary (Maybe Text)
campaignSummary_signalCatalogArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {Maybe Text
signalCatalogArn :: Maybe Text
$sel:signalCatalogArn:CampaignSummary' :: CampaignSummary -> Maybe Text
signalCatalogArn} -> Maybe Text
signalCatalogArn) (\s :: CampaignSummary
s@CampaignSummary' {} Maybe Text
a -> CampaignSummary
s {$sel:signalCatalogArn:CampaignSummary' :: Maybe Text
signalCatalogArn = Maybe Text
a} :: CampaignSummary)

-- | The state of a campaign. The status can be one of the following:
--
-- -   @CREATING@ - Amazon Web Services IoT FleetWise is processing your
--     request to create the campaign.
--
-- -   @WAITING_FOR_APPROVAL@ - After a campaign is created, it enters the
--     @WAITING_FOR_APPROVAL@ state. To allow Amazon Web Services IoT
--     FleetWise to deploy the campaign to the target vehicle or fleet, use
--     the API operation to approve the campaign.
--
-- -   @RUNNING@ - The campaign is active.
--
-- -   @SUSPENDED@ - The campaign is suspended. To resume the campaign, use
--     the API operation.
campaignSummary_status :: Lens.Lens' CampaignSummary (Prelude.Maybe CampaignStatus)
campaignSummary_status :: Lens' CampaignSummary (Maybe CampaignStatus)
campaignSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {Maybe CampaignStatus
status :: Maybe CampaignStatus
$sel:status:CampaignSummary' :: CampaignSummary -> Maybe CampaignStatus
status} -> Maybe CampaignStatus
status) (\s :: CampaignSummary
s@CampaignSummary' {} Maybe CampaignStatus
a -> CampaignSummary
s {$sel:status:CampaignSummary' :: Maybe CampaignStatus
status = Maybe CampaignStatus
a} :: CampaignSummary)

-- | The ARN of a vehicle or fleet to which the campaign is deployed.
campaignSummary_targetArn :: Lens.Lens' CampaignSummary (Prelude.Maybe Prelude.Text)
campaignSummary_targetArn :: Lens' CampaignSummary (Maybe Text)
campaignSummary_targetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {Maybe Text
targetArn :: Maybe Text
$sel:targetArn:CampaignSummary' :: CampaignSummary -> Maybe Text
targetArn} -> Maybe Text
targetArn) (\s :: CampaignSummary
s@CampaignSummary' {} Maybe Text
a -> CampaignSummary
s {$sel:targetArn:CampaignSummary' :: Maybe Text
targetArn = Maybe Text
a} :: CampaignSummary)

-- | The time the campaign was created.
campaignSummary_creationTime :: Lens.Lens' CampaignSummary Prelude.UTCTime
campaignSummary_creationTime :: Lens' CampaignSummary UTCTime
campaignSummary_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {POSIX
creationTime :: POSIX
$sel:creationTime:CampaignSummary' :: CampaignSummary -> POSIX
creationTime} -> POSIX
creationTime) (\s :: CampaignSummary
s@CampaignSummary' {} POSIX
a -> CampaignSummary
s {$sel:creationTime:CampaignSummary' :: POSIX
creationTime = POSIX
a} :: CampaignSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The last time the campaign was modified.
campaignSummary_lastModificationTime :: Lens.Lens' CampaignSummary Prelude.UTCTime
campaignSummary_lastModificationTime :: Lens' CampaignSummary UTCTime
campaignSummary_lastModificationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CampaignSummary' {POSIX
lastModificationTime :: POSIX
$sel:lastModificationTime:CampaignSummary' :: CampaignSummary -> POSIX
lastModificationTime} -> POSIX
lastModificationTime) (\s :: CampaignSummary
s@CampaignSummary' {} POSIX
a -> CampaignSummary
s {$sel:lastModificationTime:CampaignSummary' :: POSIX
lastModificationTime = POSIX
a} :: CampaignSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON CampaignSummary where
  parseJSON :: Value -> Parser CampaignSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CampaignSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe CampaignStatus
-> Maybe Text
-> POSIX
-> POSIX
-> CampaignSummary
CampaignSummary'
            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
"arn")
            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
"description")
            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
"name")
            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
"signalCatalogArn")
            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
"status")
            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
"targetArn")
            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
"creationTime")
            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
"lastModificationTime")
      )

instance Prelude.Hashable CampaignSummary where
  hashWithSalt :: Int -> CampaignSummary -> Int
hashWithSalt Int
_salt CampaignSummary' {Maybe Text
Maybe CampaignStatus
POSIX
lastModificationTime :: POSIX
creationTime :: POSIX
targetArn :: Maybe Text
status :: Maybe CampaignStatus
signalCatalogArn :: Maybe Text
name :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:lastModificationTime:CampaignSummary' :: CampaignSummary -> POSIX
$sel:creationTime:CampaignSummary' :: CampaignSummary -> POSIX
$sel:targetArn:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:status:CampaignSummary' :: CampaignSummary -> Maybe CampaignStatus
$sel:signalCatalogArn:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:name:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:description:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:arn:CampaignSummary' :: CampaignSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
signalCatalogArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CampaignStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
creationTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
lastModificationTime

instance Prelude.NFData CampaignSummary where
  rnf :: CampaignSummary -> ()
rnf CampaignSummary' {Maybe Text
Maybe CampaignStatus
POSIX
lastModificationTime :: POSIX
creationTime :: POSIX
targetArn :: Maybe Text
status :: Maybe CampaignStatus
signalCatalogArn :: Maybe Text
name :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:lastModificationTime:CampaignSummary' :: CampaignSummary -> POSIX
$sel:creationTime:CampaignSummary' :: CampaignSummary -> POSIX
$sel:targetArn:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:status:CampaignSummary' :: CampaignSummary -> Maybe CampaignStatus
$sel:signalCatalogArn:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:name:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:description:CampaignSummary' :: CampaignSummary -> Maybe Text
$sel:arn:CampaignSummary' :: CampaignSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
signalCatalogArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CampaignStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
lastModificationTime