{-# 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.KinesisVideo.Types.UploaderConfig
-- 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.KinesisVideo.Types.UploaderConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KinesisVideo.Types.ScheduleConfig
import qualified Amazonka.Prelude as Prelude

-- | The configuration that consists of the @ScheduleExpression@ and the
-- @DurationInMinutesdetails@, that specify the scheduling to record from a
-- camera, or local media file, onto the Edge Agent. If the
-- @ScheduleExpression@ is not provided, then the Edge Agent will always be
-- in upload mode.
--
-- /See:/ 'newUploaderConfig' smart constructor.
data UploaderConfig = UploaderConfig'
  { -- | The configuration that consists of the @ScheduleExpression@ and the
    -- @DurationInMinutes@details that specify the scheduling to record from a
    -- camera, or local media file, onto the Edge Agent. If the
    -- @ScheduleExpression@ is not provided, then the Edge Agent will always be
    -- in recording mode.
    UploaderConfig -> ScheduleConfig
scheduleConfig :: ScheduleConfig
  }
  deriving (UploaderConfig -> UploaderConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UploaderConfig -> UploaderConfig -> Bool
$c/= :: UploaderConfig -> UploaderConfig -> Bool
== :: UploaderConfig -> UploaderConfig -> Bool
$c== :: UploaderConfig -> UploaderConfig -> Bool
Prelude.Eq, ReadPrec [UploaderConfig]
ReadPrec UploaderConfig
Int -> ReadS UploaderConfig
ReadS [UploaderConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UploaderConfig]
$creadListPrec :: ReadPrec [UploaderConfig]
readPrec :: ReadPrec UploaderConfig
$creadPrec :: ReadPrec UploaderConfig
readList :: ReadS [UploaderConfig]
$creadList :: ReadS [UploaderConfig]
readsPrec :: Int -> ReadS UploaderConfig
$creadsPrec :: Int -> ReadS UploaderConfig
Prelude.Read, Int -> UploaderConfig -> ShowS
[UploaderConfig] -> ShowS
UploaderConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UploaderConfig] -> ShowS
$cshowList :: [UploaderConfig] -> ShowS
show :: UploaderConfig -> String
$cshow :: UploaderConfig -> String
showsPrec :: Int -> UploaderConfig -> ShowS
$cshowsPrec :: Int -> UploaderConfig -> ShowS
Prelude.Show, forall x. Rep UploaderConfig x -> UploaderConfig
forall x. UploaderConfig -> Rep UploaderConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UploaderConfig x -> UploaderConfig
$cfrom :: forall x. UploaderConfig -> Rep UploaderConfig x
Prelude.Generic)

-- |
-- Create a value of 'UploaderConfig' 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:
--
-- 'scheduleConfig', 'uploaderConfig_scheduleConfig' - The configuration that consists of the @ScheduleExpression@ and the
-- @DurationInMinutes@details that specify the scheduling to record from a
-- camera, or local media file, onto the Edge Agent. If the
-- @ScheduleExpression@ is not provided, then the Edge Agent will always be
-- in recording mode.
newUploaderConfig ::
  -- | 'scheduleConfig'
  ScheduleConfig ->
  UploaderConfig
newUploaderConfig :: ScheduleConfig -> UploaderConfig
newUploaderConfig ScheduleConfig
pScheduleConfig_ =
  UploaderConfig' {$sel:scheduleConfig:UploaderConfig' :: ScheduleConfig
scheduleConfig = ScheduleConfig
pScheduleConfig_}

-- | The configuration that consists of the @ScheduleExpression@ and the
-- @DurationInMinutes@details that specify the scheduling to record from a
-- camera, or local media file, onto the Edge Agent. If the
-- @ScheduleExpression@ is not provided, then the Edge Agent will always be
-- in recording mode.
uploaderConfig_scheduleConfig :: Lens.Lens' UploaderConfig ScheduleConfig
uploaderConfig_scheduleConfig :: Lens' UploaderConfig ScheduleConfig
uploaderConfig_scheduleConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UploaderConfig' {ScheduleConfig
scheduleConfig :: ScheduleConfig
$sel:scheduleConfig:UploaderConfig' :: UploaderConfig -> ScheduleConfig
scheduleConfig} -> ScheduleConfig
scheduleConfig) (\s :: UploaderConfig
s@UploaderConfig' {} ScheduleConfig
a -> UploaderConfig
s {$sel:scheduleConfig:UploaderConfig' :: ScheduleConfig
scheduleConfig = ScheduleConfig
a} :: UploaderConfig)

instance Data.FromJSON UploaderConfig where
  parseJSON :: Value -> Parser UploaderConfig
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UploaderConfig"
      ( \Object
x ->
          ScheduleConfig -> UploaderConfig
UploaderConfig'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ScheduleConfig")
      )

instance Prelude.Hashable UploaderConfig where
  hashWithSalt :: Int -> UploaderConfig -> Int
hashWithSalt Int
_salt UploaderConfig' {ScheduleConfig
scheduleConfig :: ScheduleConfig
$sel:scheduleConfig:UploaderConfig' :: UploaderConfig -> ScheduleConfig
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ScheduleConfig
scheduleConfig

instance Prelude.NFData UploaderConfig where
  rnf :: UploaderConfig -> ()
rnf UploaderConfig' {ScheduleConfig
scheduleConfig :: ScheduleConfig
$sel:scheduleConfig:UploaderConfig' :: UploaderConfig -> ScheduleConfig
..} = forall a. NFData a => a -> ()
Prelude.rnf ScheduleConfig
scheduleConfig

instance Data.ToJSON UploaderConfig where
  toJSON :: UploaderConfig -> Value
toJSON UploaderConfig' {ScheduleConfig
scheduleConfig :: ScheduleConfig
$sel:scheduleConfig:UploaderConfig' :: UploaderConfig -> ScheduleConfig
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ScheduleConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ScheduleConfig
scheduleConfig)
          ]
      )