{-# 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.ElasticTranscoder.Types.Artwork
-- 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.ElasticTranscoder.Types.Artwork where

import qualified Amazonka.Core as Core
import Amazonka.ElasticTranscoder.Types.Encryption
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The file to be used as album art. There can be multiple artworks
-- associated with an audio file, to a maximum of 20.
--
-- To remove artwork or leave the artwork empty, you can either set
-- @Artwork@ to null, or set the @Merge Policy@ to \"Replace\" and use an
-- empty @Artwork@ array.
--
-- To pass through existing artwork unchanged, set the @Merge Policy@ to
-- \"Prepend\", \"Append\", or \"Fallback\", and use an empty @Artwork@
-- array.
--
-- /See:/ 'newArtwork' smart constructor.
data Artwork = Artwork'
  { -- | Specify one of the following values to control scaling of the output
    -- album art:
    --
    -- -   @Fit:@ Elastic Transcoder scales the output art so it matches the
    --     value that you specified in either @MaxWidth@ or @MaxHeight@ without
    --     exceeding the other value.
    --
    -- -   @Fill:@ Elastic Transcoder scales the output art so it matches the
    --     value that you specified in either @MaxWidth@ or @MaxHeight@ and
    --     matches or exceeds the other value. Elastic Transcoder centers the
    --     output art and then crops it in the dimension (if any) that exceeds
    --     the maximum value.
    --
    -- -   @Stretch:@ Elastic Transcoder stretches the output art to match the
    --     values that you specified for @MaxWidth@ and @MaxHeight@. If the
    --     relative proportions of the input art and the output art are
    --     different, the output art will be distorted.
    --
    -- -   @Keep:@ Elastic Transcoder does not scale the output art. If either
    --     dimension of the input art exceeds the values that you specified for
    --     @MaxWidth@ and @MaxHeight@, Elastic Transcoder crops the output art.
    --
    -- -   @ShrinkToFit:@ Elastic Transcoder scales the output art down so that
    --     its dimensions match the values that you specified for at least one
    --     of @MaxWidth@ and @MaxHeight@ without exceeding either value. If you
    --     specify this option, Elastic Transcoder does not scale the art up.
    --
    -- -   @ShrinkToFill@ Elastic Transcoder scales the output art down so that
    --     its dimensions match the values that you specified for at least one
    --     of @MaxWidth@ and @MaxHeight@ without dropping below either value.
    --     If you specify this option, Elastic Transcoder does not scale the
    --     art up.
    Artwork -> Maybe Text
sizingPolicy :: Prelude.Maybe Prelude.Text,
    -- | The format of album art, if any. Valid formats are @.jpg@ and @.png@.
    Artwork -> Maybe Text
albumArtFormat :: Prelude.Maybe Prelude.Text,
    -- | The maximum height of the output album art in pixels. If you specify
    -- @auto@, Elastic Transcoder uses 600 as the default value. If you specify
    -- a numeric value, enter an even integer between 32 and 3072, inclusive.
    Artwork -> Maybe Text
maxHeight :: Prelude.Maybe Prelude.Text,
    -- | The name of the file to be used as album art. To determine which Amazon
    -- S3 bucket contains the specified file, Elastic Transcoder checks the
    -- pipeline specified by @PipelineId@; the @InputBucket@ object in that
    -- pipeline identifies the bucket.
    --
    -- If the file name includes a prefix, for example, @cooking\/pie.jpg@,
    -- include the prefix in the key. If the file isn\'t in the specified
    -- bucket, Elastic Transcoder returns an error.
    Artwork -> Maybe Text
inputKey :: Prelude.Maybe Prelude.Text,
    -- | When you set @PaddingPolicy@ to @Pad@, Elastic Transcoder may add white
    -- bars to the top and bottom and\/or left and right sides of the output
    -- album art to make the total size of the output art match the values that
    -- you specified for @MaxWidth@ and @MaxHeight@.
    Artwork -> Maybe Text
paddingPolicy :: Prelude.Maybe Prelude.Text,
    -- | The encryption settings, if any, that you want Elastic Transcoder to
    -- apply to your artwork.
    Artwork -> Maybe Encryption
encryption :: Prelude.Maybe Encryption,
    -- | The maximum width of the output album art in pixels. If you specify
    -- @auto@, Elastic Transcoder uses 600 as the default value. If you specify
    -- a numeric value, enter an even integer between 32 and 4096, inclusive.
    Artwork -> Maybe Text
maxWidth :: Prelude.Maybe Prelude.Text
  }
  deriving (Artwork -> Artwork -> Bool
(Artwork -> Artwork -> Bool)
-> (Artwork -> Artwork -> Bool) -> Eq Artwork
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Artwork -> Artwork -> Bool
$c/= :: Artwork -> Artwork -> Bool
== :: Artwork -> Artwork -> Bool
$c== :: Artwork -> Artwork -> Bool
Prelude.Eq, ReadPrec [Artwork]
ReadPrec Artwork
Int -> ReadS Artwork
ReadS [Artwork]
(Int -> ReadS Artwork)
-> ReadS [Artwork]
-> ReadPrec Artwork
-> ReadPrec [Artwork]
-> Read Artwork
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Artwork]
$creadListPrec :: ReadPrec [Artwork]
readPrec :: ReadPrec Artwork
$creadPrec :: ReadPrec Artwork
readList :: ReadS [Artwork]
$creadList :: ReadS [Artwork]
readsPrec :: Int -> ReadS Artwork
$creadsPrec :: Int -> ReadS Artwork
Prelude.Read, Int -> Artwork -> ShowS
[Artwork] -> ShowS
Artwork -> String
(Int -> Artwork -> ShowS)
-> (Artwork -> String) -> ([Artwork] -> ShowS) -> Show Artwork
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Artwork] -> ShowS
$cshowList :: [Artwork] -> ShowS
show :: Artwork -> String
$cshow :: Artwork -> String
showsPrec :: Int -> Artwork -> ShowS
$cshowsPrec :: Int -> Artwork -> ShowS
Prelude.Show, (forall x. Artwork -> Rep Artwork x)
-> (forall x. Rep Artwork x -> Artwork) -> Generic Artwork
forall x. Rep Artwork x -> Artwork
forall x. Artwork -> Rep Artwork x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Artwork x -> Artwork
$cfrom :: forall x. Artwork -> Rep Artwork x
Prelude.Generic)

-- |
-- Create a value of 'Artwork' 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:
--
-- 'sizingPolicy', 'artwork_sizingPolicy' - Specify one of the following values to control scaling of the output
-- album art:
--
-- -   @Fit:@ Elastic Transcoder scales the output art so it matches the
--     value that you specified in either @MaxWidth@ or @MaxHeight@ without
--     exceeding the other value.
--
-- -   @Fill:@ Elastic Transcoder scales the output art so it matches the
--     value that you specified in either @MaxWidth@ or @MaxHeight@ and
--     matches or exceeds the other value. Elastic Transcoder centers the
--     output art and then crops it in the dimension (if any) that exceeds
--     the maximum value.
--
-- -   @Stretch:@ Elastic Transcoder stretches the output art to match the
--     values that you specified for @MaxWidth@ and @MaxHeight@. If the
--     relative proportions of the input art and the output art are
--     different, the output art will be distorted.
--
-- -   @Keep:@ Elastic Transcoder does not scale the output art. If either
--     dimension of the input art exceeds the values that you specified for
--     @MaxWidth@ and @MaxHeight@, Elastic Transcoder crops the output art.
--
-- -   @ShrinkToFit:@ Elastic Transcoder scales the output art down so that
--     its dimensions match the values that you specified for at least one
--     of @MaxWidth@ and @MaxHeight@ without exceeding either value. If you
--     specify this option, Elastic Transcoder does not scale the art up.
--
-- -   @ShrinkToFill@ Elastic Transcoder scales the output art down so that
--     its dimensions match the values that you specified for at least one
--     of @MaxWidth@ and @MaxHeight@ without dropping below either value.
--     If you specify this option, Elastic Transcoder does not scale the
--     art up.
--
-- 'albumArtFormat', 'artwork_albumArtFormat' - The format of album art, if any. Valid formats are @.jpg@ and @.png@.
--
-- 'maxHeight', 'artwork_maxHeight' - The maximum height of the output album art in pixels. If you specify
-- @auto@, Elastic Transcoder uses 600 as the default value. If you specify
-- a numeric value, enter an even integer between 32 and 3072, inclusive.
--
-- 'inputKey', 'artwork_inputKey' - The name of the file to be used as album art. To determine which Amazon
-- S3 bucket contains the specified file, Elastic Transcoder checks the
-- pipeline specified by @PipelineId@; the @InputBucket@ object in that
-- pipeline identifies the bucket.
--
-- If the file name includes a prefix, for example, @cooking\/pie.jpg@,
-- include the prefix in the key. If the file isn\'t in the specified
-- bucket, Elastic Transcoder returns an error.
--
-- 'paddingPolicy', 'artwork_paddingPolicy' - When you set @PaddingPolicy@ to @Pad@, Elastic Transcoder may add white
-- bars to the top and bottom and\/or left and right sides of the output
-- album art to make the total size of the output art match the values that
-- you specified for @MaxWidth@ and @MaxHeight@.
--
-- 'encryption', 'artwork_encryption' - The encryption settings, if any, that you want Elastic Transcoder to
-- apply to your artwork.
--
-- 'maxWidth', 'artwork_maxWidth' - The maximum width of the output album art in pixels. If you specify
-- @auto@, Elastic Transcoder uses 600 as the default value. If you specify
-- a numeric value, enter an even integer between 32 and 4096, inclusive.
newArtwork ::
  Artwork
newArtwork :: Artwork
newArtwork =
  Artwork' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Encryption
-> Maybe Text
-> Artwork
Artwork'
    { $sel:sizingPolicy:Artwork' :: Maybe Text
sizingPolicy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:albumArtFormat:Artwork' :: Maybe Text
albumArtFormat = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxHeight:Artwork' :: Maybe Text
maxHeight = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:inputKey:Artwork' :: Maybe Text
inputKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:paddingPolicy:Artwork' :: Maybe Text
paddingPolicy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:encryption:Artwork' :: Maybe Encryption
encryption = Maybe Encryption
forall a. Maybe a
Prelude.Nothing,
      $sel:maxWidth:Artwork' :: Maybe Text
maxWidth = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Specify one of the following values to control scaling of the output
-- album art:
--
-- -   @Fit:@ Elastic Transcoder scales the output art so it matches the
--     value that you specified in either @MaxWidth@ or @MaxHeight@ without
--     exceeding the other value.
--
-- -   @Fill:@ Elastic Transcoder scales the output art so it matches the
--     value that you specified in either @MaxWidth@ or @MaxHeight@ and
--     matches or exceeds the other value. Elastic Transcoder centers the
--     output art and then crops it in the dimension (if any) that exceeds
--     the maximum value.
--
-- -   @Stretch:@ Elastic Transcoder stretches the output art to match the
--     values that you specified for @MaxWidth@ and @MaxHeight@. If the
--     relative proportions of the input art and the output art are
--     different, the output art will be distorted.
--
-- -   @Keep:@ Elastic Transcoder does not scale the output art. If either
--     dimension of the input art exceeds the values that you specified for
--     @MaxWidth@ and @MaxHeight@, Elastic Transcoder crops the output art.
--
-- -   @ShrinkToFit:@ Elastic Transcoder scales the output art down so that
--     its dimensions match the values that you specified for at least one
--     of @MaxWidth@ and @MaxHeight@ without exceeding either value. If you
--     specify this option, Elastic Transcoder does not scale the art up.
--
-- -   @ShrinkToFill@ Elastic Transcoder scales the output art down so that
--     its dimensions match the values that you specified for at least one
--     of @MaxWidth@ and @MaxHeight@ without dropping below either value.
--     If you specify this option, Elastic Transcoder does not scale the
--     art up.
artwork_sizingPolicy :: Lens.Lens' Artwork (Prelude.Maybe Prelude.Text)
artwork_sizingPolicy :: (Maybe Text -> f (Maybe Text)) -> Artwork -> f Artwork
artwork_sizingPolicy = (Artwork -> Maybe Text)
-> (Artwork -> Maybe Text -> Artwork)
-> Lens Artwork Artwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Text
sizingPolicy :: Maybe Text
$sel:sizingPolicy:Artwork' :: Artwork -> Maybe Text
sizingPolicy} -> Maybe Text
sizingPolicy) (\s :: Artwork
s@Artwork' {} Maybe Text
a -> Artwork
s {$sel:sizingPolicy:Artwork' :: Maybe Text
sizingPolicy = Maybe Text
a} :: Artwork)

-- | The format of album art, if any. Valid formats are @.jpg@ and @.png@.
artwork_albumArtFormat :: Lens.Lens' Artwork (Prelude.Maybe Prelude.Text)
artwork_albumArtFormat :: (Maybe Text -> f (Maybe Text)) -> Artwork -> f Artwork
artwork_albumArtFormat = (Artwork -> Maybe Text)
-> (Artwork -> Maybe Text -> Artwork)
-> Lens Artwork Artwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Text
albumArtFormat :: Maybe Text
$sel:albumArtFormat:Artwork' :: Artwork -> Maybe Text
albumArtFormat} -> Maybe Text
albumArtFormat) (\s :: Artwork
s@Artwork' {} Maybe Text
a -> Artwork
s {$sel:albumArtFormat:Artwork' :: Maybe Text
albumArtFormat = Maybe Text
a} :: Artwork)

-- | The maximum height of the output album art in pixels. If you specify
-- @auto@, Elastic Transcoder uses 600 as the default value. If you specify
-- a numeric value, enter an even integer between 32 and 3072, inclusive.
artwork_maxHeight :: Lens.Lens' Artwork (Prelude.Maybe Prelude.Text)
artwork_maxHeight :: (Maybe Text -> f (Maybe Text)) -> Artwork -> f Artwork
artwork_maxHeight = (Artwork -> Maybe Text)
-> (Artwork -> Maybe Text -> Artwork)
-> Lens Artwork Artwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Text
maxHeight :: Maybe Text
$sel:maxHeight:Artwork' :: Artwork -> Maybe Text
maxHeight} -> Maybe Text
maxHeight) (\s :: Artwork
s@Artwork' {} Maybe Text
a -> Artwork
s {$sel:maxHeight:Artwork' :: Maybe Text
maxHeight = Maybe Text
a} :: Artwork)

-- | The name of the file to be used as album art. To determine which Amazon
-- S3 bucket contains the specified file, Elastic Transcoder checks the
-- pipeline specified by @PipelineId@; the @InputBucket@ object in that
-- pipeline identifies the bucket.
--
-- If the file name includes a prefix, for example, @cooking\/pie.jpg@,
-- include the prefix in the key. If the file isn\'t in the specified
-- bucket, Elastic Transcoder returns an error.
artwork_inputKey :: Lens.Lens' Artwork (Prelude.Maybe Prelude.Text)
artwork_inputKey :: (Maybe Text -> f (Maybe Text)) -> Artwork -> f Artwork
artwork_inputKey = (Artwork -> Maybe Text)
-> (Artwork -> Maybe Text -> Artwork)
-> Lens Artwork Artwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Text
inputKey :: Maybe Text
$sel:inputKey:Artwork' :: Artwork -> Maybe Text
inputKey} -> Maybe Text
inputKey) (\s :: Artwork
s@Artwork' {} Maybe Text
a -> Artwork
s {$sel:inputKey:Artwork' :: Maybe Text
inputKey = Maybe Text
a} :: Artwork)

-- | When you set @PaddingPolicy@ to @Pad@, Elastic Transcoder may add white
-- bars to the top and bottom and\/or left and right sides of the output
-- album art to make the total size of the output art match the values that
-- you specified for @MaxWidth@ and @MaxHeight@.
artwork_paddingPolicy :: Lens.Lens' Artwork (Prelude.Maybe Prelude.Text)
artwork_paddingPolicy :: (Maybe Text -> f (Maybe Text)) -> Artwork -> f Artwork
artwork_paddingPolicy = (Artwork -> Maybe Text)
-> (Artwork -> Maybe Text -> Artwork)
-> Lens Artwork Artwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Text
paddingPolicy :: Maybe Text
$sel:paddingPolicy:Artwork' :: Artwork -> Maybe Text
paddingPolicy} -> Maybe Text
paddingPolicy) (\s :: Artwork
s@Artwork' {} Maybe Text
a -> Artwork
s {$sel:paddingPolicy:Artwork' :: Maybe Text
paddingPolicy = Maybe Text
a} :: Artwork)

-- | The encryption settings, if any, that you want Elastic Transcoder to
-- apply to your artwork.
artwork_encryption :: Lens.Lens' Artwork (Prelude.Maybe Encryption)
artwork_encryption :: (Maybe Encryption -> f (Maybe Encryption)) -> Artwork -> f Artwork
artwork_encryption = (Artwork -> Maybe Encryption)
-> (Artwork -> Maybe Encryption -> Artwork)
-> Lens Artwork Artwork (Maybe Encryption) (Maybe Encryption)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Encryption
encryption :: Maybe Encryption
$sel:encryption:Artwork' :: Artwork -> Maybe Encryption
encryption} -> Maybe Encryption
encryption) (\s :: Artwork
s@Artwork' {} Maybe Encryption
a -> Artwork
s {$sel:encryption:Artwork' :: Maybe Encryption
encryption = Maybe Encryption
a} :: Artwork)

-- | The maximum width of the output album art in pixels. If you specify
-- @auto@, Elastic Transcoder uses 600 as the default value. If you specify
-- a numeric value, enter an even integer between 32 and 4096, inclusive.
artwork_maxWidth :: Lens.Lens' Artwork (Prelude.Maybe Prelude.Text)
artwork_maxWidth :: (Maybe Text -> f (Maybe Text)) -> Artwork -> f Artwork
artwork_maxWidth = (Artwork -> Maybe Text)
-> (Artwork -> Maybe Text -> Artwork)
-> Lens Artwork Artwork (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Artwork' {Maybe Text
maxWidth :: Maybe Text
$sel:maxWidth:Artwork' :: Artwork -> Maybe Text
maxWidth} -> Maybe Text
maxWidth) (\s :: Artwork
s@Artwork' {} Maybe Text
a -> Artwork
s {$sel:maxWidth:Artwork' :: Maybe Text
maxWidth = Maybe Text
a} :: Artwork)

instance Core.FromJSON Artwork where
  parseJSON :: Value -> Parser Artwork
parseJSON =
    String -> (Object -> Parser Artwork) -> Value -> Parser Artwork
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Artwork"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Encryption
-> Maybe Text
-> Artwork
Artwork'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Encryption
 -> Maybe Text
 -> Artwork)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Encryption
      -> Maybe Text
      -> Artwork)
forall (f :: * -> *) a b. Functor 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
"SizingPolicy")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Encryption
   -> Maybe Text
   -> Artwork)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Encryption
      -> Maybe Text
      -> Artwork)
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
"AlbumArtFormat")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Encryption
   -> Maybe Text
   -> Artwork)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Encryption -> Maybe Text -> Artwork)
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
"MaxHeight")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Encryption -> Maybe Text -> Artwork)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Encryption -> Maybe Text -> Artwork)
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
"InputKey")
            Parser (Maybe Text -> Maybe Encryption -> Maybe Text -> Artwork)
-> Parser (Maybe Text)
-> Parser (Maybe Encryption -> Maybe Text -> Artwork)
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
"PaddingPolicy")
            Parser (Maybe Encryption -> Maybe Text -> Artwork)
-> Parser (Maybe Encryption) -> Parser (Maybe Text -> Artwork)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Encryption)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Encryption")
            Parser (Maybe Text -> Artwork)
-> Parser (Maybe Text) -> Parser Artwork
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
"MaxWidth")
      )

instance Prelude.Hashable Artwork

instance Prelude.NFData Artwork

instance Core.ToJSON Artwork where
  toJSON :: Artwork -> Value
toJSON Artwork' {Maybe Text
Maybe Encryption
maxWidth :: Maybe Text
encryption :: Maybe Encryption
paddingPolicy :: Maybe Text
inputKey :: Maybe Text
maxHeight :: Maybe Text
albumArtFormat :: Maybe Text
sizingPolicy :: Maybe Text
$sel:maxWidth:Artwork' :: Artwork -> Maybe Text
$sel:encryption:Artwork' :: Artwork -> Maybe Encryption
$sel:paddingPolicy:Artwork' :: Artwork -> Maybe Text
$sel:inputKey:Artwork' :: Artwork -> Maybe Text
$sel:maxHeight:Artwork' :: Artwork -> Maybe Text
$sel:albumArtFormat:Artwork' :: Artwork -> Maybe Text
$sel:sizingPolicy:Artwork' :: Artwork -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SizingPolicy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sizingPolicy,
            (Text
"AlbumArtFormat" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
albumArtFormat,
            (Text
"MaxHeight" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxHeight,
            (Text
"InputKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
inputKey,
            (Text
"PaddingPolicy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
paddingPolicy,
            (Text
"Encryption" Text -> Encryption -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Encryption -> Pair) -> Maybe Encryption -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Encryption
encryption,
            (Text
"MaxWidth" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
maxWidth
          ]
      )