{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Glue.Types.MetadataInfo where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.OtherMetadataValueListItem
import qualified Amazonka.Lens as Lens
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,
    -- | Other metadata belonging to the same metadata key.
    MetadataInfo -> Maybe [OtherMetadataValueListItem]
otherMetadataValueList :: Prelude.Maybe [OtherMetadataValueListItem],
    -- | The metadata key’s corresponding value.
    MetadataInfo -> Maybe Text
metadataValue :: Prelude.Maybe Prelude.Text
  }
  deriving (MetadataInfo -> MetadataInfo -> Bool
(MetadataInfo -> MetadataInfo -> Bool)
-> (MetadataInfo -> MetadataInfo -> Bool) -> Eq MetadataInfo
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]
(Int -> ReadS MetadataInfo)
-> ReadS [MetadataInfo]
-> ReadPrec MetadataInfo
-> ReadPrec [MetadataInfo]
-> Read 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
(Int -> MetadataInfo -> ShowS)
-> (MetadataInfo -> String)
-> ([MetadataInfo] -> ShowS)
-> Show MetadataInfo
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. MetadataInfo -> Rep MetadataInfo x)
-> (forall x. Rep MetadataInfo x -> MetadataInfo)
-> Generic MetadataInfo
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.
--
-- 'otherMetadataValueList', 'metadataInfo_otherMetadataValueList' - Other metadata belonging to the same metadata key.
--
-- 'metadataValue', 'metadataInfo_metadataValue' - The metadata key’s corresponding value.
newMetadataInfo ::
  MetadataInfo
newMetadataInfo :: MetadataInfo
newMetadataInfo =
  MetadataInfo' :: Maybe Text
-> Maybe [OtherMetadataValueListItem] -> Maybe Text -> MetadataInfo
MetadataInfo'
    { $sel:createdTime:MetadataInfo' :: Maybe Text
createdTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:otherMetadataValueList:MetadataInfo' :: Maybe [OtherMetadataValueListItem]
otherMetadataValueList = Maybe [OtherMetadataValueListItem]
forall a. Maybe a
Prelude.Nothing,
      $sel:metadataValue:MetadataInfo' :: Maybe Text
metadataValue = Maybe Text
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 :: (Maybe Text -> f (Maybe Text)) -> MetadataInfo -> f MetadataInfo
metadataInfo_createdTime = (MetadataInfo -> Maybe Text)
-> (MetadataInfo -> Maybe Text -> MetadataInfo)
-> Lens MetadataInfo MetadataInfo (Maybe Text) (Maybe Text)
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)

-- | Other metadata belonging to the same metadata key.
metadataInfo_otherMetadataValueList :: Lens.Lens' MetadataInfo (Prelude.Maybe [OtherMetadataValueListItem])
metadataInfo_otherMetadataValueList :: (Maybe [OtherMetadataValueListItem]
 -> f (Maybe [OtherMetadataValueListItem]))
-> MetadataInfo -> f MetadataInfo
metadataInfo_otherMetadataValueList = (MetadataInfo -> Maybe [OtherMetadataValueListItem])
-> (MetadataInfo
    -> Maybe [OtherMetadataValueListItem] -> MetadataInfo)
-> Lens
     MetadataInfo
     MetadataInfo
     (Maybe [OtherMetadataValueListItem])
     (Maybe [OtherMetadataValueListItem])
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) ((Maybe [OtherMetadataValueListItem]
  -> f (Maybe [OtherMetadataValueListItem]))
 -> MetadataInfo -> f MetadataInfo)
-> ((Maybe [OtherMetadataValueListItem]
     -> f (Maybe [OtherMetadataValueListItem]))
    -> Maybe [OtherMetadataValueListItem]
    -> f (Maybe [OtherMetadataValueListItem]))
-> (Maybe [OtherMetadataValueListItem]
    -> f (Maybe [OtherMetadataValueListItem]))
-> MetadataInfo
-> f MetadataInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OtherMetadataValueListItem]
  [OtherMetadataValueListItem]
  [OtherMetadataValueListItem]
  [OtherMetadataValueListItem]
-> Iso
     (Maybe [OtherMetadataValueListItem])
     (Maybe [OtherMetadataValueListItem])
     (Maybe [OtherMetadataValueListItem])
     (Maybe [OtherMetadataValueListItem])
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 AnIso
  [OtherMetadataValueListItem]
  [OtherMetadataValueListItem]
  [OtherMetadataValueListItem]
  [OtherMetadataValueListItem]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The metadata key’s corresponding value.
metadataInfo_metadataValue :: Lens.Lens' MetadataInfo (Prelude.Maybe Prelude.Text)
metadataInfo_metadataValue :: (Maybe Text -> f (Maybe Text)) -> MetadataInfo -> f MetadataInfo
metadataInfo_metadataValue = (MetadataInfo -> Maybe Text)
-> (MetadataInfo -> Maybe Text -> MetadataInfo)
-> Lens MetadataInfo MetadataInfo (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON MetadataInfo where
  parseJSON :: Value -> Parser MetadataInfo
parseJSON =
    String
-> (Object -> Parser MetadataInfo) -> Value -> Parser MetadataInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MetadataInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe [OtherMetadataValueListItem] -> Maybe Text -> MetadataInfo
MetadataInfo'
            (Maybe Text
 -> Maybe [OtherMetadataValueListItem]
 -> Maybe Text
 -> MetadataInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe [OtherMetadataValueListItem] -> Maybe Text -> MetadataInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedTime")
            Parser
  (Maybe [OtherMetadataValueListItem] -> Maybe Text -> MetadataInfo)
-> Parser (Maybe [OtherMetadataValueListItem])
-> Parser (Maybe Text -> MetadataInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Parser (Maybe (Maybe [OtherMetadataValueListItem]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OtherMetadataValueList"
                            Parser (Maybe (Maybe [OtherMetadataValueListItem]))
-> Maybe [OtherMetadataValueListItem]
-> Parser (Maybe [OtherMetadataValueListItem])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [OtherMetadataValueListItem]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe Text -> MetadataInfo)
-> Parser (Maybe Text) -> Parser MetadataInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MetadataValue")
      )

instance Prelude.Hashable MetadataInfo

instance Prelude.NFData MetadataInfo