{-# 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.M2.Types.DatasetOrgAttributes
-- 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.M2.Types.DatasetOrgAttributes where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.M2.Types.GdgAttributes
import Amazonka.M2.Types.VsamAttributes
import qualified Amazonka.Prelude as Prelude

-- | Additional details about the data set. Different attributes correspond
-- to different data set organizations. The values are populated based on
-- datasetOrg, storageType and backend (Blu Age or Micro Focus).
--
-- /See:/ 'newDatasetOrgAttributes' smart constructor.
data DatasetOrgAttributes = DatasetOrgAttributes'
  { -- | The generation data group of the data set.
    DatasetOrgAttributes -> Maybe GdgAttributes
gdg :: Prelude.Maybe GdgAttributes,
    -- | The details of a VSAM data set.
    DatasetOrgAttributes -> Maybe VsamAttributes
vsam :: Prelude.Maybe VsamAttributes
  }
  deriving (DatasetOrgAttributes -> DatasetOrgAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetOrgAttributes -> DatasetOrgAttributes -> Bool
$c/= :: DatasetOrgAttributes -> DatasetOrgAttributes -> Bool
== :: DatasetOrgAttributes -> DatasetOrgAttributes -> Bool
$c== :: DatasetOrgAttributes -> DatasetOrgAttributes -> Bool
Prelude.Eq, ReadPrec [DatasetOrgAttributes]
ReadPrec DatasetOrgAttributes
Int -> ReadS DatasetOrgAttributes
ReadS [DatasetOrgAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetOrgAttributes]
$creadListPrec :: ReadPrec [DatasetOrgAttributes]
readPrec :: ReadPrec DatasetOrgAttributes
$creadPrec :: ReadPrec DatasetOrgAttributes
readList :: ReadS [DatasetOrgAttributes]
$creadList :: ReadS [DatasetOrgAttributes]
readsPrec :: Int -> ReadS DatasetOrgAttributes
$creadsPrec :: Int -> ReadS DatasetOrgAttributes
Prelude.Read, Int -> DatasetOrgAttributes -> ShowS
[DatasetOrgAttributes] -> ShowS
DatasetOrgAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetOrgAttributes] -> ShowS
$cshowList :: [DatasetOrgAttributes] -> ShowS
show :: DatasetOrgAttributes -> String
$cshow :: DatasetOrgAttributes -> String
showsPrec :: Int -> DatasetOrgAttributes -> ShowS
$cshowsPrec :: Int -> DatasetOrgAttributes -> ShowS
Prelude.Show, forall x. Rep DatasetOrgAttributes x -> DatasetOrgAttributes
forall x. DatasetOrgAttributes -> Rep DatasetOrgAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetOrgAttributes x -> DatasetOrgAttributes
$cfrom :: forall x. DatasetOrgAttributes -> Rep DatasetOrgAttributes x
Prelude.Generic)

-- |
-- Create a value of 'DatasetOrgAttributes' 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:
--
-- 'gdg', 'datasetOrgAttributes_gdg' - The generation data group of the data set.
--
-- 'vsam', 'datasetOrgAttributes_vsam' - The details of a VSAM data set.
newDatasetOrgAttributes ::
  DatasetOrgAttributes
newDatasetOrgAttributes :: DatasetOrgAttributes
newDatasetOrgAttributes =
  DatasetOrgAttributes'
    { $sel:gdg:DatasetOrgAttributes' :: Maybe GdgAttributes
gdg = forall a. Maybe a
Prelude.Nothing,
      $sel:vsam:DatasetOrgAttributes' :: Maybe VsamAttributes
vsam = forall a. Maybe a
Prelude.Nothing
    }

-- | The generation data group of the data set.
datasetOrgAttributes_gdg :: Lens.Lens' DatasetOrgAttributes (Prelude.Maybe GdgAttributes)
datasetOrgAttributes_gdg :: Lens' DatasetOrgAttributes (Maybe GdgAttributes)
datasetOrgAttributes_gdg = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetOrgAttributes' {Maybe GdgAttributes
gdg :: Maybe GdgAttributes
$sel:gdg:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe GdgAttributes
gdg} -> Maybe GdgAttributes
gdg) (\s :: DatasetOrgAttributes
s@DatasetOrgAttributes' {} Maybe GdgAttributes
a -> DatasetOrgAttributes
s {$sel:gdg:DatasetOrgAttributes' :: Maybe GdgAttributes
gdg = Maybe GdgAttributes
a} :: DatasetOrgAttributes)

-- | The details of a VSAM data set.
datasetOrgAttributes_vsam :: Lens.Lens' DatasetOrgAttributes (Prelude.Maybe VsamAttributes)
datasetOrgAttributes_vsam :: Lens' DatasetOrgAttributes (Maybe VsamAttributes)
datasetOrgAttributes_vsam = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetOrgAttributes' {Maybe VsamAttributes
vsam :: Maybe VsamAttributes
$sel:vsam:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe VsamAttributes
vsam} -> Maybe VsamAttributes
vsam) (\s :: DatasetOrgAttributes
s@DatasetOrgAttributes' {} Maybe VsamAttributes
a -> DatasetOrgAttributes
s {$sel:vsam:DatasetOrgAttributes' :: Maybe VsamAttributes
vsam = Maybe VsamAttributes
a} :: DatasetOrgAttributes)

instance Prelude.Hashable DatasetOrgAttributes where
  hashWithSalt :: Int -> DatasetOrgAttributes -> Int
hashWithSalt Int
_salt DatasetOrgAttributes' {Maybe GdgAttributes
Maybe VsamAttributes
vsam :: Maybe VsamAttributes
gdg :: Maybe GdgAttributes
$sel:vsam:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe VsamAttributes
$sel:gdg:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe GdgAttributes
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GdgAttributes
gdg
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VsamAttributes
vsam

instance Prelude.NFData DatasetOrgAttributes where
  rnf :: DatasetOrgAttributes -> ()
rnf DatasetOrgAttributes' {Maybe GdgAttributes
Maybe VsamAttributes
vsam :: Maybe VsamAttributes
gdg :: Maybe GdgAttributes
$sel:vsam:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe VsamAttributes
$sel:gdg:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe GdgAttributes
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe GdgAttributes
gdg seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VsamAttributes
vsam

instance Data.ToJSON DatasetOrgAttributes where
  toJSON :: DatasetOrgAttributes -> Value
toJSON DatasetOrgAttributes' {Maybe GdgAttributes
Maybe VsamAttributes
vsam :: Maybe VsamAttributes
gdg :: Maybe GdgAttributes
$sel:vsam:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe VsamAttributes
$sel:gdg:DatasetOrgAttributes' :: DatasetOrgAttributes -> Maybe GdgAttributes
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"gdg" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe GdgAttributes
gdg,
            (Key
"vsam" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VsamAttributes
vsam
          ]
      )