{-# 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.MediaLive.Types.OutputLocationRef
-- 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.MediaLive.Types.OutputLocationRef 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

-- | Reference to an OutputDestination ID defined in the channel
--
-- /See:/ 'newOutputLocationRef' smart constructor.
data OutputLocationRef = OutputLocationRef'
  { OutputLocationRef -> Maybe Text
destinationRefId :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputLocationRef -> OutputLocationRef -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputLocationRef -> OutputLocationRef -> Bool
$c/= :: OutputLocationRef -> OutputLocationRef -> Bool
== :: OutputLocationRef -> OutputLocationRef -> Bool
$c== :: OutputLocationRef -> OutputLocationRef -> Bool
Prelude.Eq, ReadPrec [OutputLocationRef]
ReadPrec OutputLocationRef
Int -> ReadS OutputLocationRef
ReadS [OutputLocationRef]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputLocationRef]
$creadListPrec :: ReadPrec [OutputLocationRef]
readPrec :: ReadPrec OutputLocationRef
$creadPrec :: ReadPrec OutputLocationRef
readList :: ReadS [OutputLocationRef]
$creadList :: ReadS [OutputLocationRef]
readsPrec :: Int -> ReadS OutputLocationRef
$creadsPrec :: Int -> ReadS OutputLocationRef
Prelude.Read, Int -> OutputLocationRef -> ShowS
[OutputLocationRef] -> ShowS
OutputLocationRef -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputLocationRef] -> ShowS
$cshowList :: [OutputLocationRef] -> ShowS
show :: OutputLocationRef -> String
$cshow :: OutputLocationRef -> String
showsPrec :: Int -> OutputLocationRef -> ShowS
$cshowsPrec :: Int -> OutputLocationRef -> ShowS
Prelude.Show, forall x. Rep OutputLocationRef x -> OutputLocationRef
forall x. OutputLocationRef -> Rep OutputLocationRef x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputLocationRef x -> OutputLocationRef
$cfrom :: forall x. OutputLocationRef -> Rep OutputLocationRef x
Prelude.Generic)

-- |
-- Create a value of 'OutputLocationRef' 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:
--
-- 'destinationRefId', 'outputLocationRef_destinationRefId' - Undocumented member.
newOutputLocationRef ::
  OutputLocationRef
newOutputLocationRef :: OutputLocationRef
newOutputLocationRef =
  OutputLocationRef'
    { $sel:destinationRefId:OutputLocationRef' :: Maybe Text
destinationRefId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
outputLocationRef_destinationRefId :: Lens.Lens' OutputLocationRef (Prelude.Maybe Prelude.Text)
outputLocationRef_destinationRefId :: Lens' OutputLocationRef (Maybe Text)
outputLocationRef_destinationRefId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputLocationRef' {Maybe Text
destinationRefId :: Maybe Text
$sel:destinationRefId:OutputLocationRef' :: OutputLocationRef -> Maybe Text
destinationRefId} -> Maybe Text
destinationRefId) (\s :: OutputLocationRef
s@OutputLocationRef' {} Maybe Text
a -> OutputLocationRef
s {$sel:destinationRefId:OutputLocationRef' :: Maybe Text
destinationRefId = Maybe Text
a} :: OutputLocationRef)

instance Data.FromJSON OutputLocationRef where
  parseJSON :: Value -> Parser OutputLocationRef
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutputLocationRef"
      ( \Object
x ->
          Maybe Text -> OutputLocationRef
OutputLocationRef'
            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
"destinationRefId")
      )

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

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

instance Data.ToJSON OutputLocationRef where
  toJSON :: OutputLocationRef -> Value
toJSON OutputLocationRef' {Maybe Text
destinationRefId :: Maybe Text
$sel:destinationRefId:OutputLocationRef' :: OutputLocationRef -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"destinationRefId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
destinationRefId
          ]
      )