{-# 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.Glue.Types.SchemaVersionErrorItem
-- 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.Glue.Types.SchemaVersionErrorItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Glue.Types.ErrorDetails
import qualified Amazonka.Prelude as Prelude

-- | An object that contains the error details for an operation on a schema
-- version.
--
-- /See:/ 'newSchemaVersionErrorItem' smart constructor.
data SchemaVersionErrorItem = SchemaVersionErrorItem'
  { -- | The details of the error for the schema version.
    SchemaVersionErrorItem -> Maybe ErrorDetails
errorDetails :: Prelude.Maybe ErrorDetails,
    -- | The version number of the schema.
    SchemaVersionErrorItem -> Maybe Natural
versionNumber :: Prelude.Maybe Prelude.Natural
  }
  deriving (SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
$c/= :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
== :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
$c== :: SchemaVersionErrorItem -> SchemaVersionErrorItem -> Bool
Prelude.Eq, ReadPrec [SchemaVersionErrorItem]
ReadPrec SchemaVersionErrorItem
Int -> ReadS SchemaVersionErrorItem
ReadS [SchemaVersionErrorItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SchemaVersionErrorItem]
$creadListPrec :: ReadPrec [SchemaVersionErrorItem]
readPrec :: ReadPrec SchemaVersionErrorItem
$creadPrec :: ReadPrec SchemaVersionErrorItem
readList :: ReadS [SchemaVersionErrorItem]
$creadList :: ReadS [SchemaVersionErrorItem]
readsPrec :: Int -> ReadS SchemaVersionErrorItem
$creadsPrec :: Int -> ReadS SchemaVersionErrorItem
Prelude.Read, Int -> SchemaVersionErrorItem -> ShowS
[SchemaVersionErrorItem] -> ShowS
SchemaVersionErrorItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SchemaVersionErrorItem] -> ShowS
$cshowList :: [SchemaVersionErrorItem] -> ShowS
show :: SchemaVersionErrorItem -> String
$cshow :: SchemaVersionErrorItem -> String
showsPrec :: Int -> SchemaVersionErrorItem -> ShowS
$cshowsPrec :: Int -> SchemaVersionErrorItem -> ShowS
Prelude.Show, forall x. Rep SchemaVersionErrorItem x -> SchemaVersionErrorItem
forall x. SchemaVersionErrorItem -> Rep SchemaVersionErrorItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SchemaVersionErrorItem x -> SchemaVersionErrorItem
$cfrom :: forall x. SchemaVersionErrorItem -> Rep SchemaVersionErrorItem x
Prelude.Generic)

-- |
-- Create a value of 'SchemaVersionErrorItem' 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:
--
-- 'errorDetails', 'schemaVersionErrorItem_errorDetails' - The details of the error for the schema version.
--
-- 'versionNumber', 'schemaVersionErrorItem_versionNumber' - The version number of the schema.
newSchemaVersionErrorItem ::
  SchemaVersionErrorItem
newSchemaVersionErrorItem :: SchemaVersionErrorItem
newSchemaVersionErrorItem =
  SchemaVersionErrorItem'
    { $sel:errorDetails:SchemaVersionErrorItem' :: Maybe ErrorDetails
errorDetails =
        forall a. Maybe a
Prelude.Nothing,
      $sel:versionNumber:SchemaVersionErrorItem' :: Maybe Natural
versionNumber = forall a. Maybe a
Prelude.Nothing
    }

-- | The details of the error for the schema version.
schemaVersionErrorItem_errorDetails :: Lens.Lens' SchemaVersionErrorItem (Prelude.Maybe ErrorDetails)
schemaVersionErrorItem_errorDetails :: Lens' SchemaVersionErrorItem (Maybe ErrorDetails)
schemaVersionErrorItem_errorDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaVersionErrorItem' {Maybe ErrorDetails
errorDetails :: Maybe ErrorDetails
$sel:errorDetails:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe ErrorDetails
errorDetails} -> Maybe ErrorDetails
errorDetails) (\s :: SchemaVersionErrorItem
s@SchemaVersionErrorItem' {} Maybe ErrorDetails
a -> SchemaVersionErrorItem
s {$sel:errorDetails:SchemaVersionErrorItem' :: Maybe ErrorDetails
errorDetails = Maybe ErrorDetails
a} :: SchemaVersionErrorItem)

-- | The version number of the schema.
schemaVersionErrorItem_versionNumber :: Lens.Lens' SchemaVersionErrorItem (Prelude.Maybe Prelude.Natural)
schemaVersionErrorItem_versionNumber :: Lens' SchemaVersionErrorItem (Maybe Natural)
schemaVersionErrorItem_versionNumber = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SchemaVersionErrorItem' {Maybe Natural
versionNumber :: Maybe Natural
$sel:versionNumber:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe Natural
versionNumber} -> Maybe Natural
versionNumber) (\s :: SchemaVersionErrorItem
s@SchemaVersionErrorItem' {} Maybe Natural
a -> SchemaVersionErrorItem
s {$sel:versionNumber:SchemaVersionErrorItem' :: Maybe Natural
versionNumber = Maybe Natural
a} :: SchemaVersionErrorItem)

instance Data.FromJSON SchemaVersionErrorItem where
  parseJSON :: Value -> Parser SchemaVersionErrorItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SchemaVersionErrorItem"
      ( \Object
x ->
          Maybe ErrorDetails -> Maybe Natural -> SchemaVersionErrorItem
SchemaVersionErrorItem'
            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
"ErrorDetails")
            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
"VersionNumber")
      )

instance Prelude.Hashable SchemaVersionErrorItem where
  hashWithSalt :: Int -> SchemaVersionErrorItem -> Int
hashWithSalt Int
_salt SchemaVersionErrorItem' {Maybe Natural
Maybe ErrorDetails
versionNumber :: Maybe Natural
errorDetails :: Maybe ErrorDetails
$sel:versionNumber:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe Natural
$sel:errorDetails:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe ErrorDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ErrorDetails
errorDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
versionNumber

instance Prelude.NFData SchemaVersionErrorItem where
  rnf :: SchemaVersionErrorItem -> ()
rnf SchemaVersionErrorItem' {Maybe Natural
Maybe ErrorDetails
versionNumber :: Maybe Natural
errorDetails :: Maybe ErrorDetails
$sel:versionNumber:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe Natural
$sel:errorDetails:SchemaVersionErrorItem' :: SchemaVersionErrorItem -> Maybe ErrorDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ErrorDetails
errorDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
versionNumber