{-# 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.Personalize.Types.DatasetSchema
-- 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.Personalize.Types.DatasetSchema where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the schema for a dataset. For more information on schemas, see
-- CreateSchema.
--
-- /See:/ 'newDatasetSchema' smart constructor.
data DatasetSchema = DatasetSchema'
  { -- | The date and time (in Unix time) that the schema was last updated.
    DatasetSchema -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Core.POSIX,
    -- | The schema.
    DatasetSchema -> Maybe Text
schema :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the schema.
    DatasetSchema -> Maybe Text
schemaArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the schema.
    DatasetSchema -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The date and time (in Unix time) that the schema was created.
    DatasetSchema -> Maybe POSIX
creationDateTime :: Prelude.Maybe Core.POSIX
  }
  deriving (DatasetSchema -> DatasetSchema -> Bool
(DatasetSchema -> DatasetSchema -> Bool)
-> (DatasetSchema -> DatasetSchema -> Bool) -> Eq DatasetSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DatasetSchema -> DatasetSchema -> Bool
$c/= :: DatasetSchema -> DatasetSchema -> Bool
== :: DatasetSchema -> DatasetSchema -> Bool
$c== :: DatasetSchema -> DatasetSchema -> Bool
Prelude.Eq, ReadPrec [DatasetSchema]
ReadPrec DatasetSchema
Int -> ReadS DatasetSchema
ReadS [DatasetSchema]
(Int -> ReadS DatasetSchema)
-> ReadS [DatasetSchema]
-> ReadPrec DatasetSchema
-> ReadPrec [DatasetSchema]
-> Read DatasetSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DatasetSchema]
$creadListPrec :: ReadPrec [DatasetSchema]
readPrec :: ReadPrec DatasetSchema
$creadPrec :: ReadPrec DatasetSchema
readList :: ReadS [DatasetSchema]
$creadList :: ReadS [DatasetSchema]
readsPrec :: Int -> ReadS DatasetSchema
$creadsPrec :: Int -> ReadS DatasetSchema
Prelude.Read, Int -> DatasetSchema -> ShowS
[DatasetSchema] -> ShowS
DatasetSchema -> String
(Int -> DatasetSchema -> ShowS)
-> (DatasetSchema -> String)
-> ([DatasetSchema] -> ShowS)
-> Show DatasetSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DatasetSchema] -> ShowS
$cshowList :: [DatasetSchema] -> ShowS
show :: DatasetSchema -> String
$cshow :: DatasetSchema -> String
showsPrec :: Int -> DatasetSchema -> ShowS
$cshowsPrec :: Int -> DatasetSchema -> ShowS
Prelude.Show, (forall x. DatasetSchema -> Rep DatasetSchema x)
-> (forall x. Rep DatasetSchema x -> DatasetSchema)
-> Generic DatasetSchema
forall x. Rep DatasetSchema x -> DatasetSchema
forall x. DatasetSchema -> Rep DatasetSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DatasetSchema x -> DatasetSchema
$cfrom :: forall x. DatasetSchema -> Rep DatasetSchema x
Prelude.Generic)

-- |
-- Create a value of 'DatasetSchema' 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:
--
-- 'lastUpdatedDateTime', 'datasetSchema_lastUpdatedDateTime' - The date and time (in Unix time) that the schema was last updated.
--
-- 'schema', 'datasetSchema_schema' - The schema.
--
-- 'schemaArn', 'datasetSchema_schemaArn' - The Amazon Resource Name (ARN) of the schema.
--
-- 'name', 'datasetSchema_name' - The name of the schema.
--
-- 'creationDateTime', 'datasetSchema_creationDateTime' - The date and time (in Unix time) that the schema was created.
newDatasetSchema ::
  DatasetSchema
newDatasetSchema :: DatasetSchema
newDatasetSchema =
  DatasetSchema' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> DatasetSchema
DatasetSchema'
    { $sel:lastUpdatedDateTime:DatasetSchema' :: Maybe POSIX
lastUpdatedDateTime =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:schema:DatasetSchema' :: Maybe Text
schema = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:schemaArn:DatasetSchema' :: Maybe Text
schemaArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DatasetSchema' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDateTime:DatasetSchema' :: Maybe POSIX
creationDateTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time (in Unix time) that the schema was last updated.
datasetSchema_lastUpdatedDateTime :: Lens.Lens' DatasetSchema (Prelude.Maybe Prelude.UTCTime)
datasetSchema_lastUpdatedDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSchema -> f DatasetSchema
datasetSchema_lastUpdatedDateTime = (DatasetSchema -> Maybe POSIX)
-> (DatasetSchema -> Maybe POSIX -> DatasetSchema)
-> Lens DatasetSchema DatasetSchema (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSchema' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:DatasetSchema' :: DatasetSchema -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: DatasetSchema
s@DatasetSchema' {} Maybe POSIX
a -> DatasetSchema
s {$sel:lastUpdatedDateTime:DatasetSchema' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: DatasetSchema) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetSchema -> f DatasetSchema)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSchema
-> f DatasetSchema
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The schema.
datasetSchema_schema :: Lens.Lens' DatasetSchema (Prelude.Maybe Prelude.Text)
datasetSchema_schema :: (Maybe Text -> f (Maybe Text)) -> DatasetSchema -> f DatasetSchema
datasetSchema_schema = (DatasetSchema -> Maybe Text)
-> (DatasetSchema -> Maybe Text -> DatasetSchema)
-> Lens DatasetSchema DatasetSchema (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSchema' {Maybe Text
schema :: Maybe Text
$sel:schema:DatasetSchema' :: DatasetSchema -> Maybe Text
schema} -> Maybe Text
schema) (\s :: DatasetSchema
s@DatasetSchema' {} Maybe Text
a -> DatasetSchema
s {$sel:schema:DatasetSchema' :: Maybe Text
schema = Maybe Text
a} :: DatasetSchema)

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

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

-- | The date and time (in Unix time) that the schema was created.
datasetSchema_creationDateTime :: Lens.Lens' DatasetSchema (Prelude.Maybe Prelude.UTCTime)
datasetSchema_creationDateTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSchema -> f DatasetSchema
datasetSchema_creationDateTime = (DatasetSchema -> Maybe POSIX)
-> (DatasetSchema -> Maybe POSIX -> DatasetSchema)
-> Lens DatasetSchema DatasetSchema (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DatasetSchema' {Maybe POSIX
creationDateTime :: Maybe POSIX
$sel:creationDateTime:DatasetSchema' :: DatasetSchema -> Maybe POSIX
creationDateTime} -> Maybe POSIX
creationDateTime) (\s :: DatasetSchema
s@DatasetSchema' {} Maybe POSIX
a -> DatasetSchema
s {$sel:creationDateTime:DatasetSchema' :: Maybe POSIX
creationDateTime = Maybe POSIX
a} :: DatasetSchema) ((Maybe POSIX -> f (Maybe POSIX))
 -> DatasetSchema -> f DatasetSchema)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DatasetSchema
-> f DatasetSchema
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromJSON DatasetSchema where
  parseJSON :: Value -> Parser DatasetSchema
parseJSON =
    String
-> (Object -> Parser DatasetSchema)
-> Value
-> Parser DatasetSchema
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DatasetSchema"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> DatasetSchema
DatasetSchema'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> DatasetSchema)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe POSIX -> DatasetSchema)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdatedDateTime")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe POSIX -> DatasetSchema)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe POSIX -> DatasetSchema)
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
"schema")
            Parser (Maybe Text -> Maybe Text -> Maybe POSIX -> DatasetSchema)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe POSIX -> DatasetSchema)
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")
            Parser (Maybe Text -> Maybe POSIX -> DatasetSchema)
-> Parser (Maybe Text) -> Parser (Maybe POSIX -> DatasetSchema)
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
"name")
            Parser (Maybe POSIX -> DatasetSchema)
-> Parser (Maybe POSIX) -> Parser DatasetSchema
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"creationDateTime")
      )

instance Prelude.Hashable DatasetSchema

instance Prelude.NFData DatasetSchema