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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConvert.Types.PresetSettings
import Amazonka.MediaConvert.Types.Type
import qualified Amazonka.Prelude as Prelude

-- | A preset is a collection of preconfigured media conversion settings that
-- you want MediaConvert to apply to the output during the conversion
-- process.
--
-- /See:/ 'newPreset' smart constructor.
data Preset = Preset'
  { -- | The timestamp in epoch seconds when the preset was last updated.
    Preset -> Maybe POSIX
lastUpdated :: Prelude.Maybe Core.POSIX,
    -- | An identifier for this resource that is unique within all of AWS.
    Preset -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The timestamp in epoch seconds for preset creation.
    Preset -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | An optional category you create to organize your presets.
    Preset -> Maybe Text
category :: Prelude.Maybe Prelude.Text,
    -- | A preset can be of two types: system or custom. System or built-in
    -- preset can\'t be modified or deleted by the user.
    Preset -> Maybe Type
type' :: Prelude.Maybe Type,
    -- | An optional description you create for each preset.
    Preset -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Settings for preset
    Preset -> PresetSettings
settings :: PresetSettings,
    -- | A name you create for each preset. Each name must be unique within your
    -- account.
    Preset -> Text
name :: Prelude.Text
  }
  deriving (Preset -> Preset -> Bool
(Preset -> Preset -> Bool)
-> (Preset -> Preset -> Bool) -> Eq Preset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Preset -> Preset -> Bool
$c/= :: Preset -> Preset -> Bool
== :: Preset -> Preset -> Bool
$c== :: Preset -> Preset -> Bool
Prelude.Eq, ReadPrec [Preset]
ReadPrec Preset
Int -> ReadS Preset
ReadS [Preset]
(Int -> ReadS Preset)
-> ReadS [Preset]
-> ReadPrec Preset
-> ReadPrec [Preset]
-> Read Preset
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Preset]
$creadListPrec :: ReadPrec [Preset]
readPrec :: ReadPrec Preset
$creadPrec :: ReadPrec Preset
readList :: ReadS [Preset]
$creadList :: ReadS [Preset]
readsPrec :: Int -> ReadS Preset
$creadsPrec :: Int -> ReadS Preset
Prelude.Read, Int -> Preset -> ShowS
[Preset] -> ShowS
Preset -> String
(Int -> Preset -> ShowS)
-> (Preset -> String) -> ([Preset] -> ShowS) -> Show Preset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Preset] -> ShowS
$cshowList :: [Preset] -> ShowS
show :: Preset -> String
$cshow :: Preset -> String
showsPrec :: Int -> Preset -> ShowS
$cshowsPrec :: Int -> Preset -> ShowS
Prelude.Show, (forall x. Preset -> Rep Preset x)
-> (forall x. Rep Preset x -> Preset) -> Generic Preset
forall x. Rep Preset x -> Preset
forall x. Preset -> Rep Preset x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Preset x -> Preset
$cfrom :: forall x. Preset -> Rep Preset x
Prelude.Generic)

-- |
-- Create a value of 'Preset' 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:
--
-- 'lastUpdated', 'preset_lastUpdated' - The timestamp in epoch seconds when the preset was last updated.
--
-- 'arn', 'preset_arn' - An identifier for this resource that is unique within all of AWS.
--
-- 'createdAt', 'preset_createdAt' - The timestamp in epoch seconds for preset creation.
--
-- 'category', 'preset_category' - An optional category you create to organize your presets.
--
-- 'type'', 'preset_type' - A preset can be of two types: system or custom. System or built-in
-- preset can\'t be modified or deleted by the user.
--
-- 'description', 'preset_description' - An optional description you create for each preset.
--
-- 'settings', 'preset_settings' - Settings for preset
--
-- 'name', 'preset_name' - A name you create for each preset. Each name must be unique within your
-- account.
newPreset ::
  -- | 'settings'
  PresetSettings ->
  -- | 'name'
  Prelude.Text ->
  Preset
newPreset :: PresetSettings -> Text -> Preset
newPreset PresetSettings
pSettings_ Text
pName_ =
  Preset' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Type
-> Maybe Text
-> PresetSettings
-> Text
-> Preset
Preset'
    { $sel:lastUpdated:Preset' :: Maybe POSIX
lastUpdated = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Preset' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:Preset' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:category:Preset' :: Maybe Text
category = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':Preset' :: Maybe Type
type' = Maybe Type
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Preset' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:settings:Preset' :: PresetSettings
settings = PresetSettings
pSettings_,
      $sel:name:Preset' :: Text
name = Text
pName_
    }

-- | The timestamp in epoch seconds when the preset was last updated.
preset_lastUpdated :: Lens.Lens' Preset (Prelude.Maybe Prelude.UTCTime)
preset_lastUpdated :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Preset -> f Preset
preset_lastUpdated = (Preset -> Maybe POSIX)
-> (Preset -> Maybe POSIX -> Preset)
-> Lens Preset Preset (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Maybe POSIX
lastUpdated :: Maybe POSIX
$sel:lastUpdated:Preset' :: Preset -> Maybe POSIX
lastUpdated} -> Maybe POSIX
lastUpdated) (\s :: Preset
s@Preset' {} Maybe POSIX
a -> Preset
s {$sel:lastUpdated:Preset' :: Maybe POSIX
lastUpdated = Maybe POSIX
a} :: Preset) ((Maybe POSIX -> f (Maybe POSIX)) -> Preset -> f Preset)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Preset
-> f Preset
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | An identifier for this resource that is unique within all of AWS.
preset_arn :: Lens.Lens' Preset (Prelude.Maybe Prelude.Text)
preset_arn :: (Maybe Text -> f (Maybe Text)) -> Preset -> f Preset
preset_arn = (Preset -> Maybe Text)
-> (Preset -> Maybe Text -> Preset)
-> Lens Preset Preset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Maybe Text
arn :: Maybe Text
$sel:arn:Preset' :: Preset -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Preset
s@Preset' {} Maybe Text
a -> Preset
s {$sel:arn:Preset' :: Maybe Text
arn = Maybe Text
a} :: Preset)

-- | The timestamp in epoch seconds for preset creation.
preset_createdAt :: Lens.Lens' Preset (Prelude.Maybe Prelude.UTCTime)
preset_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Preset -> f Preset
preset_createdAt = (Preset -> Maybe POSIX)
-> (Preset -> Maybe POSIX -> Preset)
-> Lens Preset Preset (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Preset' :: Preset -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Preset
s@Preset' {} Maybe POSIX
a -> Preset
s {$sel:createdAt:Preset' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Preset) ((Maybe POSIX -> f (Maybe POSIX)) -> Preset -> f Preset)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Preset
-> f Preset
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | An optional category you create to organize your presets.
preset_category :: Lens.Lens' Preset (Prelude.Maybe Prelude.Text)
preset_category :: (Maybe Text -> f (Maybe Text)) -> Preset -> f Preset
preset_category = (Preset -> Maybe Text)
-> (Preset -> Maybe Text -> Preset)
-> Lens Preset Preset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Maybe Text
category :: Maybe Text
$sel:category:Preset' :: Preset -> Maybe Text
category} -> Maybe Text
category) (\s :: Preset
s@Preset' {} Maybe Text
a -> Preset
s {$sel:category:Preset' :: Maybe Text
category = Maybe Text
a} :: Preset)

-- | A preset can be of two types: system or custom. System or built-in
-- preset can\'t be modified or deleted by the user.
preset_type :: Lens.Lens' Preset (Prelude.Maybe Type)
preset_type :: (Maybe Type -> f (Maybe Type)) -> Preset -> f Preset
preset_type = (Preset -> Maybe Type)
-> (Preset -> Maybe Type -> Preset)
-> Lens Preset Preset (Maybe Type) (Maybe Type)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Maybe Type
type' :: Maybe Type
$sel:type':Preset' :: Preset -> Maybe Type
type'} -> Maybe Type
type') (\s :: Preset
s@Preset' {} Maybe Type
a -> Preset
s {$sel:type':Preset' :: Maybe Type
type' = Maybe Type
a} :: Preset)

-- | An optional description you create for each preset.
preset_description :: Lens.Lens' Preset (Prelude.Maybe Prelude.Text)
preset_description :: (Maybe Text -> f (Maybe Text)) -> Preset -> f Preset
preset_description = (Preset -> Maybe Text)
-> (Preset -> Maybe Text -> Preset)
-> Lens Preset Preset (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Maybe Text
description :: Maybe Text
$sel:description:Preset' :: Preset -> Maybe Text
description} -> Maybe Text
description) (\s :: Preset
s@Preset' {} Maybe Text
a -> Preset
s {$sel:description:Preset' :: Maybe Text
description = Maybe Text
a} :: Preset)

-- | Settings for preset
preset_settings :: Lens.Lens' Preset PresetSettings
preset_settings :: (PresetSettings -> f PresetSettings) -> Preset -> f Preset
preset_settings = (Preset -> PresetSettings)
-> (Preset -> PresetSettings -> Preset)
-> Lens Preset Preset PresetSettings PresetSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {PresetSettings
settings :: PresetSettings
$sel:settings:Preset' :: Preset -> PresetSettings
settings} -> PresetSettings
settings) (\s :: Preset
s@Preset' {} PresetSettings
a -> Preset
s {$sel:settings:Preset' :: PresetSettings
settings = PresetSettings
a} :: Preset)

-- | A name you create for each preset. Each name must be unique within your
-- account.
preset_name :: Lens.Lens' Preset Prelude.Text
preset_name :: (Text -> f Text) -> Preset -> f Preset
preset_name = (Preset -> Text)
-> (Preset -> Text -> Preset) -> Lens Preset Preset Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Preset' {Text
name :: Text
$sel:name:Preset' :: Preset -> Text
name} -> Text
name) (\s :: Preset
s@Preset' {} Text
a -> Preset
s {$sel:name:Preset' :: Text
name = Text
a} :: Preset)

instance Core.FromJSON Preset where
  parseJSON :: Value -> Parser Preset
parseJSON =
    String -> (Object -> Parser Preset) -> Value -> Parser Preset
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Preset"
      ( \Object
x ->
          Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Type
-> Maybe Text
-> PresetSettings
-> Text
-> Preset
Preset'
            (Maybe POSIX
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Type
 -> Maybe Text
 -> PresetSettings
 -> Text
 -> Preset)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Type
      -> Maybe Text
      -> PresetSettings
      -> Text
      -> Preset)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"lastUpdated")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Type
   -> Maybe Text
   -> PresetSettings
   -> Text
   -> Preset)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text
      -> Maybe Type
      -> Maybe Text
      -> PresetSettings
      -> Text
      -> Preset)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn")
            Parser
  (Maybe POSIX
   -> Maybe Text
   -> Maybe Type
   -> Maybe Text
   -> PresetSettings
   -> Text
   -> Preset)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe Text
      -> Maybe Type -> Maybe Text -> PresetSettings -> Text -> Preset)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe Text
   -> Maybe Type -> Maybe Text -> PresetSettings -> Text -> Preset)
-> Parser (Maybe Text)
-> Parser
     (Maybe Type -> Maybe Text -> PresetSettings -> Text -> Preset)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"category")
            Parser
  (Maybe Type -> Maybe Text -> PresetSettings -> Text -> Preset)
-> Parser (Maybe Type)
-> Parser (Maybe Text -> PresetSettings -> Text -> Preset)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Type)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
            Parser (Maybe Text -> PresetSettings -> Text -> Preset)
-> Parser (Maybe Text) -> Parser (PresetSettings -> Text -> Preset)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser (PresetSettings -> Text -> Preset)
-> Parser PresetSettings -> Parser (Text -> Preset)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PresetSettings
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"settings")
            Parser (Text -> Preset) -> Parser Text -> Parser Preset
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
      )

instance Prelude.Hashable Preset

instance Prelude.NFData Preset