{-# 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.VideoSelector
-- 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.VideoSelector where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MediaLive.Types.VideoSelectorColorSpace
import Amazonka.MediaLive.Types.VideoSelectorColorSpaceSettings
import Amazonka.MediaLive.Types.VideoSelectorColorSpaceUsage
import Amazonka.MediaLive.Types.VideoSelectorSettings
import qualified Amazonka.Prelude as Prelude

-- | Specifies a particular video stream within an input source. An input may
-- have only a single video selector.
--
-- /See:/ 'newVideoSelector' smart constructor.
data VideoSelector = VideoSelector'
  { -- | Specifies the color space of an input. This setting works in tandem with
    -- colorSpaceUsage and a video description\'s colorSpaceSettingsChoice to
    -- determine if any conversion will be performed.
    VideoSelector -> Maybe VideoSelectorColorSpace
colorSpace :: Prelude.Maybe VideoSelectorColorSpace,
    -- | Color space settings
    VideoSelector -> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings :: Prelude.Maybe VideoSelectorColorSpaceSettings,
    -- | Applies only if colorSpace is a value other than follow. This field
    -- controls how the value in the colorSpace field will be used. fallback
    -- means that when the input does include color space data, that data will
    -- be used, but when the input has no color space data, the value in
    -- colorSpace will be used. Choose fallback if your input is sometimes
    -- missing color space data, but when it does have color space data, that
    -- data is correct. force means to always use the value in colorSpace.
    -- Choose force if your input usually has no color space data or might have
    -- unreliable color space data.
    VideoSelector -> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage :: Prelude.Maybe VideoSelectorColorSpaceUsage,
    -- | The video selector settings.
    VideoSelector -> Maybe VideoSelectorSettings
selectorSettings :: Prelude.Maybe VideoSelectorSettings
  }
  deriving (VideoSelector -> VideoSelector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VideoSelector -> VideoSelector -> Bool
$c/= :: VideoSelector -> VideoSelector -> Bool
== :: VideoSelector -> VideoSelector -> Bool
$c== :: VideoSelector -> VideoSelector -> Bool
Prelude.Eq, ReadPrec [VideoSelector]
ReadPrec VideoSelector
Int -> ReadS VideoSelector
ReadS [VideoSelector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VideoSelector]
$creadListPrec :: ReadPrec [VideoSelector]
readPrec :: ReadPrec VideoSelector
$creadPrec :: ReadPrec VideoSelector
readList :: ReadS [VideoSelector]
$creadList :: ReadS [VideoSelector]
readsPrec :: Int -> ReadS VideoSelector
$creadsPrec :: Int -> ReadS VideoSelector
Prelude.Read, Int -> VideoSelector -> ShowS
[VideoSelector] -> ShowS
VideoSelector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VideoSelector] -> ShowS
$cshowList :: [VideoSelector] -> ShowS
show :: VideoSelector -> String
$cshow :: VideoSelector -> String
showsPrec :: Int -> VideoSelector -> ShowS
$cshowsPrec :: Int -> VideoSelector -> ShowS
Prelude.Show, forall x. Rep VideoSelector x -> VideoSelector
forall x. VideoSelector -> Rep VideoSelector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VideoSelector x -> VideoSelector
$cfrom :: forall x. VideoSelector -> Rep VideoSelector x
Prelude.Generic)

-- |
-- Create a value of 'VideoSelector' 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:
--
-- 'colorSpace', 'videoSelector_colorSpace' - Specifies the color space of an input. This setting works in tandem with
-- colorSpaceUsage and a video description\'s colorSpaceSettingsChoice to
-- determine if any conversion will be performed.
--
-- 'colorSpaceSettings', 'videoSelector_colorSpaceSettings' - Color space settings
--
-- 'colorSpaceUsage', 'videoSelector_colorSpaceUsage' - Applies only if colorSpace is a value other than follow. This field
-- controls how the value in the colorSpace field will be used. fallback
-- means that when the input does include color space data, that data will
-- be used, but when the input has no color space data, the value in
-- colorSpace will be used. Choose fallback if your input is sometimes
-- missing color space data, but when it does have color space data, that
-- data is correct. force means to always use the value in colorSpace.
-- Choose force if your input usually has no color space data or might have
-- unreliable color space data.
--
-- 'selectorSettings', 'videoSelector_selectorSettings' - The video selector settings.
newVideoSelector ::
  VideoSelector
newVideoSelector :: VideoSelector
newVideoSelector =
  VideoSelector'
    { $sel:colorSpace:VideoSelector' :: Maybe VideoSelectorColorSpace
colorSpace = forall a. Maybe a
Prelude.Nothing,
      $sel:colorSpaceSettings:VideoSelector' :: Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:colorSpaceUsage:VideoSelector' :: Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage = forall a. Maybe a
Prelude.Nothing,
      $sel:selectorSettings:VideoSelector' :: Maybe VideoSelectorSettings
selectorSettings = forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the color space of an input. This setting works in tandem with
-- colorSpaceUsage and a video description\'s colorSpaceSettingsChoice to
-- determine if any conversion will be performed.
videoSelector_colorSpace :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorColorSpace)
videoSelector_colorSpace :: Lens' VideoSelector (Maybe VideoSelectorColorSpace)
videoSelector_colorSpace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorColorSpace
colorSpace :: Maybe VideoSelectorColorSpace
$sel:colorSpace:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpace
colorSpace} -> Maybe VideoSelectorColorSpace
colorSpace) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorColorSpace
a -> VideoSelector
s {$sel:colorSpace:VideoSelector' :: Maybe VideoSelectorColorSpace
colorSpace = Maybe VideoSelectorColorSpace
a} :: VideoSelector)

-- | Color space settings
videoSelector_colorSpaceSettings :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorColorSpaceSettings)
videoSelector_colorSpaceSettings :: Lens' VideoSelector (Maybe VideoSelectorColorSpaceSettings)
videoSelector_colorSpaceSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings :: Maybe VideoSelectorColorSpaceSettings
$sel:colorSpaceSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings} -> Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorColorSpaceSettings
a -> VideoSelector
s {$sel:colorSpaceSettings:VideoSelector' :: Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings = Maybe VideoSelectorColorSpaceSettings
a} :: VideoSelector)

-- | Applies only if colorSpace is a value other than follow. This field
-- controls how the value in the colorSpace field will be used. fallback
-- means that when the input does include color space data, that data will
-- be used, but when the input has no color space data, the value in
-- colorSpace will be used. Choose fallback if your input is sometimes
-- missing color space data, but when it does have color space data, that
-- data is correct. force means to always use the value in colorSpace.
-- Choose force if your input usually has no color space data or might have
-- unreliable color space data.
videoSelector_colorSpaceUsage :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorColorSpaceUsage)
videoSelector_colorSpaceUsage :: Lens' VideoSelector (Maybe VideoSelectorColorSpaceUsage)
videoSelector_colorSpaceUsage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage :: Maybe VideoSelectorColorSpaceUsage
$sel:colorSpaceUsage:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage} -> Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorColorSpaceUsage
a -> VideoSelector
s {$sel:colorSpaceUsage:VideoSelector' :: Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage = Maybe VideoSelectorColorSpaceUsage
a} :: VideoSelector)

-- | The video selector settings.
videoSelector_selectorSettings :: Lens.Lens' VideoSelector (Prelude.Maybe VideoSelectorSettings)
videoSelector_selectorSettings :: Lens' VideoSelector (Maybe VideoSelectorSettings)
videoSelector_selectorSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VideoSelector' {Maybe VideoSelectorSettings
selectorSettings :: Maybe VideoSelectorSettings
$sel:selectorSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorSettings
selectorSettings} -> Maybe VideoSelectorSettings
selectorSettings) (\s :: VideoSelector
s@VideoSelector' {} Maybe VideoSelectorSettings
a -> VideoSelector
s {$sel:selectorSettings:VideoSelector' :: Maybe VideoSelectorSettings
selectorSettings = Maybe VideoSelectorSettings
a} :: VideoSelector)

instance Data.FromJSON VideoSelector where
  parseJSON :: Value -> Parser VideoSelector
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VideoSelector"
      ( \Object
x ->
          Maybe VideoSelectorColorSpace
-> Maybe VideoSelectorColorSpaceSettings
-> Maybe VideoSelectorColorSpaceUsage
-> Maybe VideoSelectorSettings
-> VideoSelector
VideoSelector'
            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
"colorSpace")
            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
"colorSpaceSettings")
            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
"colorSpaceUsage")
            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
"selectorSettings")
      )

instance Prelude.Hashable VideoSelector where
  hashWithSalt :: Int -> VideoSelector -> Int
hashWithSalt Int
_salt VideoSelector' {Maybe VideoSelectorColorSpace
Maybe VideoSelectorColorSpaceSettings
Maybe VideoSelectorColorSpaceUsage
Maybe VideoSelectorSettings
selectorSettings :: Maybe VideoSelectorSettings
colorSpaceUsage :: Maybe VideoSelectorColorSpaceUsage
colorSpaceSettings :: Maybe VideoSelectorColorSpaceSettings
colorSpace :: Maybe VideoSelectorColorSpace
$sel:selectorSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorSettings
$sel:colorSpaceUsage:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceUsage
$sel:colorSpaceSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceSettings
$sel:colorSpace:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpace
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VideoSelectorColorSpace
colorSpace
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VideoSelectorSettings
selectorSettings

instance Prelude.NFData VideoSelector where
  rnf :: VideoSelector -> ()
rnf VideoSelector' {Maybe VideoSelectorColorSpace
Maybe VideoSelectorColorSpaceSettings
Maybe VideoSelectorColorSpaceUsage
Maybe VideoSelectorSettings
selectorSettings :: Maybe VideoSelectorSettings
colorSpaceUsage :: Maybe VideoSelectorColorSpaceUsage
colorSpaceSettings :: Maybe VideoSelectorColorSpaceSettings
colorSpace :: Maybe VideoSelectorColorSpace
$sel:selectorSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorSettings
$sel:colorSpaceUsage:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceUsage
$sel:colorSpaceSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceSettings
$sel:colorSpace:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpace
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VideoSelectorColorSpace
colorSpace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VideoSelectorColorSpaceSettings
colorSpaceSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VideoSelectorColorSpaceUsage
colorSpaceUsage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VideoSelectorSettings
selectorSettings

instance Data.ToJSON VideoSelector where
  toJSON :: VideoSelector -> Value
toJSON VideoSelector' {Maybe VideoSelectorColorSpace
Maybe VideoSelectorColorSpaceSettings
Maybe VideoSelectorColorSpaceUsage
Maybe VideoSelectorSettings
selectorSettings :: Maybe VideoSelectorSettings
colorSpaceUsage :: Maybe VideoSelectorColorSpaceUsage
colorSpaceSettings :: Maybe VideoSelectorColorSpaceSettings
colorSpace :: Maybe VideoSelectorColorSpace
$sel:selectorSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorSettings
$sel:colorSpaceUsage:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceUsage
$sel:colorSpaceSettings:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpaceSettings
$sel:colorSpace:VideoSelector' :: VideoSelector -> Maybe VideoSelectorColorSpace
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"colorSpace" 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 VideoSelectorColorSpace
colorSpace,
            (Key
"colorSpaceSettings" 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 VideoSelectorColorSpaceSettings
colorSpaceSettings,
            (Key
"colorSpaceUsage" 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 VideoSelectorColorSpaceUsage
colorSpaceUsage,
            (Key
"selectorSettings" 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 VideoSelectorSettings
selectorSettings
          ]
      )