{-# 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.Schemas.Types.SchemaSummary
-- 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.Schemas.Types.SchemaSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A summary of schema details.
--
-- /See:/ 'newSchemaSummary' smart constructor.
data SchemaSummary = SchemaSummary'
  { -- | The name of the schema.
    SchemaSummary -> Maybe Text
schemaName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the schema.
    SchemaSummary -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
    -- | The date and time that schema was modified.
    SchemaSummary -> Maybe POSIX
lastModified :: Prelude.Maybe Core.POSIX,
    -- | Tags associated with the schema.
    SchemaSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The number of versions available for the schema.
    SchemaSummary -> Maybe Integer
versionCount :: Prelude.Maybe Prelude.Integer
  }
  deriving (SchemaSummary -> SchemaSummary -> Bool
(SchemaSummary -> SchemaSummary -> Bool)
-> (SchemaSummary -> SchemaSummary -> Bool) -> Eq SchemaSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchemaSummary -> SchemaSummary -> Bool
$c/= :: SchemaSummary -> SchemaSummary -> Bool
== :: SchemaSummary -> SchemaSummary -> Bool
$c== :: SchemaSummary -> SchemaSummary -> Bool
Prelude.Eq, ReadPrec [SchemaSummary]
ReadPrec SchemaSummary
Int -> ReadS SchemaSummary
ReadS [SchemaSummary]
(Int -> ReadS SchemaSummary)
-> ReadS [SchemaSummary]
-> ReadPrec SchemaSummary
-> ReadPrec [SchemaSummary]
-> Read SchemaSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchemaSummary]
$creadListPrec :: ReadPrec [SchemaSummary]
readPrec :: ReadPrec SchemaSummary
$creadPrec :: ReadPrec SchemaSummary
readList :: ReadS [SchemaSummary]
$creadList :: ReadS [SchemaSummary]
readsPrec :: Int -> ReadS SchemaSummary
$creadsPrec :: Int -> ReadS SchemaSummary
Prelude.Read, Int -> SchemaSummary -> ShowS
[SchemaSummary] -> ShowS
SchemaSummary -> String
(Int -> SchemaSummary -> ShowS)
-> (SchemaSummary -> String)
-> ([SchemaSummary] -> ShowS)
-> Show SchemaSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchemaSummary] -> ShowS
$cshowList :: [SchemaSummary] -> ShowS
show :: SchemaSummary -> String
$cshow :: SchemaSummary -> String
showsPrec :: Int -> SchemaSummary -> ShowS
$cshowsPrec :: Int -> SchemaSummary -> ShowS
Prelude.Show, (forall x. SchemaSummary -> Rep SchemaSummary x)
-> (forall x. Rep SchemaSummary x -> SchemaSummary)
-> Generic SchemaSummary
forall x. Rep SchemaSummary x -> SchemaSummary
forall x. SchemaSummary -> Rep SchemaSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchemaSummary x -> SchemaSummary
$cfrom :: forall x. SchemaSummary -> Rep SchemaSummary x
Prelude.Generic)

-- |
-- Create a value of 'SchemaSummary' 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:
--
-- 'schemaName', 'schemaSummary_schemaName' - The name of the schema.
--
-- 'schemaArn', 'schemaSummary_schemaArn' - The ARN of the schema.
--
-- 'lastModified', 'schemaSummary_lastModified' - The date and time that schema was modified.
--
-- 'tags', 'schemaSummary_tags' - Tags associated with the schema.
--
-- 'versionCount', 'schemaSummary_versionCount' - The number of versions available for the schema.
newSchemaSummary ::
  SchemaSummary
newSchemaSummary :: SchemaSummary
newSchemaSummary =
  SchemaSummary' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> SchemaSummary
SchemaSummary'
    { $sel:schemaName:SchemaSummary' :: Maybe Text
schemaName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:SchemaSummary' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastModified:SchemaSummary' :: Maybe POSIX
lastModified = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:SchemaSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:versionCount:SchemaSummary' :: Maybe Integer
versionCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the schema.
schemaSummary_schemaName :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.Text)
schemaSummary_schemaName :: (Maybe Text -> f (Maybe Text)) -> SchemaSummary -> f SchemaSummary
schemaSummary_schemaName = (SchemaSummary -> Maybe Text)
-> (SchemaSummary -> Maybe Text -> SchemaSummary)
-> Lens SchemaSummary SchemaSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaSummary' {Maybe Text
schemaName :: Maybe Text
$sel:schemaName:SchemaSummary' :: SchemaSummary -> Maybe Text
schemaName} -> Maybe Text
schemaName) (\s :: SchemaSummary
s@SchemaSummary' {} Maybe Text
a -> SchemaSummary
s {$sel:schemaName:SchemaSummary' :: Maybe Text
schemaName = Maybe Text
a} :: SchemaSummary)

-- | The ARN of the schema.
schemaSummary_schemaArn :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.Text)
schemaSummary_schemaArn :: (Maybe Text -> f (Maybe Text)) -> SchemaSummary -> f SchemaSummary
schemaSummary_schemaArn = (SchemaSummary -> Maybe Text)
-> (SchemaSummary -> Maybe Text -> SchemaSummary)
-> Lens SchemaSummary SchemaSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaSummary' {Maybe Text
schemaArn :: Maybe Text
$sel:schemaArn:SchemaSummary' :: SchemaSummary -> Maybe Text
schemaArn} -> Maybe Text
schemaArn) (\s :: SchemaSummary
s@SchemaSummary' {} Maybe Text
a -> SchemaSummary
s {$sel:schemaArn:SchemaSummary' :: Maybe Text
schemaArn = Maybe Text
a} :: SchemaSummary)

-- | The date and time that schema was modified.
schemaSummary_lastModified :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.UTCTime)
schemaSummary_lastModified :: (Maybe UTCTime -> f (Maybe UTCTime))
-> SchemaSummary -> f SchemaSummary
schemaSummary_lastModified = (SchemaSummary -> Maybe POSIX)
-> (SchemaSummary -> Maybe POSIX -> SchemaSummary)
-> Lens SchemaSummary SchemaSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaSummary' {Maybe POSIX
lastModified :: Maybe POSIX
$sel:lastModified:SchemaSummary' :: SchemaSummary -> Maybe POSIX
lastModified} -> Maybe POSIX
lastModified) (\s :: SchemaSummary
s@SchemaSummary' {} Maybe POSIX
a -> SchemaSummary
s {$sel:lastModified:SchemaSummary' :: Maybe POSIX
lastModified = Maybe POSIX
a} :: SchemaSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> SchemaSummary -> f SchemaSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> SchemaSummary
-> f SchemaSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Tags associated with the schema.
schemaSummary_tags :: Lens.Lens' SchemaSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
schemaSummary_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SchemaSummary -> f SchemaSummary
schemaSummary_tags = (SchemaSummary -> Maybe (HashMap Text Text))
-> (SchemaSummary -> Maybe (HashMap Text Text) -> SchemaSummary)
-> Lens
     SchemaSummary
     SchemaSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:SchemaSummary' :: SchemaSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: SchemaSummary
s@SchemaSummary' {} Maybe (HashMap Text Text)
a -> SchemaSummary
s {$sel:tags:SchemaSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: SchemaSummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> SchemaSummary -> f SchemaSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> SchemaSummary
-> f SchemaSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of versions available for the schema.
schemaSummary_versionCount :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.Integer)
schemaSummary_versionCount :: (Maybe Integer -> f (Maybe Integer))
-> SchemaSummary -> f SchemaSummary
schemaSummary_versionCount = (SchemaSummary -> Maybe Integer)
-> (SchemaSummary -> Maybe Integer -> SchemaSummary)
-> Lens SchemaSummary SchemaSummary (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaSummary' {Maybe Integer
versionCount :: Maybe Integer
$sel:versionCount:SchemaSummary' :: SchemaSummary -> Maybe Integer
versionCount} -> Maybe Integer
versionCount) (\s :: SchemaSummary
s@SchemaSummary' {} Maybe Integer
a -> SchemaSummary
s {$sel:versionCount:SchemaSummary' :: Maybe Integer
versionCount = Maybe Integer
a} :: SchemaSummary)

instance Core.FromJSON SchemaSummary where
  parseJSON :: Value -> Parser SchemaSummary
parseJSON =
    String
-> (Object -> Parser SchemaSummary)
-> Value
-> Parser SchemaSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SchemaSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> SchemaSummary
SchemaSummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe (HashMap Text Text)
 -> Maybe Integer
 -> SchemaSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe (HashMap Text Text)
      -> Maybe Integer
      -> SchemaSummary)
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
"SchemaName")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe (HashMap Text Text)
   -> Maybe Integer
   -> SchemaSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe (HashMap Text Text) -> Maybe Integer -> SchemaSummary)
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
"SchemaArn")
            Parser
  (Maybe POSIX
   -> Maybe (HashMap Text Text) -> Maybe Integer -> SchemaSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe (HashMap Text Text) -> Maybe Integer -> SchemaSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LastModified")
            Parser
  (Maybe (HashMap Text Text) -> Maybe Integer -> SchemaSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe Integer -> SchemaSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Integer -> SchemaSummary)
-> Parser (Maybe Integer) -> Parser SchemaSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"VersionCount")
      )

instance Prelude.Hashable SchemaSummary

instance Prelude.NFData SchemaSummary