{-# 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.MediaConnect.Types.ListedEntitlement
-- 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.MediaConnect.Types.ListedEntitlement where

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

-- | An entitlement that has been granted to you from other AWS accounts.
--
-- /See:/ 'newListedEntitlement' smart constructor.
data ListedEntitlement = ListedEntitlement'
  { -- | Percentage from 0-100 of the data transfer cost to be billed to the
    -- subscriber.
    ListedEntitlement -> Maybe Int
dataTransferSubscriberFeePercent :: Prelude.Maybe Prelude.Int,
    -- | The ARN of the entitlement.
    ListedEntitlement -> Text
entitlementArn :: Prelude.Text,
    -- | The name of the entitlement.
    ListedEntitlement -> Text
entitlementName :: Prelude.Text
  }
  deriving (ListedEntitlement -> ListedEntitlement -> Bool
(ListedEntitlement -> ListedEntitlement -> Bool)
-> (ListedEntitlement -> ListedEntitlement -> Bool)
-> Eq ListedEntitlement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedEntitlement -> ListedEntitlement -> Bool
$c/= :: ListedEntitlement -> ListedEntitlement -> Bool
== :: ListedEntitlement -> ListedEntitlement -> Bool
$c== :: ListedEntitlement -> ListedEntitlement -> Bool
Prelude.Eq, ReadPrec [ListedEntitlement]
ReadPrec ListedEntitlement
Int -> ReadS ListedEntitlement
ReadS [ListedEntitlement]
(Int -> ReadS ListedEntitlement)
-> ReadS [ListedEntitlement]
-> ReadPrec ListedEntitlement
-> ReadPrec [ListedEntitlement]
-> Read ListedEntitlement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedEntitlement]
$creadListPrec :: ReadPrec [ListedEntitlement]
readPrec :: ReadPrec ListedEntitlement
$creadPrec :: ReadPrec ListedEntitlement
readList :: ReadS [ListedEntitlement]
$creadList :: ReadS [ListedEntitlement]
readsPrec :: Int -> ReadS ListedEntitlement
$creadsPrec :: Int -> ReadS ListedEntitlement
Prelude.Read, Int -> ListedEntitlement -> ShowS
[ListedEntitlement] -> ShowS
ListedEntitlement -> String
(Int -> ListedEntitlement -> ShowS)
-> (ListedEntitlement -> String)
-> ([ListedEntitlement] -> ShowS)
-> Show ListedEntitlement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedEntitlement] -> ShowS
$cshowList :: [ListedEntitlement] -> ShowS
show :: ListedEntitlement -> String
$cshow :: ListedEntitlement -> String
showsPrec :: Int -> ListedEntitlement -> ShowS
$cshowsPrec :: Int -> ListedEntitlement -> ShowS
Prelude.Show, (forall x. ListedEntitlement -> Rep ListedEntitlement x)
-> (forall x. Rep ListedEntitlement x -> ListedEntitlement)
-> Generic ListedEntitlement
forall x. Rep ListedEntitlement x -> ListedEntitlement
forall x. ListedEntitlement -> Rep ListedEntitlement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedEntitlement x -> ListedEntitlement
$cfrom :: forall x. ListedEntitlement -> Rep ListedEntitlement x
Prelude.Generic)

-- |
-- Create a value of 'ListedEntitlement' 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:
--
-- 'dataTransferSubscriberFeePercent', 'listedEntitlement_dataTransferSubscriberFeePercent' - Percentage from 0-100 of the data transfer cost to be billed to the
-- subscriber.
--
-- 'entitlementArn', 'listedEntitlement_entitlementArn' - The ARN of the entitlement.
--
-- 'entitlementName', 'listedEntitlement_entitlementName' - The name of the entitlement.
newListedEntitlement ::
  -- | 'entitlementArn'
  Prelude.Text ->
  -- | 'entitlementName'
  Prelude.Text ->
  ListedEntitlement
newListedEntitlement :: Text -> Text -> ListedEntitlement
newListedEntitlement
  Text
pEntitlementArn_
  Text
pEntitlementName_ =
    ListedEntitlement' :: Maybe Int -> Text -> Text -> ListedEntitlement
ListedEntitlement'
      { $sel:dataTransferSubscriberFeePercent:ListedEntitlement' :: Maybe Int
dataTransferSubscriberFeePercent =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:entitlementArn:ListedEntitlement' :: Text
entitlementArn = Text
pEntitlementArn_,
        $sel:entitlementName:ListedEntitlement' :: Text
entitlementName = Text
pEntitlementName_
      }

-- | Percentage from 0-100 of the data transfer cost to be billed to the
-- subscriber.
listedEntitlement_dataTransferSubscriberFeePercent :: Lens.Lens' ListedEntitlement (Prelude.Maybe Prelude.Int)
listedEntitlement_dataTransferSubscriberFeePercent :: (Maybe Int -> f (Maybe Int))
-> ListedEntitlement -> f ListedEntitlement
listedEntitlement_dataTransferSubscriberFeePercent = (ListedEntitlement -> Maybe Int)
-> (ListedEntitlement -> Maybe Int -> ListedEntitlement)
-> Lens ListedEntitlement ListedEntitlement (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedEntitlement' {Maybe Int
dataTransferSubscriberFeePercent :: Maybe Int
$sel:dataTransferSubscriberFeePercent:ListedEntitlement' :: ListedEntitlement -> Maybe Int
dataTransferSubscriberFeePercent} -> Maybe Int
dataTransferSubscriberFeePercent) (\s :: ListedEntitlement
s@ListedEntitlement' {} Maybe Int
a -> ListedEntitlement
s {$sel:dataTransferSubscriberFeePercent:ListedEntitlement' :: Maybe Int
dataTransferSubscriberFeePercent = Maybe Int
a} :: ListedEntitlement)

-- | The ARN of the entitlement.
listedEntitlement_entitlementArn :: Lens.Lens' ListedEntitlement Prelude.Text
listedEntitlement_entitlementArn :: (Text -> f Text) -> ListedEntitlement -> f ListedEntitlement
listedEntitlement_entitlementArn = (ListedEntitlement -> Text)
-> (ListedEntitlement -> Text -> ListedEntitlement)
-> Lens ListedEntitlement ListedEntitlement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedEntitlement' {Text
entitlementArn :: Text
$sel:entitlementArn:ListedEntitlement' :: ListedEntitlement -> Text
entitlementArn} -> Text
entitlementArn) (\s :: ListedEntitlement
s@ListedEntitlement' {} Text
a -> ListedEntitlement
s {$sel:entitlementArn:ListedEntitlement' :: Text
entitlementArn = Text
a} :: ListedEntitlement)

-- | The name of the entitlement.
listedEntitlement_entitlementName :: Lens.Lens' ListedEntitlement Prelude.Text
listedEntitlement_entitlementName :: (Text -> f Text) -> ListedEntitlement -> f ListedEntitlement
listedEntitlement_entitlementName = (ListedEntitlement -> Text)
-> (ListedEntitlement -> Text -> ListedEntitlement)
-> Lens ListedEntitlement ListedEntitlement Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedEntitlement' {Text
entitlementName :: Text
$sel:entitlementName:ListedEntitlement' :: ListedEntitlement -> Text
entitlementName} -> Text
entitlementName) (\s :: ListedEntitlement
s@ListedEntitlement' {} Text
a -> ListedEntitlement
s {$sel:entitlementName:ListedEntitlement' :: Text
entitlementName = Text
a} :: ListedEntitlement)

instance Core.FromJSON ListedEntitlement where
  parseJSON :: Value -> Parser ListedEntitlement
parseJSON =
    String
-> (Object -> Parser ListedEntitlement)
-> Value
-> Parser ListedEntitlement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ListedEntitlement"
      ( \Object
x ->
          Maybe Int -> Text -> Text -> ListedEntitlement
ListedEntitlement'
            (Maybe Int -> Text -> Text -> ListedEntitlement)
-> Parser (Maybe Int) -> Parser (Text -> Text -> ListedEntitlement)
forall (f :: * -> *) a b. Functor 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
"dataTransferSubscriberFeePercent")
            Parser (Text -> Text -> ListedEntitlement)
-> Parser Text -> Parser (Text -> ListedEntitlement)
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
"entitlementArn")
            Parser (Text -> ListedEntitlement)
-> Parser Text -> Parser ListedEntitlement
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
"entitlementName")
      )

instance Prelude.Hashable ListedEntitlement

instance Prelude.NFData ListedEntitlement