{-# 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.Pinpoint.Types.TemplateActiveVersionRequest
-- 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.Pinpoint.Types.TemplateActiveVersionRequest where

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

-- | Specifies which version of a message template to use as the active
-- version of the template.
--
-- /See:/ 'newTemplateActiveVersionRequest' smart constructor.
data TemplateActiveVersionRequest = TemplateActiveVersionRequest'
  { -- | The version of the message template to use as the active version of the
    -- template. Valid values are: latest, for the most recent version of the
    -- template; or, the unique identifier for any existing version of the
    -- template. If you specify an identifier, the value must match the
    -- identifier for an existing template version. To retrieve a list of
    -- versions and version identifiers for a template, use the Template
    -- Versions resource.
    TemplateActiveVersionRequest -> Maybe Text
version :: Prelude.Maybe Prelude.Text
  }
  deriving (TemplateActiveVersionRequest
-> TemplateActiveVersionRequest -> Bool
(TemplateActiveVersionRequest
 -> TemplateActiveVersionRequest -> Bool)
-> (TemplateActiveVersionRequest
    -> TemplateActiveVersionRequest -> Bool)
-> Eq TemplateActiveVersionRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateActiveVersionRequest
-> TemplateActiveVersionRequest -> Bool
$c/= :: TemplateActiveVersionRequest
-> TemplateActiveVersionRequest -> Bool
== :: TemplateActiveVersionRequest
-> TemplateActiveVersionRequest -> Bool
$c== :: TemplateActiveVersionRequest
-> TemplateActiveVersionRequest -> Bool
Prelude.Eq, ReadPrec [TemplateActiveVersionRequest]
ReadPrec TemplateActiveVersionRequest
Int -> ReadS TemplateActiveVersionRequest
ReadS [TemplateActiveVersionRequest]
(Int -> ReadS TemplateActiveVersionRequest)
-> ReadS [TemplateActiveVersionRequest]
-> ReadPrec TemplateActiveVersionRequest
-> ReadPrec [TemplateActiveVersionRequest]
-> Read TemplateActiveVersionRequest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateActiveVersionRequest]
$creadListPrec :: ReadPrec [TemplateActiveVersionRequest]
readPrec :: ReadPrec TemplateActiveVersionRequest
$creadPrec :: ReadPrec TemplateActiveVersionRequest
readList :: ReadS [TemplateActiveVersionRequest]
$creadList :: ReadS [TemplateActiveVersionRequest]
readsPrec :: Int -> ReadS TemplateActiveVersionRequest
$creadsPrec :: Int -> ReadS TemplateActiveVersionRequest
Prelude.Read, Int -> TemplateActiveVersionRequest -> ShowS
[TemplateActiveVersionRequest] -> ShowS
TemplateActiveVersionRequest -> String
(Int -> TemplateActiveVersionRequest -> ShowS)
-> (TemplateActiveVersionRequest -> String)
-> ([TemplateActiveVersionRequest] -> ShowS)
-> Show TemplateActiveVersionRequest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateActiveVersionRequest] -> ShowS
$cshowList :: [TemplateActiveVersionRequest] -> ShowS
show :: TemplateActiveVersionRequest -> String
$cshow :: TemplateActiveVersionRequest -> String
showsPrec :: Int -> TemplateActiveVersionRequest -> ShowS
$cshowsPrec :: Int -> TemplateActiveVersionRequest -> ShowS
Prelude.Show, (forall x.
 TemplateActiveVersionRequest -> Rep TemplateActiveVersionRequest x)
-> (forall x.
    Rep TemplateActiveVersionRequest x -> TemplateActiveVersionRequest)
-> Generic TemplateActiveVersionRequest
forall x.
Rep TemplateActiveVersionRequest x -> TemplateActiveVersionRequest
forall x.
TemplateActiveVersionRequest -> Rep TemplateActiveVersionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TemplateActiveVersionRequest x -> TemplateActiveVersionRequest
$cfrom :: forall x.
TemplateActiveVersionRequest -> Rep TemplateActiveVersionRequest x
Prelude.Generic)

-- |
-- Create a value of 'TemplateActiveVersionRequest' 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:
--
-- 'version', 'templateActiveVersionRequest_version' - The version of the message template to use as the active version of the
-- template. Valid values are: latest, for the most recent version of the
-- template; or, the unique identifier for any existing version of the
-- template. If you specify an identifier, the value must match the
-- identifier for an existing template version. To retrieve a list of
-- versions and version identifiers for a template, use the Template
-- Versions resource.
newTemplateActiveVersionRequest ::
  TemplateActiveVersionRequest
newTemplateActiveVersionRequest :: TemplateActiveVersionRequest
newTemplateActiveVersionRequest =
  TemplateActiveVersionRequest' :: Maybe Text -> TemplateActiveVersionRequest
TemplateActiveVersionRequest'
    { $sel:version:TemplateActiveVersionRequest' :: Maybe Text
version =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The version of the message template to use as the active version of the
-- template. Valid values are: latest, for the most recent version of the
-- template; or, the unique identifier for any existing version of the
-- template. If you specify an identifier, the value must match the
-- identifier for an existing template version. To retrieve a list of
-- versions and version identifiers for a template, use the Template
-- Versions resource.
templateActiveVersionRequest_version :: Lens.Lens' TemplateActiveVersionRequest (Prelude.Maybe Prelude.Text)
templateActiveVersionRequest_version :: (Maybe Text -> f (Maybe Text))
-> TemplateActiveVersionRequest -> f TemplateActiveVersionRequest
templateActiveVersionRequest_version = (TemplateActiveVersionRequest -> Maybe Text)
-> (TemplateActiveVersionRequest
    -> Maybe Text -> TemplateActiveVersionRequest)
-> Lens
     TemplateActiveVersionRequest
     TemplateActiveVersionRequest
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateActiveVersionRequest' {Maybe Text
version :: Maybe Text
$sel:version:TemplateActiveVersionRequest' :: TemplateActiveVersionRequest -> Maybe Text
version} -> Maybe Text
version) (\s :: TemplateActiveVersionRequest
s@TemplateActiveVersionRequest' {} Maybe Text
a -> TemplateActiveVersionRequest
s {$sel:version:TemplateActiveVersionRequest' :: Maybe Text
version = Maybe Text
a} :: TemplateActiveVersionRequest)

instance
  Prelude.Hashable
    TemplateActiveVersionRequest

instance Prelude.NFData TemplateActiveVersionRequest

instance Core.ToJSON TemplateActiveVersionRequest where
  toJSON :: TemplateActiveVersionRequest -> Value
toJSON TemplateActiveVersionRequest' {Maybe Text
version :: Maybe Text
$sel:version:TemplateActiveVersionRequest' :: TemplateActiveVersionRequest -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"Version" 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
version]
      )