{-# 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.SearchSchemaSummary
-- 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.SearchSchemaSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Schemas.Types.SearchSchemaVersionSummary

-- | /See:/ 'newSearchSchemaSummary' smart constructor.
data SearchSchemaSummary = SearchSchemaSummary'
  { -- | The name of the registry.
    SearchSchemaSummary -> Maybe Text
registryName :: Prelude.Maybe Prelude.Text,
    -- | An array of schema version summaries.
    SearchSchemaSummary -> Maybe [SearchSchemaVersionSummary]
schemaVersions :: Prelude.Maybe [SearchSchemaVersionSummary],
    -- | The name of the schema.
    SearchSchemaSummary -> Maybe Text
schemaName :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the schema.
    SearchSchemaSummary -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text
  }
  deriving (SearchSchemaSummary -> SearchSchemaSummary -> Bool
(SearchSchemaSummary -> SearchSchemaSummary -> Bool)
-> (SearchSchemaSummary -> SearchSchemaSummary -> Bool)
-> Eq SearchSchemaSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchSchemaSummary -> SearchSchemaSummary -> Bool
$c/= :: SearchSchemaSummary -> SearchSchemaSummary -> Bool
== :: SearchSchemaSummary -> SearchSchemaSummary -> Bool
$c== :: SearchSchemaSummary -> SearchSchemaSummary -> Bool
Prelude.Eq, ReadPrec [SearchSchemaSummary]
ReadPrec SearchSchemaSummary
Int -> ReadS SearchSchemaSummary
ReadS [SearchSchemaSummary]
(Int -> ReadS SearchSchemaSummary)
-> ReadS [SearchSchemaSummary]
-> ReadPrec SearchSchemaSummary
-> ReadPrec [SearchSchemaSummary]
-> Read SearchSchemaSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchSchemaSummary]
$creadListPrec :: ReadPrec [SearchSchemaSummary]
readPrec :: ReadPrec SearchSchemaSummary
$creadPrec :: ReadPrec SearchSchemaSummary
readList :: ReadS [SearchSchemaSummary]
$creadList :: ReadS [SearchSchemaSummary]
readsPrec :: Int -> ReadS SearchSchemaSummary
$creadsPrec :: Int -> ReadS SearchSchemaSummary
Prelude.Read, Int -> SearchSchemaSummary -> ShowS
[SearchSchemaSummary] -> ShowS
SearchSchemaSummary -> String
(Int -> SearchSchemaSummary -> ShowS)
-> (SearchSchemaSummary -> String)
-> ([SearchSchemaSummary] -> ShowS)
-> Show SearchSchemaSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchSchemaSummary] -> ShowS
$cshowList :: [SearchSchemaSummary] -> ShowS
show :: SearchSchemaSummary -> String
$cshow :: SearchSchemaSummary -> String
showsPrec :: Int -> SearchSchemaSummary -> ShowS
$cshowsPrec :: Int -> SearchSchemaSummary -> ShowS
Prelude.Show, (forall x. SearchSchemaSummary -> Rep SearchSchemaSummary x)
-> (forall x. Rep SearchSchemaSummary x -> SearchSchemaSummary)
-> Generic SearchSchemaSummary
forall x. Rep SearchSchemaSummary x -> SearchSchemaSummary
forall x. SearchSchemaSummary -> Rep SearchSchemaSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchSchemaSummary x -> SearchSchemaSummary
$cfrom :: forall x. SearchSchemaSummary -> Rep SearchSchemaSummary x
Prelude.Generic)

-- |
-- Create a value of 'SearchSchemaSummary' 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:
--
-- 'registryName', 'searchSchemaSummary_registryName' - The name of the registry.
--
-- 'schemaVersions', 'searchSchemaSummary_schemaVersions' - An array of schema version summaries.
--
-- 'schemaName', 'searchSchemaSummary_schemaName' - The name of the schema.
--
-- 'schemaArn', 'searchSchemaSummary_schemaArn' - The ARN of the schema.
newSearchSchemaSummary ::
  SearchSchemaSummary
newSearchSchemaSummary :: SearchSchemaSummary
newSearchSchemaSummary =
  SearchSchemaSummary' :: Maybe Text
-> Maybe [SearchSchemaVersionSummary]
-> Maybe Text
-> Maybe Text
-> SearchSchemaSummary
SearchSchemaSummary'
    { $sel:registryName:SearchSchemaSummary' :: Maybe Text
registryName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaVersions:SearchSchemaSummary' :: Maybe [SearchSchemaVersionSummary]
schemaVersions = Maybe [SearchSchemaVersionSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaName:SearchSchemaSummary' :: Maybe Text
schemaName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:SearchSchemaSummary' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the registry.
searchSchemaSummary_registryName :: Lens.Lens' SearchSchemaSummary (Prelude.Maybe Prelude.Text)
searchSchemaSummary_registryName :: (Maybe Text -> f (Maybe Text))
-> SearchSchemaSummary -> f SearchSchemaSummary
searchSchemaSummary_registryName = (SearchSchemaSummary -> Maybe Text)
-> (SearchSchemaSummary -> Maybe Text -> SearchSchemaSummary)
-> Lens
     SearchSchemaSummary SearchSchemaSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSchemaSummary' {Maybe Text
registryName :: Maybe Text
$sel:registryName:SearchSchemaSummary' :: SearchSchemaSummary -> Maybe Text
registryName} -> Maybe Text
registryName) (\s :: SearchSchemaSummary
s@SearchSchemaSummary' {} Maybe Text
a -> SearchSchemaSummary
s {$sel:registryName:SearchSchemaSummary' :: Maybe Text
registryName = Maybe Text
a} :: SearchSchemaSummary)

-- | An array of schema version summaries.
searchSchemaSummary_schemaVersions :: Lens.Lens' SearchSchemaSummary (Prelude.Maybe [SearchSchemaVersionSummary])
searchSchemaSummary_schemaVersions :: (Maybe [SearchSchemaVersionSummary]
 -> f (Maybe [SearchSchemaVersionSummary]))
-> SearchSchemaSummary -> f SearchSchemaSummary
searchSchemaSummary_schemaVersions = (SearchSchemaSummary -> Maybe [SearchSchemaVersionSummary])
-> (SearchSchemaSummary
    -> Maybe [SearchSchemaVersionSummary] -> SearchSchemaSummary)
-> Lens
     SearchSchemaSummary
     SearchSchemaSummary
     (Maybe [SearchSchemaVersionSummary])
     (Maybe [SearchSchemaVersionSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSchemaSummary' {Maybe [SearchSchemaVersionSummary]
schemaVersions :: Maybe [SearchSchemaVersionSummary]
$sel:schemaVersions:SearchSchemaSummary' :: SearchSchemaSummary -> Maybe [SearchSchemaVersionSummary]
schemaVersions} -> Maybe [SearchSchemaVersionSummary]
schemaVersions) (\s :: SearchSchemaSummary
s@SearchSchemaSummary' {} Maybe [SearchSchemaVersionSummary]
a -> SearchSchemaSummary
s {$sel:schemaVersions:SearchSchemaSummary' :: Maybe [SearchSchemaVersionSummary]
schemaVersions = Maybe [SearchSchemaVersionSummary]
a} :: SearchSchemaSummary) ((Maybe [SearchSchemaVersionSummary]
  -> f (Maybe [SearchSchemaVersionSummary]))
 -> SearchSchemaSummary -> f SearchSchemaSummary)
-> ((Maybe [SearchSchemaVersionSummary]
     -> f (Maybe [SearchSchemaVersionSummary]))
    -> Maybe [SearchSchemaVersionSummary]
    -> f (Maybe [SearchSchemaVersionSummary]))
-> (Maybe [SearchSchemaVersionSummary]
    -> f (Maybe [SearchSchemaVersionSummary]))
-> SearchSchemaSummary
-> f SearchSchemaSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SearchSchemaVersionSummary]
  [SearchSchemaVersionSummary]
  [SearchSchemaVersionSummary]
  [SearchSchemaVersionSummary]
-> Iso
     (Maybe [SearchSchemaVersionSummary])
     (Maybe [SearchSchemaVersionSummary])
     (Maybe [SearchSchemaVersionSummary])
     (Maybe [SearchSchemaVersionSummary])
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
  [SearchSchemaVersionSummary]
  [SearchSchemaVersionSummary]
  [SearchSchemaVersionSummary]
  [SearchSchemaVersionSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Core.FromJSON SearchSchemaSummary where
  parseJSON :: Value -> Parser SearchSchemaSummary
parseJSON =
    String
-> (Object -> Parser SearchSchemaSummary)
-> Value
-> Parser SearchSchemaSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SearchSchemaSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe [SearchSchemaVersionSummary]
-> Maybe Text
-> Maybe Text
-> SearchSchemaSummary
SearchSchemaSummary'
            (Maybe Text
 -> Maybe [SearchSchemaVersionSummary]
 -> Maybe Text
 -> Maybe Text
 -> SearchSchemaSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe [SearchSchemaVersionSummary]
      -> Maybe Text -> Maybe Text -> SearchSchemaSummary)
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
"RegistryName")
            Parser
  (Maybe [SearchSchemaVersionSummary]
   -> Maybe Text -> Maybe Text -> SearchSchemaSummary)
-> Parser (Maybe [SearchSchemaVersionSummary])
-> Parser (Maybe Text -> Maybe Text -> SearchSchemaSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Parser (Maybe (Maybe [SearchSchemaVersionSummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SchemaVersions" Parser (Maybe (Maybe [SearchSchemaVersionSummary]))
-> Maybe [SearchSchemaVersionSummary]
-> Parser (Maybe [SearchSchemaVersionSummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [SearchSchemaVersionSummary]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Text -> SearchSchemaSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SearchSchemaSummary)
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
"SchemaName")
            Parser (Maybe Text -> SearchSchemaSummary)
-> Parser (Maybe Text) -> Parser SearchSchemaSummary
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")
      )

instance Prelude.Hashable SearchSchemaSummary

instance Prelude.NFData SearchSchemaSummary