{-# 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.MediaConvert.Types.ColorCorrector
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConvert.Types.ColorCorrector where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.ColorSpaceConversion
import Amazonka.MediaConvert.Types.Hdr10Metadata
import Amazonka.MediaConvert.Types.SampleRangeConversion
import qualified Amazonka.Prelude as Prelude

-- | Settings for color correction.
--
-- /See:/ 'newColorCorrector' smart constructor.
data ColorCorrector = ColorCorrector'
  { -- | Saturation level.
    ColorCorrector -> Maybe Natural
saturation :: Prelude.Maybe Prelude.Natural,
    -- | Hue in degrees.
    ColorCorrector -> Maybe Int
hue :: Prelude.Maybe Prelude.Int,
    -- | Specify the video color sample range for this output. To create a full
    -- range output, you must start with a full range YUV input and keep the
    -- default value, None (NONE). To create a limited range output from a full
    -- range input, choose Limited range (LIMITED_RANGE_SQUEEZE). With RGB
    -- inputs, your output is always limited range, regardless of your choice
    -- here. When you create a limited range output from a full range input,
    -- MediaConvert limits the active pixel values in a way that depends on the
    -- output\'s bit depth: 8-bit outputs contain only values from 16 through
    -- 235 and 10-bit outputs contain only values from 64 through 940. With
    -- this conversion, MediaConvert also changes the output metadata to note
    -- the limited range.
    ColorCorrector -> Maybe SampleRangeConversion
sampleRangeConversion :: Prelude.Maybe SampleRangeConversion,
    -- | Specify the color space you want for this output. The service supports
    -- conversion between HDR formats, between SDR formats, from SDR to HDR,
    -- and from HDR to SDR. SDR to HDR conversion doesn\'t upgrade the dynamic
    -- range. The converted video has an HDR format, but visually appears the
    -- same as an unconverted output. HDR to SDR conversion uses Elemental tone
    -- mapping technology to approximate the outcome of manually regrading from
    -- HDR to SDR.
    ColorCorrector -> Maybe ColorSpaceConversion
colorSpaceConversion :: Prelude.Maybe ColorSpaceConversion,
    -- | Use these settings when you convert to the HDR 10 color space. Specify
    -- the SMPTE ST 2086 Mastering Display Color Volume static metadata that
    -- you want signaled in the output. These values don\'t affect the pixel
    -- values that are encoded in the video stream. They are intended to help
    -- the downstream video player display content in a way that reflects the
    -- intentions of the the content creator. When you set Color space
    -- conversion (ColorSpaceConversion) to HDR 10 (FORCE_HDR10), these
    -- settings are required. You must set values for Max frame average light
    -- level (maxFrameAverageLightLevel) and Max content light level
    -- (maxContentLightLevel); these settings don\'t have a default value. The
    -- default values for the other HDR 10 metadata settings are defined by the
    -- P3D65 color space. For more information about MediaConvert HDR jobs, see
    -- https:\/\/docs.aws.amazon.com\/console\/mediaconvert\/hdr.
    ColorCorrector -> Maybe Hdr10Metadata
hdr10Metadata :: Prelude.Maybe Hdr10Metadata,
    -- | Contrast level.
    ColorCorrector -> Maybe Natural
contrast :: Prelude.Maybe Prelude.Natural,
    -- | Brightness level.
    ColorCorrector -> Maybe Natural
brightness :: Prelude.Maybe Prelude.Natural
  }
  deriving (ColorCorrector -> ColorCorrector -> Bool
(ColorCorrector -> ColorCorrector -> Bool)
-> (ColorCorrector -> ColorCorrector -> Bool) -> Eq ColorCorrector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColorCorrector -> ColorCorrector -> Bool
$c/= :: ColorCorrector -> ColorCorrector -> Bool
== :: ColorCorrector -> ColorCorrector -> Bool
$c== :: ColorCorrector -> ColorCorrector -> Bool
Prelude.Eq, ReadPrec [ColorCorrector]
ReadPrec ColorCorrector
Int -> ReadS ColorCorrector
ReadS [ColorCorrector]
(Int -> ReadS ColorCorrector)
-> ReadS [ColorCorrector]
-> ReadPrec ColorCorrector
-> ReadPrec [ColorCorrector]
-> Read ColorCorrector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ColorCorrector]
$creadListPrec :: ReadPrec [ColorCorrector]
readPrec :: ReadPrec ColorCorrector
$creadPrec :: ReadPrec ColorCorrector
readList :: ReadS [ColorCorrector]
$creadList :: ReadS [ColorCorrector]
readsPrec :: Int -> ReadS ColorCorrector
$creadsPrec :: Int -> ReadS ColorCorrector
Prelude.Read, Int -> ColorCorrector -> ShowS
[ColorCorrector] -> ShowS
ColorCorrector -> String
(Int -> ColorCorrector -> ShowS)
-> (ColorCorrector -> String)
-> ([ColorCorrector] -> ShowS)
-> Show ColorCorrector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColorCorrector] -> ShowS
$cshowList :: [ColorCorrector] -> ShowS
show :: ColorCorrector -> String
$cshow :: ColorCorrector -> String
showsPrec :: Int -> ColorCorrector -> ShowS
$cshowsPrec :: Int -> ColorCorrector -> ShowS
Prelude.Show, (forall x. ColorCorrector -> Rep ColorCorrector x)
-> (forall x. Rep ColorCorrector x -> ColorCorrector)
-> Generic ColorCorrector
forall x. Rep ColorCorrector x -> ColorCorrector
forall x. ColorCorrector -> Rep ColorCorrector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColorCorrector x -> ColorCorrector
$cfrom :: forall x. ColorCorrector -> Rep ColorCorrector x
Prelude.Generic)

-- |
-- Create a value of 'ColorCorrector' 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:
--
-- 'saturation', 'colorCorrector_saturation' - Saturation level.
--
-- 'hue', 'colorCorrector_hue' - Hue in degrees.
--
-- 'sampleRangeConversion', 'colorCorrector_sampleRangeConversion' - Specify the video color sample range for this output. To create a full
-- range output, you must start with a full range YUV input and keep the
-- default value, None (NONE). To create a limited range output from a full
-- range input, choose Limited range (LIMITED_RANGE_SQUEEZE). With RGB
-- inputs, your output is always limited range, regardless of your choice
-- here. When you create a limited range output from a full range input,
-- MediaConvert limits the active pixel values in a way that depends on the
-- output\'s bit depth: 8-bit outputs contain only values from 16 through
-- 235 and 10-bit outputs contain only values from 64 through 940. With
-- this conversion, MediaConvert also changes the output metadata to note
-- the limited range.
--
-- 'colorSpaceConversion', 'colorCorrector_colorSpaceConversion' - Specify the color space you want for this output. The service supports
-- conversion between HDR formats, between SDR formats, from SDR to HDR,
-- and from HDR to SDR. SDR to HDR conversion doesn\'t upgrade the dynamic
-- range. The converted video has an HDR format, but visually appears the
-- same as an unconverted output. HDR to SDR conversion uses Elemental tone
-- mapping technology to approximate the outcome of manually regrading from
-- HDR to SDR.
--
-- 'hdr10Metadata', 'colorCorrector_hdr10Metadata' - Use these settings when you convert to the HDR 10 color space. Specify
-- the SMPTE ST 2086 Mastering Display Color Volume static metadata that
-- you want signaled in the output. These values don\'t affect the pixel
-- values that are encoded in the video stream. They are intended to help
-- the downstream video player display content in a way that reflects the
-- intentions of the the content creator. When you set Color space
-- conversion (ColorSpaceConversion) to HDR 10 (FORCE_HDR10), these
-- settings are required. You must set values for Max frame average light
-- level (maxFrameAverageLightLevel) and Max content light level
-- (maxContentLightLevel); these settings don\'t have a default value. The
-- default values for the other HDR 10 metadata settings are defined by the
-- P3D65 color space. For more information about MediaConvert HDR jobs, see
-- https:\/\/docs.aws.amazon.com\/console\/mediaconvert\/hdr.
--
-- 'contrast', 'colorCorrector_contrast' - Contrast level.
--
-- 'brightness', 'colorCorrector_brightness' - Brightness level.
newColorCorrector ::
  ColorCorrector
newColorCorrector :: ColorCorrector
newColorCorrector =
  ColorCorrector' :: Maybe Natural
-> Maybe Int
-> Maybe SampleRangeConversion
-> Maybe ColorSpaceConversion
-> Maybe Hdr10Metadata
-> Maybe Natural
-> Maybe Natural
-> ColorCorrector
ColorCorrector'
    { $sel:saturation:ColorCorrector' :: Maybe Natural
saturation = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:hue:ColorCorrector' :: Maybe Int
hue = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:sampleRangeConversion:ColorCorrector' :: Maybe SampleRangeConversion
sampleRangeConversion = Maybe SampleRangeConversion
forall a. Maybe a
Prelude.Nothing,
      $sel:colorSpaceConversion:ColorCorrector' :: Maybe ColorSpaceConversion
colorSpaceConversion = Maybe ColorSpaceConversion
forall a. Maybe a
Prelude.Nothing,
      $sel:hdr10Metadata:ColorCorrector' :: Maybe Hdr10Metadata
hdr10Metadata = Maybe Hdr10Metadata
forall a. Maybe a
Prelude.Nothing,
      $sel:contrast:ColorCorrector' :: Maybe Natural
contrast = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:brightness:ColorCorrector' :: Maybe Natural
brightness = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Saturation level.
colorCorrector_saturation :: Lens.Lens' ColorCorrector (Prelude.Maybe Prelude.Natural)
colorCorrector_saturation :: (Maybe Natural -> f (Maybe Natural))
-> ColorCorrector -> f ColorCorrector
colorCorrector_saturation = (ColorCorrector -> Maybe Natural)
-> (ColorCorrector -> Maybe Natural -> ColorCorrector)
-> Lens
     ColorCorrector ColorCorrector (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe Natural
saturation :: Maybe Natural
$sel:saturation:ColorCorrector' :: ColorCorrector -> Maybe Natural
saturation} -> Maybe Natural
saturation) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe Natural
a -> ColorCorrector
s {$sel:saturation:ColorCorrector' :: Maybe Natural
saturation = Maybe Natural
a} :: ColorCorrector)

-- | Hue in degrees.
colorCorrector_hue :: Lens.Lens' ColorCorrector (Prelude.Maybe Prelude.Int)
colorCorrector_hue :: (Maybe Int -> f (Maybe Int)) -> ColorCorrector -> f ColorCorrector
colorCorrector_hue = (ColorCorrector -> Maybe Int)
-> (ColorCorrector -> Maybe Int -> ColorCorrector)
-> Lens ColorCorrector ColorCorrector (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe Int
hue :: Maybe Int
$sel:hue:ColorCorrector' :: ColorCorrector -> Maybe Int
hue} -> Maybe Int
hue) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe Int
a -> ColorCorrector
s {$sel:hue:ColorCorrector' :: Maybe Int
hue = Maybe Int
a} :: ColorCorrector)

-- | Specify the video color sample range for this output. To create a full
-- range output, you must start with a full range YUV input and keep the
-- default value, None (NONE). To create a limited range output from a full
-- range input, choose Limited range (LIMITED_RANGE_SQUEEZE). With RGB
-- inputs, your output is always limited range, regardless of your choice
-- here. When you create a limited range output from a full range input,
-- MediaConvert limits the active pixel values in a way that depends on the
-- output\'s bit depth: 8-bit outputs contain only values from 16 through
-- 235 and 10-bit outputs contain only values from 64 through 940. With
-- this conversion, MediaConvert also changes the output metadata to note
-- the limited range.
colorCorrector_sampleRangeConversion :: Lens.Lens' ColorCorrector (Prelude.Maybe SampleRangeConversion)
colorCorrector_sampleRangeConversion :: (Maybe SampleRangeConversion -> f (Maybe SampleRangeConversion))
-> ColorCorrector -> f ColorCorrector
colorCorrector_sampleRangeConversion = (ColorCorrector -> Maybe SampleRangeConversion)
-> (ColorCorrector
    -> Maybe SampleRangeConversion -> ColorCorrector)
-> Lens
     ColorCorrector
     ColorCorrector
     (Maybe SampleRangeConversion)
     (Maybe SampleRangeConversion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe SampleRangeConversion
sampleRangeConversion :: Maybe SampleRangeConversion
$sel:sampleRangeConversion:ColorCorrector' :: ColorCorrector -> Maybe SampleRangeConversion
sampleRangeConversion} -> Maybe SampleRangeConversion
sampleRangeConversion) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe SampleRangeConversion
a -> ColorCorrector
s {$sel:sampleRangeConversion:ColorCorrector' :: Maybe SampleRangeConversion
sampleRangeConversion = Maybe SampleRangeConversion
a} :: ColorCorrector)

-- | Specify the color space you want for this output. The service supports
-- conversion between HDR formats, between SDR formats, from SDR to HDR,
-- and from HDR to SDR. SDR to HDR conversion doesn\'t upgrade the dynamic
-- range. The converted video has an HDR format, but visually appears the
-- same as an unconverted output. HDR to SDR conversion uses Elemental tone
-- mapping technology to approximate the outcome of manually regrading from
-- HDR to SDR.
colorCorrector_colorSpaceConversion :: Lens.Lens' ColorCorrector (Prelude.Maybe ColorSpaceConversion)
colorCorrector_colorSpaceConversion :: (Maybe ColorSpaceConversion -> f (Maybe ColorSpaceConversion))
-> ColorCorrector -> f ColorCorrector
colorCorrector_colorSpaceConversion = (ColorCorrector -> Maybe ColorSpaceConversion)
-> (ColorCorrector -> Maybe ColorSpaceConversion -> ColorCorrector)
-> Lens
     ColorCorrector
     ColorCorrector
     (Maybe ColorSpaceConversion)
     (Maybe ColorSpaceConversion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe ColorSpaceConversion
colorSpaceConversion :: Maybe ColorSpaceConversion
$sel:colorSpaceConversion:ColorCorrector' :: ColorCorrector -> Maybe ColorSpaceConversion
colorSpaceConversion} -> Maybe ColorSpaceConversion
colorSpaceConversion) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe ColorSpaceConversion
a -> ColorCorrector
s {$sel:colorSpaceConversion:ColorCorrector' :: Maybe ColorSpaceConversion
colorSpaceConversion = Maybe ColorSpaceConversion
a} :: ColorCorrector)

-- | Use these settings when you convert to the HDR 10 color space. Specify
-- the SMPTE ST 2086 Mastering Display Color Volume static metadata that
-- you want signaled in the output. These values don\'t affect the pixel
-- values that are encoded in the video stream. They are intended to help
-- the downstream video player display content in a way that reflects the
-- intentions of the the content creator. When you set Color space
-- conversion (ColorSpaceConversion) to HDR 10 (FORCE_HDR10), these
-- settings are required. You must set values for Max frame average light
-- level (maxFrameAverageLightLevel) and Max content light level
-- (maxContentLightLevel); these settings don\'t have a default value. The
-- default values for the other HDR 10 metadata settings are defined by the
-- P3D65 color space. For more information about MediaConvert HDR jobs, see
-- https:\/\/docs.aws.amazon.com\/console\/mediaconvert\/hdr.
colorCorrector_hdr10Metadata :: Lens.Lens' ColorCorrector (Prelude.Maybe Hdr10Metadata)
colorCorrector_hdr10Metadata :: (Maybe Hdr10Metadata -> f (Maybe Hdr10Metadata))
-> ColorCorrector -> f ColorCorrector
colorCorrector_hdr10Metadata = (ColorCorrector -> Maybe Hdr10Metadata)
-> (ColorCorrector -> Maybe Hdr10Metadata -> ColorCorrector)
-> Lens
     ColorCorrector
     ColorCorrector
     (Maybe Hdr10Metadata)
     (Maybe Hdr10Metadata)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe Hdr10Metadata
hdr10Metadata :: Maybe Hdr10Metadata
$sel:hdr10Metadata:ColorCorrector' :: ColorCorrector -> Maybe Hdr10Metadata
hdr10Metadata} -> Maybe Hdr10Metadata
hdr10Metadata) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe Hdr10Metadata
a -> ColorCorrector
s {$sel:hdr10Metadata:ColorCorrector' :: Maybe Hdr10Metadata
hdr10Metadata = Maybe Hdr10Metadata
a} :: ColorCorrector)

-- | Contrast level.
colorCorrector_contrast :: Lens.Lens' ColorCorrector (Prelude.Maybe Prelude.Natural)
colorCorrector_contrast :: (Maybe Natural -> f (Maybe Natural))
-> ColorCorrector -> f ColorCorrector
colorCorrector_contrast = (ColorCorrector -> Maybe Natural)
-> (ColorCorrector -> Maybe Natural -> ColorCorrector)
-> Lens
     ColorCorrector ColorCorrector (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe Natural
contrast :: Maybe Natural
$sel:contrast:ColorCorrector' :: ColorCorrector -> Maybe Natural
contrast} -> Maybe Natural
contrast) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe Natural
a -> ColorCorrector
s {$sel:contrast:ColorCorrector' :: Maybe Natural
contrast = Maybe Natural
a} :: ColorCorrector)

-- | Brightness level.
colorCorrector_brightness :: Lens.Lens' ColorCorrector (Prelude.Maybe Prelude.Natural)
colorCorrector_brightness :: (Maybe Natural -> f (Maybe Natural))
-> ColorCorrector -> f ColorCorrector
colorCorrector_brightness = (ColorCorrector -> Maybe Natural)
-> (ColorCorrector -> Maybe Natural -> ColorCorrector)
-> Lens
     ColorCorrector ColorCorrector (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ColorCorrector' {Maybe Natural
brightness :: Maybe Natural
$sel:brightness:ColorCorrector' :: ColorCorrector -> Maybe Natural
brightness} -> Maybe Natural
brightness) (\s :: ColorCorrector
s@ColorCorrector' {} Maybe Natural
a -> ColorCorrector
s {$sel:brightness:ColorCorrector' :: Maybe Natural
brightness = Maybe Natural
a} :: ColorCorrector)

instance Core.FromJSON ColorCorrector where
  parseJSON :: Value -> Parser ColorCorrector
parseJSON =
    String
-> (Object -> Parser ColorCorrector)
-> Value
-> Parser ColorCorrector
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ColorCorrector"
      ( \Object
x ->
          Maybe Natural
-> Maybe Int
-> Maybe SampleRangeConversion
-> Maybe ColorSpaceConversion
-> Maybe Hdr10Metadata
-> Maybe Natural
-> Maybe Natural
-> ColorCorrector
ColorCorrector'
            (Maybe Natural
 -> Maybe Int
 -> Maybe SampleRangeConversion
 -> Maybe ColorSpaceConversion
 -> Maybe Hdr10Metadata
 -> Maybe Natural
 -> Maybe Natural
 -> ColorCorrector)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Int
      -> Maybe SampleRangeConversion
      -> Maybe ColorSpaceConversion
      -> Maybe Hdr10Metadata
      -> Maybe Natural
      -> Maybe Natural
      -> ColorCorrector)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"saturation")
            Parser
  (Maybe Int
   -> Maybe SampleRangeConversion
   -> Maybe ColorSpaceConversion
   -> Maybe Hdr10Metadata
   -> Maybe Natural
   -> Maybe Natural
   -> ColorCorrector)
-> Parser (Maybe Int)
-> Parser
     (Maybe SampleRangeConversion
      -> Maybe ColorSpaceConversion
      -> Maybe Hdr10Metadata
      -> Maybe Natural
      -> Maybe Natural
      -> ColorCorrector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hue")
            Parser
  (Maybe SampleRangeConversion
   -> Maybe ColorSpaceConversion
   -> Maybe Hdr10Metadata
   -> Maybe Natural
   -> Maybe Natural
   -> ColorCorrector)
-> Parser (Maybe SampleRangeConversion)
-> Parser
     (Maybe ColorSpaceConversion
      -> Maybe Hdr10Metadata
      -> Maybe Natural
      -> Maybe Natural
      -> ColorCorrector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SampleRangeConversion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sampleRangeConversion")
            Parser
  (Maybe ColorSpaceConversion
   -> Maybe Hdr10Metadata
   -> Maybe Natural
   -> Maybe Natural
   -> ColorCorrector)
-> Parser (Maybe ColorSpaceConversion)
-> Parser
     (Maybe Hdr10Metadata
      -> Maybe Natural -> Maybe Natural -> ColorCorrector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ColorSpaceConversion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"colorSpaceConversion")
            Parser
  (Maybe Hdr10Metadata
   -> Maybe Natural -> Maybe Natural -> ColorCorrector)
-> Parser (Maybe Hdr10Metadata)
-> Parser (Maybe Natural -> Maybe Natural -> ColorCorrector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Hdr10Metadata)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hdr10Metadata")
            Parser (Maybe Natural -> Maybe Natural -> ColorCorrector)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> ColorCorrector)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"contrast")
            Parser (Maybe Natural -> ColorCorrector)
-> Parser (Maybe Natural) -> Parser ColorCorrector
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"brightness")
      )

instance Prelude.Hashable ColorCorrector

instance Prelude.NFData ColorCorrector

instance Core.ToJSON ColorCorrector where
  toJSON :: ColorCorrector -> Value
toJSON ColorCorrector' {Maybe Int
Maybe Natural
Maybe ColorSpaceConversion
Maybe Hdr10Metadata
Maybe SampleRangeConversion
brightness :: Maybe Natural
contrast :: Maybe Natural
hdr10Metadata :: Maybe Hdr10Metadata
colorSpaceConversion :: Maybe ColorSpaceConversion
sampleRangeConversion :: Maybe SampleRangeConversion
hue :: Maybe Int
saturation :: Maybe Natural
$sel:brightness:ColorCorrector' :: ColorCorrector -> Maybe Natural
$sel:contrast:ColorCorrector' :: ColorCorrector -> Maybe Natural
$sel:hdr10Metadata:ColorCorrector' :: ColorCorrector -> Maybe Hdr10Metadata
$sel:colorSpaceConversion:ColorCorrector' :: ColorCorrector -> Maybe ColorSpaceConversion
$sel:sampleRangeConversion:ColorCorrector' :: ColorCorrector -> Maybe SampleRangeConversion
$sel:hue:ColorCorrector' :: ColorCorrector -> Maybe Int
$sel:saturation:ColorCorrector' :: ColorCorrector -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"saturation" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
saturation,
            (Text
"hue" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
hue,
            (Text
"sampleRangeConversion" Text -> SampleRangeConversion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SampleRangeConversion -> Pair)
-> Maybe SampleRangeConversion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SampleRangeConversion
sampleRangeConversion,
            (Text
"colorSpaceConversion" Text -> ColorSpaceConversion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ColorSpaceConversion -> Pair)
-> Maybe ColorSpaceConversion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ColorSpaceConversion
colorSpaceConversion,
            (Text
"hdr10Metadata" Text -> Hdr10Metadata -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Hdr10Metadata -> Pair) -> Maybe Hdr10Metadata -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Hdr10Metadata
hdr10Metadata,
            (Text
"contrast" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
contrast,
            (Text
"brightness" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
brightness
          ]
      )