{-# 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.ElasticSearch.Types.PackageDetails
-- 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.ElasticSearch.Types.PackageDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.ErrorDetails
import Amazonka.ElasticSearch.Types.PackageStatus
import Amazonka.ElasticSearch.Types.PackageType
import qualified Amazonka.Prelude as Prelude

-- | Basic information about a package.
--
-- /See:/ 'newPackageDetails' smart constructor.
data PackageDetails = PackageDetails'
  { PackageDetails -> Maybe Text
availablePackageVersion :: Prelude.Maybe Prelude.Text,
    -- | Timestamp which tells creation date of the package.
    PackageDetails -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | Additional information if the package is in an error state. Null
    -- otherwise.
    PackageDetails -> Maybe ErrorDetails
errorDetails :: Prelude.Maybe ErrorDetails,
    PackageDetails -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Data.POSIX,
    -- | User-specified description of the package.
    PackageDetails -> Maybe Text
packageDescription :: Prelude.Maybe Prelude.Text,
    -- | Internal ID of the package.
    PackageDetails -> Maybe Text
packageID :: Prelude.Maybe Prelude.Text,
    -- | User specified name of the package.
    PackageDetails -> Maybe Text
packageName :: Prelude.Maybe Prelude.Text,
    -- | Current state of the package. Values are
    -- COPYING\/COPY_FAILED\/AVAILABLE\/DELETING\/DELETE_FAILED
    PackageDetails -> Maybe PackageStatus
packageStatus :: Prelude.Maybe PackageStatus,
    -- | Currently supports only TXT-DICTIONARY.
    PackageDetails -> Maybe PackageType
packageType :: Prelude.Maybe PackageType
  }
  deriving (PackageDetails -> PackageDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageDetails -> PackageDetails -> Bool
$c/= :: PackageDetails -> PackageDetails -> Bool
== :: PackageDetails -> PackageDetails -> Bool
$c== :: PackageDetails -> PackageDetails -> Bool
Prelude.Eq, ReadPrec [PackageDetails]
ReadPrec PackageDetails
Int -> ReadS PackageDetails
ReadS [PackageDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PackageDetails]
$creadListPrec :: ReadPrec [PackageDetails]
readPrec :: ReadPrec PackageDetails
$creadPrec :: ReadPrec PackageDetails
readList :: ReadS [PackageDetails]
$creadList :: ReadS [PackageDetails]
readsPrec :: Int -> ReadS PackageDetails
$creadsPrec :: Int -> ReadS PackageDetails
Prelude.Read, Int -> PackageDetails -> ShowS
[PackageDetails] -> ShowS
PackageDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageDetails] -> ShowS
$cshowList :: [PackageDetails] -> ShowS
show :: PackageDetails -> String
$cshow :: PackageDetails -> String
showsPrec :: Int -> PackageDetails -> ShowS
$cshowsPrec :: Int -> PackageDetails -> ShowS
Prelude.Show, forall x. Rep PackageDetails x -> PackageDetails
forall x. PackageDetails -> Rep PackageDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PackageDetails x -> PackageDetails
$cfrom :: forall x. PackageDetails -> Rep PackageDetails x
Prelude.Generic)

-- |
-- Create a value of 'PackageDetails' 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:
--
-- 'availablePackageVersion', 'packageDetails_availablePackageVersion' - Undocumented member.
--
-- 'createdAt', 'packageDetails_createdAt' - Timestamp which tells creation date of the package.
--
-- 'errorDetails', 'packageDetails_errorDetails' - Additional information if the package is in an error state. Null
-- otherwise.
--
-- 'lastUpdatedAt', 'packageDetails_lastUpdatedAt' - Undocumented member.
--
-- 'packageDescription', 'packageDetails_packageDescription' - User-specified description of the package.
--
-- 'packageID', 'packageDetails_packageID' - Internal ID of the package.
--
-- 'packageName', 'packageDetails_packageName' - User specified name of the package.
--
-- 'packageStatus', 'packageDetails_packageStatus' - Current state of the package. Values are
-- COPYING\/COPY_FAILED\/AVAILABLE\/DELETING\/DELETE_FAILED
--
-- 'packageType', 'packageDetails_packageType' - Currently supports only TXT-DICTIONARY.
newPackageDetails ::
  PackageDetails
newPackageDetails :: PackageDetails
newPackageDetails =
  PackageDetails'
    { $sel:availablePackageVersion:PackageDetails' :: Maybe Text
availablePackageVersion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:PackageDetails' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:errorDetails:PackageDetails' :: Maybe ErrorDetails
errorDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:PackageDetails' :: Maybe POSIX
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:packageDescription:PackageDetails' :: Maybe Text
packageDescription = forall a. Maybe a
Prelude.Nothing,
      $sel:packageID:PackageDetails' :: Maybe Text
packageID = forall a. Maybe a
Prelude.Nothing,
      $sel:packageName:PackageDetails' :: Maybe Text
packageName = forall a. Maybe a
Prelude.Nothing,
      $sel:packageStatus:PackageDetails' :: Maybe PackageStatus
packageStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:packageType:PackageDetails' :: Maybe PackageType
packageType = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
packageDetails_availablePackageVersion :: Lens.Lens' PackageDetails (Prelude.Maybe Prelude.Text)
packageDetails_availablePackageVersion :: Lens' PackageDetails (Maybe Text)
packageDetails_availablePackageVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe Text
availablePackageVersion :: Maybe Text
$sel:availablePackageVersion:PackageDetails' :: PackageDetails -> Maybe Text
availablePackageVersion} -> Maybe Text
availablePackageVersion) (\s :: PackageDetails
s@PackageDetails' {} Maybe Text
a -> PackageDetails
s {$sel:availablePackageVersion:PackageDetails' :: Maybe Text
availablePackageVersion = Maybe Text
a} :: PackageDetails)

-- | Timestamp which tells creation date of the package.
packageDetails_createdAt :: Lens.Lens' PackageDetails (Prelude.Maybe Prelude.UTCTime)
packageDetails_createdAt :: Lens' PackageDetails (Maybe UTCTime)
packageDetails_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:PackageDetails' :: PackageDetails -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: PackageDetails
s@PackageDetails' {} Maybe POSIX
a -> PackageDetails
s {$sel:createdAt:PackageDetails' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: PackageDetails) 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

-- | Additional information if the package is in an error state. Null
-- otherwise.
packageDetails_errorDetails :: Lens.Lens' PackageDetails (Prelude.Maybe ErrorDetails)
packageDetails_errorDetails :: Lens' PackageDetails (Maybe ErrorDetails)
packageDetails_errorDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe ErrorDetails
errorDetails :: Maybe ErrorDetails
$sel:errorDetails:PackageDetails' :: PackageDetails -> Maybe ErrorDetails
errorDetails} -> Maybe ErrorDetails
errorDetails) (\s :: PackageDetails
s@PackageDetails' {} Maybe ErrorDetails
a -> PackageDetails
s {$sel:errorDetails:PackageDetails' :: Maybe ErrorDetails
errorDetails = Maybe ErrorDetails
a} :: PackageDetails)

-- | Undocumented member.
packageDetails_lastUpdatedAt :: Lens.Lens' PackageDetails (Prelude.Maybe Prelude.UTCTime)
packageDetails_lastUpdatedAt :: Lens' PackageDetails (Maybe UTCTime)
packageDetails_lastUpdatedAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:PackageDetails' :: PackageDetails -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: PackageDetails
s@PackageDetails' {} Maybe POSIX
a -> PackageDetails
s {$sel:lastUpdatedAt:PackageDetails' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: PackageDetails) 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

-- | User-specified description of the package.
packageDetails_packageDescription :: Lens.Lens' PackageDetails (Prelude.Maybe Prelude.Text)
packageDetails_packageDescription :: Lens' PackageDetails (Maybe Text)
packageDetails_packageDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe Text
packageDescription :: Maybe Text
$sel:packageDescription:PackageDetails' :: PackageDetails -> Maybe Text
packageDescription} -> Maybe Text
packageDescription) (\s :: PackageDetails
s@PackageDetails' {} Maybe Text
a -> PackageDetails
s {$sel:packageDescription:PackageDetails' :: Maybe Text
packageDescription = Maybe Text
a} :: PackageDetails)

-- | Internal ID of the package.
packageDetails_packageID :: Lens.Lens' PackageDetails (Prelude.Maybe Prelude.Text)
packageDetails_packageID :: Lens' PackageDetails (Maybe Text)
packageDetails_packageID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe Text
packageID :: Maybe Text
$sel:packageID:PackageDetails' :: PackageDetails -> Maybe Text
packageID} -> Maybe Text
packageID) (\s :: PackageDetails
s@PackageDetails' {} Maybe Text
a -> PackageDetails
s {$sel:packageID:PackageDetails' :: Maybe Text
packageID = Maybe Text
a} :: PackageDetails)

-- | User specified name of the package.
packageDetails_packageName :: Lens.Lens' PackageDetails (Prelude.Maybe Prelude.Text)
packageDetails_packageName :: Lens' PackageDetails (Maybe Text)
packageDetails_packageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe Text
packageName :: Maybe Text
$sel:packageName:PackageDetails' :: PackageDetails -> Maybe Text
packageName} -> Maybe Text
packageName) (\s :: PackageDetails
s@PackageDetails' {} Maybe Text
a -> PackageDetails
s {$sel:packageName:PackageDetails' :: Maybe Text
packageName = Maybe Text
a} :: PackageDetails)

-- | Current state of the package. Values are
-- COPYING\/COPY_FAILED\/AVAILABLE\/DELETING\/DELETE_FAILED
packageDetails_packageStatus :: Lens.Lens' PackageDetails (Prelude.Maybe PackageStatus)
packageDetails_packageStatus :: Lens' PackageDetails (Maybe PackageStatus)
packageDetails_packageStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe PackageStatus
packageStatus :: Maybe PackageStatus
$sel:packageStatus:PackageDetails' :: PackageDetails -> Maybe PackageStatus
packageStatus} -> Maybe PackageStatus
packageStatus) (\s :: PackageDetails
s@PackageDetails' {} Maybe PackageStatus
a -> PackageDetails
s {$sel:packageStatus:PackageDetails' :: Maybe PackageStatus
packageStatus = Maybe PackageStatus
a} :: PackageDetails)

-- | Currently supports only TXT-DICTIONARY.
packageDetails_packageType :: Lens.Lens' PackageDetails (Prelude.Maybe PackageType)
packageDetails_packageType :: Lens' PackageDetails (Maybe PackageType)
packageDetails_packageType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PackageDetails' {Maybe PackageType
packageType :: Maybe PackageType
$sel:packageType:PackageDetails' :: PackageDetails -> Maybe PackageType
packageType} -> Maybe PackageType
packageType) (\s :: PackageDetails
s@PackageDetails' {} Maybe PackageType
a -> PackageDetails
s {$sel:packageType:PackageDetails' :: Maybe PackageType
packageType = Maybe PackageType
a} :: PackageDetails)

instance Data.FromJSON PackageDetails where
  parseJSON :: Value -> Parser PackageDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PackageDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe ErrorDetails
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PackageStatus
-> Maybe PackageType
-> PackageDetails
PackageDetails'
            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
"AvailablePackageVersion")
            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
"CreatedAt")
            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
"ErrorDetails")
            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
"LastUpdatedAt")
            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
"PackageDescription")
            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
"PackageStatus")
            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
"PackageType")
      )

instance Prelude.Hashable PackageDetails where
  hashWithSalt :: Int -> PackageDetails -> Int
hashWithSalt Int
_salt PackageDetails' {Maybe Text
Maybe POSIX
Maybe ErrorDetails
Maybe PackageStatus
Maybe PackageType
packageType :: Maybe PackageType
packageStatus :: Maybe PackageStatus
packageName :: Maybe Text
packageID :: Maybe Text
packageDescription :: Maybe Text
lastUpdatedAt :: Maybe POSIX
errorDetails :: Maybe ErrorDetails
createdAt :: Maybe POSIX
availablePackageVersion :: Maybe Text
$sel:packageType:PackageDetails' :: PackageDetails -> Maybe PackageType
$sel:packageStatus:PackageDetails' :: PackageDetails -> Maybe PackageStatus
$sel:packageName:PackageDetails' :: PackageDetails -> Maybe Text
$sel:packageID:PackageDetails' :: PackageDetails -> Maybe Text
$sel:packageDescription:PackageDetails' :: PackageDetails -> Maybe Text
$sel:lastUpdatedAt:PackageDetails' :: PackageDetails -> Maybe POSIX
$sel:errorDetails:PackageDetails' :: PackageDetails -> Maybe ErrorDetails
$sel:createdAt:PackageDetails' :: PackageDetails -> Maybe POSIX
$sel:availablePackageVersion:PackageDetails' :: PackageDetails -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availablePackageVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorDetails
errorDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageDescription
      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 PackageStatus
packageStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PackageType
packageType

instance Prelude.NFData PackageDetails where
  rnf :: PackageDetails -> ()
rnf PackageDetails' {Maybe Text
Maybe POSIX
Maybe ErrorDetails
Maybe PackageStatus
Maybe PackageType
packageType :: Maybe PackageType
packageStatus :: Maybe PackageStatus
packageName :: Maybe Text
packageID :: Maybe Text
packageDescription :: Maybe Text
lastUpdatedAt :: Maybe POSIX
errorDetails :: Maybe ErrorDetails
createdAt :: Maybe POSIX
availablePackageVersion :: Maybe Text
$sel:packageType:PackageDetails' :: PackageDetails -> Maybe PackageType
$sel:packageStatus:PackageDetails' :: PackageDetails -> Maybe PackageStatus
$sel:packageName:PackageDetails' :: PackageDetails -> Maybe Text
$sel:packageID:PackageDetails' :: PackageDetails -> Maybe Text
$sel:packageDescription:PackageDetails' :: PackageDetails -> Maybe Text
$sel:lastUpdatedAt:PackageDetails' :: PackageDetails -> Maybe POSIX
$sel:errorDetails:PackageDetails' :: PackageDetails -> Maybe ErrorDetails
$sel:createdAt:PackageDetails' :: PackageDetails -> Maybe POSIX
$sel:availablePackageVersion:PackageDetails' :: PackageDetails -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availablePackageVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorDetails
errorDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageDescription
      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 PackageStatus
packageStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PackageType
packageType