{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.LookoutVision.Types.ImageSource 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

-- | 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
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]
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
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. 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' {$sel:type':ImageSource' :: Maybe Text
type' = forall a. Maybe a
Prelude.Nothing}

-- | The type of the image.
imageSource_type :: Lens.Lens' ImageSource (Prelude.Maybe Prelude.Text)
imageSource_type :: Lens' ImageSource (Maybe Text)
imageSource_type = 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 Data.FromJSON ImageSource where
  parseJSON :: Value -> Parser ImageSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ImageSource"
      (\Object
x -> Maybe Text -> ImageSource
ImageSource' 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
"Type"))

instance Prelude.Hashable ImageSource where
  hashWithSalt :: Int -> ImageSource -> Int
hashWithSalt Int
_salt ImageSource' {Maybe Text
type' :: Maybe Text
$sel:type':ImageSource' :: ImageSource -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
type'

instance Prelude.NFData ImageSource where
  rnf :: ImageSource -> ()
rnf ImageSource' {Maybe Text
type' :: Maybe Text
$sel:type':ImageSource' :: ImageSource -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
type'