{-# 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.OpenSearchServerless.Types.CollectionSummary
-- 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.OpenSearchServerless.Types.CollectionSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearchServerless.Types.CollectionStatus
import qualified Amazonka.Prelude as Prelude

-- | Details about each OpenSearch Serverless collection.
--
-- /See:/ 'newCollectionSummary' smart constructor.
data CollectionSummary = CollectionSummary'
  { -- | The Amazon Resource Name (ARN) of the collection.
    CollectionSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the collection.
    CollectionSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the collection.
    CollectionSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The current status of the collection.
    CollectionSummary -> Maybe CollectionStatus
status :: Prelude.Maybe CollectionStatus
  }
  deriving (CollectionSummary -> CollectionSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CollectionSummary -> CollectionSummary -> Bool
$c/= :: CollectionSummary -> CollectionSummary -> Bool
== :: CollectionSummary -> CollectionSummary -> Bool
$c== :: CollectionSummary -> CollectionSummary -> Bool
Prelude.Eq, ReadPrec [CollectionSummary]
ReadPrec CollectionSummary
Int -> ReadS CollectionSummary
ReadS [CollectionSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CollectionSummary]
$creadListPrec :: ReadPrec [CollectionSummary]
readPrec :: ReadPrec CollectionSummary
$creadPrec :: ReadPrec CollectionSummary
readList :: ReadS [CollectionSummary]
$creadList :: ReadS [CollectionSummary]
readsPrec :: Int -> ReadS CollectionSummary
$creadsPrec :: Int -> ReadS CollectionSummary
Prelude.Read, Int -> CollectionSummary -> ShowS
[CollectionSummary] -> ShowS
CollectionSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CollectionSummary] -> ShowS
$cshowList :: [CollectionSummary] -> ShowS
show :: CollectionSummary -> String
$cshow :: CollectionSummary -> String
showsPrec :: Int -> CollectionSummary -> ShowS
$cshowsPrec :: Int -> CollectionSummary -> ShowS
Prelude.Show, forall x. Rep CollectionSummary x -> CollectionSummary
forall x. CollectionSummary -> Rep CollectionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CollectionSummary x -> CollectionSummary
$cfrom :: forall x. CollectionSummary -> Rep CollectionSummary x
Prelude.Generic)

-- |
-- Create a value of 'CollectionSummary' 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:
--
-- 'arn', 'collectionSummary_arn' - The Amazon Resource Name (ARN) of the collection.
--
-- 'id', 'collectionSummary_id' - The unique identifier of the collection.
--
-- 'name', 'collectionSummary_name' - The name of the collection.
--
-- 'status', 'collectionSummary_status' - The current status of the collection.
newCollectionSummary ::
  CollectionSummary
newCollectionSummary :: CollectionSummary
newCollectionSummary =
  CollectionSummary'
    { $sel:arn:CollectionSummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:id:CollectionSummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CollectionSummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:CollectionSummary' :: Maybe CollectionStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the collection.
collectionSummary_arn :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Text)
collectionSummary_arn :: Lens' CollectionSummary (Maybe Text)
collectionSummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:CollectionSummary' :: CollectionSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Text
a -> CollectionSummary
s {$sel:arn:CollectionSummary' :: Maybe Text
arn = Maybe Text
a} :: CollectionSummary)

-- | The unique identifier of the collection.
collectionSummary_id :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Text)
collectionSummary_id :: Lens' CollectionSummary (Maybe Text)
collectionSummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Text
id :: Maybe Text
$sel:id:CollectionSummary' :: CollectionSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Text
a -> CollectionSummary
s {$sel:id:CollectionSummary' :: Maybe Text
id = Maybe Text
a} :: CollectionSummary)

-- | The name of the collection.
collectionSummary_name :: Lens.Lens' CollectionSummary (Prelude.Maybe Prelude.Text)
collectionSummary_name :: Lens' CollectionSummary (Maybe Text)
collectionSummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe Text
name :: Maybe Text
$sel:name:CollectionSummary' :: CollectionSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe Text
a -> CollectionSummary
s {$sel:name:CollectionSummary' :: Maybe Text
name = Maybe Text
a} :: CollectionSummary)

-- | The current status of the collection.
collectionSummary_status :: Lens.Lens' CollectionSummary (Prelude.Maybe CollectionStatus)
collectionSummary_status :: Lens' CollectionSummary (Maybe CollectionStatus)
collectionSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CollectionSummary' {Maybe CollectionStatus
status :: Maybe CollectionStatus
$sel:status:CollectionSummary' :: CollectionSummary -> Maybe CollectionStatus
status} -> Maybe CollectionStatus
status) (\s :: CollectionSummary
s@CollectionSummary' {} Maybe CollectionStatus
a -> CollectionSummary
s {$sel:status:CollectionSummary' :: Maybe CollectionStatus
status = Maybe CollectionStatus
a} :: CollectionSummary)

instance Data.FromJSON CollectionSummary where
  parseJSON :: Value -> Parser CollectionSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CollectionSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe CollectionStatus
-> CollectionSummary
CollectionSummary'
            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
"arn")
            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
"id")
            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
"name")
            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
"status")
      )

instance Prelude.Hashable CollectionSummary where
  hashWithSalt :: Int -> CollectionSummary -> Int
hashWithSalt Int
_salt CollectionSummary' {Maybe Text
Maybe CollectionStatus
status :: Maybe CollectionStatus
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:status:CollectionSummary' :: CollectionSummary -> Maybe CollectionStatus
$sel:name:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:id:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:arn:CollectionSummary' :: CollectionSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CollectionStatus
status

instance Prelude.NFData CollectionSummary where
  rnf :: CollectionSummary -> ()
rnf CollectionSummary' {Maybe Text
Maybe CollectionStatus
status :: Maybe CollectionStatus
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:status:CollectionSummary' :: CollectionSummary -> Maybe CollectionStatus
$sel:name:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:id:CollectionSummary' :: CollectionSummary -> Maybe Text
$sel:arn:CollectionSummary' :: CollectionSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CollectionStatus
status