{-# 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.GroundStation.Types.Source
-- 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.GroundStation.Types.Source where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GroundStation.Types.ConfigCapabilityType
import Amazonka.GroundStation.Types.ConfigDetails
import qualified Amazonka.Prelude as Prelude

-- | Dataflow details for the source side.
--
-- /See:/ 'newSource' smart constructor.
data Source = Source'
  { -- | Additional details for a @Config@, if type is @dataflow-endpoint@ or
    -- @antenna-downlink-demod-decode@
    Source -> Maybe ConfigDetails
configDetails :: Prelude.Maybe ConfigDetails,
    -- | UUID of a @Config@.
    Source -> Maybe Text
configId :: Prelude.Maybe Prelude.Text,
    -- | Type of a @Config@.
    Source -> Maybe ConfigCapabilityType
configType :: Prelude.Maybe ConfigCapabilityType,
    -- | Region of a dataflow source.
    Source -> Maybe Text
dataflowSourceRegion :: Prelude.Maybe Prelude.Text
  }
  deriving (Source -> Source -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Source -> Source -> Bool
$c/= :: Source -> Source -> Bool
== :: Source -> Source -> Bool
$c== :: Source -> Source -> Bool
Prelude.Eq, ReadPrec [Source]
ReadPrec Source
Int -> ReadS Source
ReadS [Source]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Source]
$creadListPrec :: ReadPrec [Source]
readPrec :: ReadPrec Source
$creadPrec :: ReadPrec Source
readList :: ReadS [Source]
$creadList :: ReadS [Source]
readsPrec :: Int -> ReadS Source
$creadsPrec :: Int -> ReadS Source
Prelude.Read, Int -> Source -> ShowS
[Source] -> ShowS
Source -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Source] -> ShowS
$cshowList :: [Source] -> ShowS
show :: Source -> String
$cshow :: Source -> String
showsPrec :: Int -> Source -> ShowS
$cshowsPrec :: Int -> Source -> ShowS
Prelude.Show, forall x. Rep Source x -> Source
forall x. Source -> Rep Source x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Source x -> Source
$cfrom :: forall x. Source -> Rep Source x
Prelude.Generic)

-- |
-- Create a value of 'Source' 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:
--
-- 'configDetails', 'source_configDetails' - Additional details for a @Config@, if type is @dataflow-endpoint@ or
-- @antenna-downlink-demod-decode@
--
-- 'configId', 'source_configId' - UUID of a @Config@.
--
-- 'configType', 'source_configType' - Type of a @Config@.
--
-- 'dataflowSourceRegion', 'source_dataflowSourceRegion' - Region of a dataflow source.
newSource ::
  Source
newSource :: Source
newSource =
  Source'
    { $sel:configDetails:Source' :: Maybe ConfigDetails
configDetails = forall a. Maybe a
Prelude.Nothing,
      $sel:configId:Source' :: Maybe Text
configId = forall a. Maybe a
Prelude.Nothing,
      $sel:configType:Source' :: Maybe ConfigCapabilityType
configType = forall a. Maybe a
Prelude.Nothing,
      $sel:dataflowSourceRegion:Source' :: Maybe Text
dataflowSourceRegion = forall a. Maybe a
Prelude.Nothing
    }

-- | Additional details for a @Config@, if type is @dataflow-endpoint@ or
-- @antenna-downlink-demod-decode@
source_configDetails :: Lens.Lens' Source (Prelude.Maybe ConfigDetails)
source_configDetails :: Lens' Source (Maybe ConfigDetails)
source_configDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe ConfigDetails
configDetails :: Maybe ConfigDetails
$sel:configDetails:Source' :: Source -> Maybe ConfigDetails
configDetails} -> Maybe ConfigDetails
configDetails) (\s :: Source
s@Source' {} Maybe ConfigDetails
a -> Source
s {$sel:configDetails:Source' :: Maybe ConfigDetails
configDetails = Maybe ConfigDetails
a} :: Source)

-- | UUID of a @Config@.
source_configId :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_configId :: Lens' Source (Maybe Text)
source_configId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
configId :: Maybe Text
$sel:configId:Source' :: Source -> Maybe Text
configId} -> Maybe Text
configId) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:configId:Source' :: Maybe Text
configId = Maybe Text
a} :: Source)

-- | Type of a @Config@.
source_configType :: Lens.Lens' Source (Prelude.Maybe ConfigCapabilityType)
source_configType :: Lens' Source (Maybe ConfigCapabilityType)
source_configType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe ConfigCapabilityType
configType :: Maybe ConfigCapabilityType
$sel:configType:Source' :: Source -> Maybe ConfigCapabilityType
configType} -> Maybe ConfigCapabilityType
configType) (\s :: Source
s@Source' {} Maybe ConfigCapabilityType
a -> Source
s {$sel:configType:Source' :: Maybe ConfigCapabilityType
configType = Maybe ConfigCapabilityType
a} :: Source)

-- | Region of a dataflow source.
source_dataflowSourceRegion :: Lens.Lens' Source (Prelude.Maybe Prelude.Text)
source_dataflowSourceRegion :: Lens' Source (Maybe Text)
source_dataflowSourceRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Source' {Maybe Text
dataflowSourceRegion :: Maybe Text
$sel:dataflowSourceRegion:Source' :: Source -> Maybe Text
dataflowSourceRegion} -> Maybe Text
dataflowSourceRegion) (\s :: Source
s@Source' {} Maybe Text
a -> Source
s {$sel:dataflowSourceRegion:Source' :: Maybe Text
dataflowSourceRegion = Maybe Text
a} :: Source)

instance Data.FromJSON Source where
  parseJSON :: Value -> Parser Source
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Source"
      ( \Object
x ->
          Maybe ConfigDetails
-> Maybe Text -> Maybe ConfigCapabilityType -> Maybe Text -> Source
Source'
            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
"configDetails")
            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
"configId")
            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
"configType")
            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
"dataflowSourceRegion")
      )

instance Prelude.Hashable Source where
  hashWithSalt :: Int -> Source -> Int
hashWithSalt Int
_salt Source' {Maybe Text
Maybe ConfigCapabilityType
Maybe ConfigDetails
dataflowSourceRegion :: Maybe Text
configType :: Maybe ConfigCapabilityType
configId :: Maybe Text
configDetails :: Maybe ConfigDetails
$sel:dataflowSourceRegion:Source' :: Source -> Maybe Text
$sel:configType:Source' :: Source -> Maybe ConfigCapabilityType
$sel:configId:Source' :: Source -> Maybe Text
$sel:configDetails:Source' :: Source -> Maybe ConfigDetails
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigDetails
configDetails
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigCapabilityType
configType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dataflowSourceRegion

instance Prelude.NFData Source where
  rnf :: Source -> ()
rnf Source' {Maybe Text
Maybe ConfigCapabilityType
Maybe ConfigDetails
dataflowSourceRegion :: Maybe Text
configType :: Maybe ConfigCapabilityType
configId :: Maybe Text
configDetails :: Maybe ConfigDetails
$sel:dataflowSourceRegion:Source' :: Source -> Maybe Text
$sel:configType:Source' :: Source -> Maybe ConfigCapabilityType
$sel:configId:Source' :: Source -> Maybe Text
$sel:configDetails:Source' :: Source -> Maybe ConfigDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigDetails
configDetails
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigCapabilityType
configType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dataflowSourceRegion