{-# 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.Panorama.Types.PackageListItem
-- 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.Panorama.Types.PackageListItem 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

-- | A package summary.
--
-- /See:/ 'newPackageListItem' smart constructor.
data PackageListItem = PackageListItem'
  { -- | The package\'s ARN.
    PackageListItem -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | When the package was created.
    PackageListItem -> Maybe POSIX
createdTime :: Prelude.Maybe Data.POSIX,
    -- | The package\'s ID.
    PackageListItem -> Maybe Text
packageId :: Prelude.Maybe Prelude.Text,
    -- | The package\'s name.
    PackageListItem -> Maybe Text
packageName :: Prelude.Maybe Prelude.Text,
    -- | The package\'s tags.
    PackageListItem -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (PackageListItem -> PackageListItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageListItem -> PackageListItem -> Bool
$c/= :: PackageListItem -> PackageListItem -> Bool
== :: PackageListItem -> PackageListItem -> Bool
$c== :: PackageListItem -> PackageListItem -> Bool
Prelude.Eq, ReadPrec [PackageListItem]
ReadPrec PackageListItem
Int -> ReadS PackageListItem
ReadS [PackageListItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PackageListItem]
$creadListPrec :: ReadPrec [PackageListItem]
readPrec :: ReadPrec PackageListItem
$creadPrec :: ReadPrec PackageListItem
readList :: ReadS [PackageListItem]
$creadList :: ReadS [PackageListItem]
readsPrec :: Int -> ReadS PackageListItem
$creadsPrec :: Int -> ReadS PackageListItem
Prelude.Read, Int -> PackageListItem -> ShowS
[PackageListItem] -> ShowS
PackageListItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageListItem] -> ShowS
$cshowList :: [PackageListItem] -> ShowS
show :: PackageListItem -> String
$cshow :: PackageListItem -> String
showsPrec :: Int -> PackageListItem -> ShowS
$cshowsPrec :: Int -> PackageListItem -> ShowS
Prelude.Show, forall x. Rep PackageListItem x -> PackageListItem
forall x. PackageListItem -> Rep PackageListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PackageListItem x -> PackageListItem
$cfrom :: forall x. PackageListItem -> Rep PackageListItem x
Prelude.Generic)

-- |
-- Create a value of 'PackageListItem' 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', 'packageListItem_arn' - The package\'s ARN.
--
-- 'createdTime', 'packageListItem_createdTime' - When the package was created.
--
-- 'packageId', 'packageListItem_packageId' - The package\'s ID.
--
-- 'packageName', 'packageListItem_packageName' - The package\'s name.
--
-- 'tags', 'packageListItem_tags' - The package\'s tags.
newPackageListItem ::
  PackageListItem
newPackageListItem :: PackageListItem
newPackageListItem =
  PackageListItem'
    { $sel:arn:PackageListItem' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:PackageListItem' :: Maybe POSIX
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:packageId:PackageListItem' :: Maybe Text
packageId = forall a. Maybe a
Prelude.Nothing,
      $sel:packageName:PackageListItem' :: Maybe Text
packageName = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:PackageListItem' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The package\'s ARN.
packageListItem_arn :: Lens.Lens' PackageListItem (Prelude.Maybe Prelude.Text)
packageListItem_arn :: Lens' PackageListItem (Maybe Text)
packageListItem_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageListItem' {Maybe Text
arn :: Maybe Text
$sel:arn:PackageListItem' :: PackageListItem -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PackageListItem
s@PackageListItem' {} Maybe Text
a -> PackageListItem
s {$sel:arn:PackageListItem' :: Maybe Text
arn = Maybe Text
a} :: PackageListItem)

-- | When the package was created.
packageListItem_createdTime :: Lens.Lens' PackageListItem (Prelude.Maybe Prelude.UTCTime)
packageListItem_createdTime :: Lens' PackageListItem (Maybe UTCTime)
packageListItem_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageListItem' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:PackageListItem' :: PackageListItem -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: PackageListItem
s@PackageListItem' {} Maybe POSIX
a -> PackageListItem
s {$sel:createdTime:PackageListItem' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: PackageListItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The package\'s ID.
packageListItem_packageId :: Lens.Lens' PackageListItem (Prelude.Maybe Prelude.Text)
packageListItem_packageId :: Lens' PackageListItem (Maybe Text)
packageListItem_packageId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageListItem' {Maybe Text
packageId :: Maybe Text
$sel:packageId:PackageListItem' :: PackageListItem -> Maybe Text
packageId} -> Maybe Text
packageId) (\s :: PackageListItem
s@PackageListItem' {} Maybe Text
a -> PackageListItem
s {$sel:packageId:PackageListItem' :: Maybe Text
packageId = Maybe Text
a} :: PackageListItem)

-- | The package\'s name.
packageListItem_packageName :: Lens.Lens' PackageListItem (Prelude.Maybe Prelude.Text)
packageListItem_packageName :: Lens' PackageListItem (Maybe Text)
packageListItem_packageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageListItem' {Maybe Text
packageName :: Maybe Text
$sel:packageName:PackageListItem' :: PackageListItem -> Maybe Text
packageName} -> Maybe Text
packageName) (\s :: PackageListItem
s@PackageListItem' {} Maybe Text
a -> PackageListItem
s {$sel:packageName:PackageListItem' :: Maybe Text
packageName = Maybe Text
a} :: PackageListItem)

-- | The package\'s tags.
packageListItem_tags :: Lens.Lens' PackageListItem (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
packageListItem_tags :: Lens' PackageListItem (Maybe (HashMap Text Text))
packageListItem_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageListItem' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:PackageListItem' :: PackageListItem -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: PackageListItem
s@PackageListItem' {} Maybe (HashMap Text Text)
a -> PackageListItem
s {$sel:tags:PackageListItem' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: PackageListItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON PackageListItem where
  parseJSON :: Value -> Parser PackageListItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PackageListItem"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> PackageListItem
PackageListItem'
            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
"CreatedTime")
            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
"PackageId")
            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
"PackageName")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable PackageListItem where
  hashWithSalt :: Int -> PackageListItem -> Int
hashWithSalt Int
_salt PackageListItem' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
tags :: Maybe (HashMap Text Text)
packageName :: Maybe Text
packageId :: Maybe Text
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:tags:PackageListItem' :: PackageListItem -> Maybe (HashMap Text Text)
$sel:packageName:PackageListItem' :: PackageListItem -> Maybe Text
$sel:packageId:PackageListItem' :: PackageListItem -> Maybe Text
$sel:createdTime:PackageListItem' :: PackageListItem -> Maybe POSIX
$sel:arn:PackageListItem' :: PackageListItem -> 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 POSIX
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData PackageListItem where
  rnf :: PackageListItem -> ()
rnf PackageListItem' {Maybe Text
Maybe (HashMap Text Text)
Maybe POSIX
tags :: Maybe (HashMap Text Text)
packageName :: Maybe Text
packageId :: Maybe Text
createdTime :: Maybe POSIX
arn :: Maybe Text
$sel:tags:PackageListItem' :: PackageListItem -> Maybe (HashMap Text Text)
$sel:packageName:PackageListItem' :: PackageListItem -> Maybe Text
$sel:packageId:PackageListItem' :: PackageListItem -> Maybe Text
$sel:createdTime:PackageListItem' :: PackageListItem -> Maybe POSIX
$sel:arn:PackageListItem' :: PackageListItem -> 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 POSIX
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags