{-# 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.Glue.Types.MetadataInfo
-- 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.Glue.Types.MetadataInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.OtherMetadataValueListItem
import qualified Amazonka.Prelude as Prelude

-- | A structure containing metadata information for a schema version.
--
-- /See:/ 'newMetadataInfo' smart constructor.
data MetadataInfo = MetadataInfo'
  { -- | The time at which the entry was created.
    MetadataInfo -> Maybe Text
createdTime :: Prelude.Maybe Prelude.Text,
    -- | The metadata key’s corresponding value.
    MetadataInfo -> Maybe Text
metadataValue :: Prelude.Maybe Prelude.Text,
    -- | Other metadata belonging to the same metadata key.
    MetadataInfo -> Maybe [OtherMetadataValueListItem]
otherMetadataValueList :: Prelude.Maybe [OtherMetadataValueListItem]
  }
  deriving (MetadataInfo -> MetadataInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetadataInfo -> MetadataInfo -> Bool
$c/= :: MetadataInfo -> MetadataInfo -> Bool
== :: MetadataInfo -> MetadataInfo -> Bool
$c== :: MetadataInfo -> MetadataInfo -> Bool
Prelude.Eq, ReadPrec [MetadataInfo]
ReadPrec MetadataInfo
Int -> ReadS MetadataInfo
ReadS [MetadataInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetadataInfo]
$creadListPrec :: ReadPrec [MetadataInfo]
readPrec :: ReadPrec MetadataInfo
$creadPrec :: ReadPrec MetadataInfo
readList :: ReadS [MetadataInfo]
$creadList :: ReadS [MetadataInfo]
readsPrec :: Int -> ReadS MetadataInfo
$creadsPrec :: Int -> ReadS MetadataInfo
Prelude.Read, Int -> MetadataInfo -> ShowS
[MetadataInfo] -> ShowS
MetadataInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetadataInfo] -> ShowS
$cshowList :: [MetadataInfo] -> ShowS
show :: MetadataInfo -> String
$cshow :: MetadataInfo -> String
showsPrec :: Int -> MetadataInfo -> ShowS
$cshowsPrec :: Int -> MetadataInfo -> ShowS
Prelude.Show, forall x. Rep MetadataInfo x -> MetadataInfo
forall x. MetadataInfo -> Rep MetadataInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetadataInfo x -> MetadataInfo
$cfrom :: forall x. MetadataInfo -> Rep MetadataInfo x
Prelude.Generic)

-- |
-- Create a value of 'MetadataInfo' 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:
--
-- 'createdTime', 'metadataInfo_createdTime' - The time at which the entry was created.
--
-- 'metadataValue', 'metadataInfo_metadataValue' - The metadata key’s corresponding value.
--
-- 'otherMetadataValueList', 'metadataInfo_otherMetadataValueList' - Other metadata belonging to the same metadata key.
newMetadataInfo ::
  MetadataInfo
newMetadataInfo :: MetadataInfo
newMetadataInfo =
  MetadataInfo'
    { $sel:createdTime:MetadataInfo' :: Maybe Text
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:metadataValue:MetadataInfo' :: Maybe Text
metadataValue = forall a. Maybe a
Prelude.Nothing,
      $sel:otherMetadataValueList:MetadataInfo' :: Maybe [OtherMetadataValueListItem]
otherMetadataValueList = forall a. Maybe a
Prelude.Nothing
    }

-- | The time at which the entry was created.
metadataInfo_createdTime :: Lens.Lens' MetadataInfo (Prelude.Maybe Prelude.Text)
metadataInfo_createdTime :: Lens' MetadataInfo (Maybe Text)
metadataInfo_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataInfo' {Maybe Text
createdTime :: Maybe Text
$sel:createdTime:MetadataInfo' :: MetadataInfo -> Maybe Text
createdTime} -> Maybe Text
createdTime) (\s :: MetadataInfo
s@MetadataInfo' {} Maybe Text
a -> MetadataInfo
s {$sel:createdTime:MetadataInfo' :: Maybe Text
createdTime = Maybe Text
a} :: MetadataInfo)

-- | The metadata key’s corresponding value.
metadataInfo_metadataValue :: Lens.Lens' MetadataInfo (Prelude.Maybe Prelude.Text)
metadataInfo_metadataValue :: Lens' MetadataInfo (Maybe Text)
metadataInfo_metadataValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataInfo' {Maybe Text
metadataValue :: Maybe Text
$sel:metadataValue:MetadataInfo' :: MetadataInfo -> Maybe Text
metadataValue} -> Maybe Text
metadataValue) (\s :: MetadataInfo
s@MetadataInfo' {} Maybe Text
a -> MetadataInfo
s {$sel:metadataValue:MetadataInfo' :: Maybe Text
metadataValue = Maybe Text
a} :: MetadataInfo)

-- | Other metadata belonging to the same metadata key.
metadataInfo_otherMetadataValueList :: Lens.Lens' MetadataInfo (Prelude.Maybe [OtherMetadataValueListItem])
metadataInfo_otherMetadataValueList :: Lens' MetadataInfo (Maybe [OtherMetadataValueListItem])
metadataInfo_otherMetadataValueList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataInfo' {Maybe [OtherMetadataValueListItem]
otherMetadataValueList :: Maybe [OtherMetadataValueListItem]
$sel:otherMetadataValueList:MetadataInfo' :: MetadataInfo -> Maybe [OtherMetadataValueListItem]
otherMetadataValueList} -> Maybe [OtherMetadataValueListItem]
otherMetadataValueList) (\s :: MetadataInfo
s@MetadataInfo' {} Maybe [OtherMetadataValueListItem]
a -> MetadataInfo
s {$sel:otherMetadataValueList:MetadataInfo' :: Maybe [OtherMetadataValueListItem]
otherMetadataValueList = Maybe [OtherMetadataValueListItem]
a} :: MetadataInfo) 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 MetadataInfo where
  parseJSON :: Value -> Parser MetadataInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"MetadataInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe [OtherMetadataValueListItem] -> MetadataInfo
MetadataInfo'
            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
"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
"MetadataValue")
            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
"OtherMetadataValueList"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable MetadataInfo where
  hashWithSalt :: Int -> MetadataInfo -> Int
hashWithSalt Int
_salt MetadataInfo' {Maybe [OtherMetadataValueListItem]
Maybe Text
otherMetadataValueList :: Maybe [OtherMetadataValueListItem]
metadataValue :: Maybe Text
createdTime :: Maybe Text
$sel:otherMetadataValueList:MetadataInfo' :: MetadataInfo -> Maybe [OtherMetadataValueListItem]
$sel:metadataValue:MetadataInfo' :: MetadataInfo -> Maybe Text
$sel:createdTime:MetadataInfo' :: MetadataInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
metadataValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OtherMetadataValueListItem]
otherMetadataValueList

instance Prelude.NFData MetadataInfo where
  rnf :: MetadataInfo -> ()
rnf MetadataInfo' {Maybe [OtherMetadataValueListItem]
Maybe Text
otherMetadataValueList :: Maybe [OtherMetadataValueListItem]
metadataValue :: Maybe Text
createdTime :: Maybe Text
$sel:otherMetadataValueList:MetadataInfo' :: MetadataInfo -> Maybe [OtherMetadataValueListItem]
$sel:metadataValue:MetadataInfo' :: MetadataInfo -> Maybe Text
$sel:createdTime:MetadataInfo' :: MetadataInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
metadataValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OtherMetadataValueListItem]
otherMetadataValueList