{-# 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.Id3Insertion
-- 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.MediaConvert.Types.Id3Insertion where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | To insert ID3 tags in your output, specify two values. Use ID3 tag (Id3)
-- to specify the base 64 encoded string and use Timecode (TimeCode) to
-- specify the time when the tag should be inserted. To insert multiple ID3
-- tags in your output, create multiple instances of ID3 insertion
-- (Id3Insertion).
--
-- /See:/ 'newId3Insertion' smart constructor.
data Id3Insertion = Id3Insertion'
  { -- | Use ID3 tag (Id3) to provide a fully formed ID3 tag in base64-encode
    -- format.
    Id3Insertion -> Maybe Text
id3 :: Prelude.Maybe Prelude.Text,
    -- | Provide a Timecode (TimeCode) in HH:MM:SS:FF or HH:MM:SS;FF format.
    Id3Insertion -> Maybe Text
timecode :: Prelude.Maybe Prelude.Text
  }
  deriving (Id3Insertion -> Id3Insertion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Id3Insertion -> Id3Insertion -> Bool
$c/= :: Id3Insertion -> Id3Insertion -> Bool
== :: Id3Insertion -> Id3Insertion -> Bool
$c== :: Id3Insertion -> Id3Insertion -> Bool
Prelude.Eq, ReadPrec [Id3Insertion]
ReadPrec Id3Insertion
Int -> ReadS Id3Insertion
ReadS [Id3Insertion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Id3Insertion]
$creadListPrec :: ReadPrec [Id3Insertion]
readPrec :: ReadPrec Id3Insertion
$creadPrec :: ReadPrec Id3Insertion
readList :: ReadS [Id3Insertion]
$creadList :: ReadS [Id3Insertion]
readsPrec :: Int -> ReadS Id3Insertion
$creadsPrec :: Int -> ReadS Id3Insertion
Prelude.Read, Int -> Id3Insertion -> ShowS
[Id3Insertion] -> ShowS
Id3Insertion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Id3Insertion] -> ShowS
$cshowList :: [Id3Insertion] -> ShowS
show :: Id3Insertion -> String
$cshow :: Id3Insertion -> String
showsPrec :: Int -> Id3Insertion -> ShowS
$cshowsPrec :: Int -> Id3Insertion -> ShowS
Prelude.Show, forall x. Rep Id3Insertion x -> Id3Insertion
forall x. Id3Insertion -> Rep Id3Insertion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Id3Insertion x -> Id3Insertion
$cfrom :: forall x. Id3Insertion -> Rep Id3Insertion x
Prelude.Generic)

-- |
-- Create a value of 'Id3Insertion' 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:
--
-- 'id3', 'id3Insertion_id3' - Use ID3 tag (Id3) to provide a fully formed ID3 tag in base64-encode
-- format.
--
-- 'timecode', 'id3Insertion_timecode' - Provide a Timecode (TimeCode) in HH:MM:SS:FF or HH:MM:SS;FF format.
newId3Insertion ::
  Id3Insertion
newId3Insertion :: Id3Insertion
newId3Insertion =
  Id3Insertion'
    { $sel:id3:Id3Insertion' :: Maybe Text
id3 = forall a. Maybe a
Prelude.Nothing,
      $sel:timecode:Id3Insertion' :: Maybe Text
timecode = forall a. Maybe a
Prelude.Nothing
    }

-- | Use ID3 tag (Id3) to provide a fully formed ID3 tag in base64-encode
-- format.
id3Insertion_id3 :: Lens.Lens' Id3Insertion (Prelude.Maybe Prelude.Text)
id3Insertion_id3 :: Lens' Id3Insertion (Maybe Text)
id3Insertion_id3 = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Id3Insertion' {Maybe Text
id3 :: Maybe Text
$sel:id3:Id3Insertion' :: Id3Insertion -> Maybe Text
id3} -> Maybe Text
id3) (\s :: Id3Insertion
s@Id3Insertion' {} Maybe Text
a -> Id3Insertion
s {$sel:id3:Id3Insertion' :: Maybe Text
id3 = Maybe Text
a} :: Id3Insertion)

-- | Provide a Timecode (TimeCode) in HH:MM:SS:FF or HH:MM:SS;FF format.
id3Insertion_timecode :: Lens.Lens' Id3Insertion (Prelude.Maybe Prelude.Text)
id3Insertion_timecode :: Lens' Id3Insertion (Maybe Text)
id3Insertion_timecode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Id3Insertion' {Maybe Text
timecode :: Maybe Text
$sel:timecode:Id3Insertion' :: Id3Insertion -> Maybe Text
timecode} -> Maybe Text
timecode) (\s :: Id3Insertion
s@Id3Insertion' {} Maybe Text
a -> Id3Insertion
s {$sel:timecode:Id3Insertion' :: Maybe Text
timecode = Maybe Text
a} :: Id3Insertion)

instance Data.FromJSON Id3Insertion where
  parseJSON :: Value -> Parser Id3Insertion
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Id3Insertion"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Id3Insertion
Id3Insertion'
            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
"id3")
            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
"timecode")
      )

instance Prelude.Hashable Id3Insertion where
  hashWithSalt :: Int -> Id3Insertion -> Int
hashWithSalt Int
_salt Id3Insertion' {Maybe Text
timecode :: Maybe Text
id3 :: Maybe Text
$sel:timecode:Id3Insertion' :: Id3Insertion -> Maybe Text
$sel:id3:Id3Insertion' :: Id3Insertion -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id3
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
timecode

instance Prelude.NFData Id3Insertion where
  rnf :: Id3Insertion -> ()
rnf Id3Insertion' {Maybe Text
timecode :: Maybe Text
id3 :: Maybe Text
$sel:timecode:Id3Insertion' :: Id3Insertion -> Maybe Text
$sel:id3:Id3Insertion' :: Id3Insertion -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id3 seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
timecode

instance Data.ToJSON Id3Insertion where
  toJSON :: Id3Insertion -> Value
toJSON Id3Insertion' {Maybe Text
timecode :: Maybe Text
id3 :: Maybe Text
$sel:timecode:Id3Insertion' :: Id3Insertion -> Maybe Text
$sel:id3:Id3Insertion' :: Id3Insertion -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"id3" 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 Text
id3,
            (Key
"timecode" 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 Text
timecode
          ]
      )