{-# 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.SageMakerGeoSpatial.Types.ItemSource
-- 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.SageMakerGeoSpatial.Types.ItemSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMakerGeoSpatial.Types.AssetValue
import Amazonka.SageMakerGeoSpatial.Types.Geometry
import Amazonka.SageMakerGeoSpatial.Types.Properties

-- | Structure representing the items in the response for
-- SearchRasterDataCollection.
--
-- /See:/ 'newItemSource' smart constructor.
data ItemSource = ItemSource'
  { ItemSource -> Maybe (HashMap Text AssetValue)
assets :: Prelude.Maybe (Prelude.HashMap Prelude.Text AssetValue),
    ItemSource -> Maybe Properties
properties :: Prelude.Maybe Properties,
    ItemSource -> POSIX
dateTime :: Data.POSIX,
    ItemSource -> Geometry
geometry :: Geometry,
    -- | A unique Id for the source item.
    ItemSource -> Text
id :: Prelude.Text
  }
  deriving (ItemSource -> ItemSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ItemSource -> ItemSource -> Bool
$c/= :: ItemSource -> ItemSource -> Bool
== :: ItemSource -> ItemSource -> Bool
$c== :: ItemSource -> ItemSource -> Bool
Prelude.Eq, Int -> ItemSource -> ShowS
[ItemSource] -> ShowS
ItemSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ItemSource] -> ShowS
$cshowList :: [ItemSource] -> ShowS
show :: ItemSource -> String
$cshow :: ItemSource -> String
showsPrec :: Int -> ItemSource -> ShowS
$cshowsPrec :: Int -> ItemSource -> ShowS
Prelude.Show, forall x. Rep ItemSource x -> ItemSource
forall x. ItemSource -> Rep ItemSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ItemSource x -> ItemSource
$cfrom :: forall x. ItemSource -> Rep ItemSource x
Prelude.Generic)

-- |
-- Create a value of 'ItemSource' 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:
--
-- 'assets', 'itemSource_assets' -
--
-- 'properties', 'itemSource_properties' -
--
-- 'dateTime', 'itemSource_dateTime' -
--
-- 'geometry', 'itemSource_geometry' -
--
-- 'id', 'itemSource_id' - A unique Id for the source item.
newItemSource ::
  -- | 'dateTime'
  Prelude.UTCTime ->
  -- | 'geometry'
  Geometry ->
  -- | 'id'
  Prelude.Text ->
  ItemSource
newItemSource :: UTCTime -> Geometry -> Text -> ItemSource
newItemSource UTCTime
pDateTime_ Geometry
pGeometry_ Text
pId_ =
  ItemSource'
    { $sel:assets:ItemSource' :: Maybe (HashMap Text AssetValue)
assets = forall a. Maybe a
Prelude.Nothing,
      $sel:properties:ItemSource' :: Maybe Properties
properties = forall a. Maybe a
Prelude.Nothing,
      $sel:dateTime:ItemSource' :: POSIX
dateTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pDateTime_,
      $sel:geometry:ItemSource' :: Geometry
geometry = Geometry
pGeometry_,
      $sel:id:ItemSource' :: Text
id = Text
pId_
    }

itemSource_assets :: Lens.Lens' ItemSource (Prelude.Maybe (Prelude.HashMap Prelude.Text AssetValue))
itemSource_assets :: Lens' ItemSource (Maybe (HashMap Text AssetValue))
itemSource_assets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemSource' {Maybe (HashMap Text AssetValue)
assets :: Maybe (HashMap Text AssetValue)
$sel:assets:ItemSource' :: ItemSource -> Maybe (HashMap Text AssetValue)
assets} -> Maybe (HashMap Text AssetValue)
assets) (\s :: ItemSource
s@ItemSource' {} Maybe (HashMap Text AssetValue)
a -> ItemSource
s {$sel:assets:ItemSource' :: Maybe (HashMap Text AssetValue)
assets = Maybe (HashMap Text AssetValue)
a} :: ItemSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

itemSource_properties :: Lens.Lens' ItemSource (Prelude.Maybe Properties)
itemSource_properties :: Lens' ItemSource (Maybe Properties)
itemSource_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemSource' {Maybe Properties
properties :: Maybe Properties
$sel:properties:ItemSource' :: ItemSource -> Maybe Properties
properties} -> Maybe Properties
properties) (\s :: ItemSource
s@ItemSource' {} Maybe Properties
a -> ItemSource
s {$sel:properties:ItemSource' :: Maybe Properties
properties = Maybe Properties
a} :: ItemSource)

itemSource_dateTime :: Lens.Lens' ItemSource Prelude.UTCTime
itemSource_dateTime :: Lens' ItemSource UTCTime
itemSource_dateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemSource' {POSIX
dateTime :: POSIX
$sel:dateTime:ItemSource' :: ItemSource -> POSIX
dateTime} -> POSIX
dateTime) (\s :: ItemSource
s@ItemSource' {} POSIX
a -> ItemSource
s {$sel:dateTime:ItemSource' :: POSIX
dateTime = POSIX
a} :: ItemSource) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

itemSource_geometry :: Lens.Lens' ItemSource Geometry
itemSource_geometry :: Lens' ItemSource Geometry
itemSource_geometry = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemSource' {Geometry
geometry :: Geometry
$sel:geometry:ItemSource' :: ItemSource -> Geometry
geometry} -> Geometry
geometry) (\s :: ItemSource
s@ItemSource' {} Geometry
a -> ItemSource
s {$sel:geometry:ItemSource' :: Geometry
geometry = Geometry
a} :: ItemSource)

-- | A unique Id for the source item.
itemSource_id :: Lens.Lens' ItemSource Prelude.Text
itemSource_id :: Lens' ItemSource Text
itemSource_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ItemSource' {Text
id :: Text
$sel:id:ItemSource' :: ItemSource -> Text
id} -> Text
id) (\s :: ItemSource
s@ItemSource' {} Text
a -> ItemSource
s {$sel:id:ItemSource' :: Text
id = Text
a} :: ItemSource)

instance Data.FromJSON ItemSource where
  parseJSON :: Value -> Parser ItemSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ItemSource"
      ( \Object
x ->
          Maybe (HashMap Text AssetValue)
-> Maybe Properties -> POSIX -> Geometry -> Text -> ItemSource
ItemSource'
            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
"Assets" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"Properties")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"DateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Geometry")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Id")
      )

instance Prelude.Hashable ItemSource where
  hashWithSalt :: Int -> ItemSource -> Int
hashWithSalt Int
_salt ItemSource' {Maybe (HashMap Text AssetValue)
Maybe Properties
Text
POSIX
Geometry
id :: Text
geometry :: Geometry
dateTime :: POSIX
properties :: Maybe Properties
assets :: Maybe (HashMap Text AssetValue)
$sel:id:ItemSource' :: ItemSource -> Text
$sel:geometry:ItemSource' :: ItemSource -> Geometry
$sel:dateTime:ItemSource' :: ItemSource -> POSIX
$sel:properties:ItemSource' :: ItemSource -> Maybe Properties
$sel:assets:ItemSource' :: ItemSource -> Maybe (HashMap Text AssetValue)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text AssetValue)
assets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Properties
properties
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
dateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Geometry
geometry
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData ItemSource where
  rnf :: ItemSource -> ()
rnf ItemSource' {Maybe (HashMap Text AssetValue)
Maybe Properties
Text
POSIX
Geometry
id :: Text
geometry :: Geometry
dateTime :: POSIX
properties :: Maybe Properties
assets :: Maybe (HashMap Text AssetValue)
$sel:id:ItemSource' :: ItemSource -> Text
$sel:geometry:ItemSource' :: ItemSource -> Geometry
$sel:dateTime:ItemSource' :: ItemSource -> POSIX
$sel:properties:ItemSource' :: ItemSource -> Maybe Properties
$sel:assets:ItemSource' :: ItemSource -> Maybe (HashMap Text AssetValue)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text AssetValue)
assets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Properties
properties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
dateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Geometry
geometry
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id