{-# 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.LookoutVision.Types.ImageSource
-- 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.LookoutVision.Types.ImageSource where

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

-- | The source for an image.
--
-- /See:/ 'newImageSource' smart constructor.
data ImageSource = ImageSource'
  { -- | The type of the image.
    ImageSource -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (ImageSource -> ImageSource -> Bool
(ImageSource -> ImageSource -> Bool)
-> (ImageSource -> ImageSource -> Bool) -> Eq ImageSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageSource -> ImageSource -> Bool
$c/= :: ImageSource -> ImageSource -> Bool
== :: ImageSource -> ImageSource -> Bool
$c== :: ImageSource -> ImageSource -> Bool
Prelude.Eq, ReadPrec [ImageSource]
ReadPrec ImageSource
Int -> ReadS ImageSource
ReadS [ImageSource]
(Int -> ReadS ImageSource)
-> ReadS [ImageSource]
-> ReadPrec ImageSource
-> ReadPrec [ImageSource]
-> Read ImageSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageSource]
$creadListPrec :: ReadPrec [ImageSource]
readPrec :: ReadPrec ImageSource
$creadPrec :: ReadPrec ImageSource
readList :: ReadS [ImageSource]
$creadList :: ReadS [ImageSource]
readsPrec :: Int -> ReadS ImageSource
$creadsPrec :: Int -> ReadS ImageSource
Prelude.Read, Int -> ImageSource -> ShowS
[ImageSource] -> ShowS
ImageSource -> String
(Int -> ImageSource -> ShowS)
-> (ImageSource -> String)
-> ([ImageSource] -> ShowS)
-> Show ImageSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageSource] -> ShowS
$cshowList :: [ImageSource] -> ShowS
show :: ImageSource -> String
$cshow :: ImageSource -> String
showsPrec :: Int -> ImageSource -> ShowS
$cshowsPrec :: Int -> ImageSource -> ShowS
Prelude.Show, (forall x. ImageSource -> Rep ImageSource x)
-> (forall x. Rep ImageSource x -> ImageSource)
-> Generic ImageSource
forall x. Rep ImageSource x -> ImageSource
forall x. ImageSource -> Rep ImageSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageSource x -> ImageSource
$cfrom :: forall x. ImageSource -> Rep ImageSource x
Prelude.Generic)

-- |
-- Create a value of 'ImageSource' 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:
--
-- 'type'', 'imageSource_type' - The type of the image.
newImageSource ::
  ImageSource
newImageSource :: ImageSource
newImageSource =
  ImageSource' :: Maybe Text -> ImageSource
ImageSource' {$sel:type':ImageSource' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The type of the image.
imageSource_type :: Lens.Lens' ImageSource (Prelude.Maybe Prelude.Text)
imageSource_type :: (Maybe Text -> f (Maybe Text)) -> ImageSource -> f ImageSource
imageSource_type = (ImageSource -> Maybe Text)
-> (ImageSource -> Maybe Text -> ImageSource)
-> Lens ImageSource ImageSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageSource' {Maybe Text
type' :: Maybe Text
$sel:type':ImageSource' :: ImageSource -> Maybe Text
type'} -> Maybe Text
type') (\s :: ImageSource
s@ImageSource' {} Maybe Text
a -> ImageSource
s {$sel:type':ImageSource' :: Maybe Text
type' = Maybe Text
a} :: ImageSource)

instance Core.FromJSON ImageSource where
  parseJSON :: Value -> Parser ImageSource
parseJSON =
    String
-> (Object -> Parser ImageSource) -> Value -> Parser ImageSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImageSource"
      (\Object
x -> Maybe Text -> ImageSource
ImageSource' (Maybe Text -> ImageSource)
-> Parser (Maybe Text) -> Parser ImageSource
forall (f :: * -> *) a b. Functor 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
"Type"))

instance Prelude.Hashable ImageSource

instance Prelude.NFData ImageSource