{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Schemas.Types.SchemaSummary 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 summary of schema details.
--
-- /See:/ 'newSchemaSummary' smart constructor.
data SchemaSummary = SchemaSummary'
  { -- | The date and time that schema was modified.
    SchemaSummary -> Maybe ISO8601
lastModified :: Prelude.Maybe Data.ISO8601,
    -- | The ARN of the schema.
    SchemaSummary -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the schema.
    SchemaSummary -> Maybe Text
schemaName :: Prelude.Maybe Prelude.Text,
    -- | 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
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]
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
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. 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:
--
-- 'lastModified', 'schemaSummary_lastModified' - The date and time that schema was modified.
--
-- 'schemaArn', 'schemaSummary_schemaArn' - The ARN of the schema.
--
-- 'schemaName', 'schemaSummary_schemaName' - The name of the schema.
--
-- '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'
    { $sel:lastModified:SchemaSummary' :: Maybe ISO8601
lastModified = forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:SchemaSummary' :: Maybe Text
schemaArn = forall a. Maybe a
Prelude.Nothing,
      $sel:schemaName:SchemaSummary' :: Maybe Text
schemaName = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:SchemaSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:versionCount:SchemaSummary' :: Maybe Integer
versionCount = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that schema was modified.
schemaSummary_lastModified :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.UTCTime)
schemaSummary_lastModified :: Lens' SchemaSummary (Maybe UTCTime)
schemaSummary_lastModified = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaSummary' {Maybe ISO8601
lastModified :: Maybe ISO8601
$sel:lastModified:SchemaSummary' :: SchemaSummary -> Maybe ISO8601
lastModified} -> Maybe ISO8601
lastModified) (\s :: SchemaSummary
s@SchemaSummary' {} Maybe ISO8601
a -> SchemaSummary
s {$sel:lastModified:SchemaSummary' :: Maybe ISO8601
lastModified = Maybe ISO8601
a} :: SchemaSummary) 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 ARN of the schema.
schemaSummary_schemaArn :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.Text)
schemaSummary_schemaArn :: Lens' SchemaSummary (Maybe Text)
schemaSummary_schemaArn = 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 name of the schema.
schemaSummary_schemaName :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.Text)
schemaSummary_schemaName :: Lens' SchemaSummary (Maybe Text)
schemaSummary_schemaName = 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)

-- | Tags associated with the schema.
schemaSummary_tags :: Lens.Lens' SchemaSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
schemaSummary_tags :: Lens' SchemaSummary (Maybe (HashMap Text Text))
schemaSummary_tags = 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) 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

-- | The number of versions available for the schema.
schemaSummary_versionCount :: Lens.Lens' SchemaSummary (Prelude.Maybe Prelude.Integer)
schemaSummary_versionCount :: Lens' SchemaSummary (Maybe Integer)
schemaSummary_versionCount = 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 Data.FromJSON SchemaSummary where
  parseJSON :: Value -> Parser SchemaSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SchemaSummary"
      ( \Object
x ->
          Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Integer
-> SchemaSummary
SchemaSummary'
            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
"LastModified")
            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
"SchemaArn")
            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
"SchemaName")
            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)
            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
"VersionCount")
      )

instance Prelude.Hashable SchemaSummary where
  hashWithSalt :: Int -> SchemaSummary -> Int
hashWithSalt Int
_salt SchemaSummary' {Maybe Integer
Maybe Text
Maybe (HashMap Text Text)
Maybe ISO8601
versionCount :: Maybe Integer
tags :: Maybe (HashMap Text Text)
schemaName :: Maybe Text
schemaArn :: Maybe Text
lastModified :: Maybe ISO8601
$sel:versionCount:SchemaSummary' :: SchemaSummary -> Maybe Integer
$sel:tags:SchemaSummary' :: SchemaSummary -> Maybe (HashMap Text Text)
$sel:schemaName:SchemaSummary' :: SchemaSummary -> Maybe Text
$sel:schemaArn:SchemaSummary' :: SchemaSummary -> Maybe Text
$sel:lastModified:SchemaSummary' :: SchemaSummary -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
lastModified
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
schemaArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
schemaName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
versionCount

instance Prelude.NFData SchemaSummary where
  rnf :: SchemaSummary -> ()
rnf SchemaSummary' {Maybe Integer
Maybe Text
Maybe (HashMap Text Text)
Maybe ISO8601
versionCount :: Maybe Integer
tags :: Maybe (HashMap Text Text)
schemaName :: Maybe Text
schemaArn :: Maybe Text
lastModified :: Maybe ISO8601
$sel:versionCount:SchemaSummary' :: SchemaSummary -> Maybe Integer
$sel:tags:SchemaSummary' :: SchemaSummary -> Maybe (HashMap Text Text)
$sel:schemaName:SchemaSummary' :: SchemaSummary -> Maybe Text
$sel:schemaArn:SchemaSummary' :: SchemaSummary -> Maybe Text
$sel:lastModified:SchemaSummary' :: SchemaSummary -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
lastModified
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
schemaArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
schemaName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
versionCount