{-# 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.BillingConductor.Types.ListResourcesAssociatedToCustomLineItemFilter
-- 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.BillingConductor.Types.ListResourcesAssociatedToCustomLineItemFilter where

import Amazonka.BillingConductor.Types.CustomLineItemRelationship
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

-- | A filter that specifies the type of resource associations that should be
-- retrieved for a custom line item.
--
-- /See:/ 'newListResourcesAssociatedToCustomLineItemFilter' smart constructor.
data ListResourcesAssociatedToCustomLineItemFilter = ListResourcesAssociatedToCustomLineItemFilter'
  { -- | The type of relationship between the custom line item and the associated
    -- resource.
    ListResourcesAssociatedToCustomLineItemFilter
-> Maybe CustomLineItemRelationship
relationship :: Prelude.Maybe CustomLineItemRelationship
  }
  deriving (ListResourcesAssociatedToCustomLineItemFilter
-> ListResourcesAssociatedToCustomLineItemFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResourcesAssociatedToCustomLineItemFilter
-> ListResourcesAssociatedToCustomLineItemFilter -> Bool
$c/= :: ListResourcesAssociatedToCustomLineItemFilter
-> ListResourcesAssociatedToCustomLineItemFilter -> Bool
== :: ListResourcesAssociatedToCustomLineItemFilter
-> ListResourcesAssociatedToCustomLineItemFilter -> Bool
$c== :: ListResourcesAssociatedToCustomLineItemFilter
-> ListResourcesAssociatedToCustomLineItemFilter -> Bool
Prelude.Eq, ReadPrec [ListResourcesAssociatedToCustomLineItemFilter]
ReadPrec ListResourcesAssociatedToCustomLineItemFilter
Int -> ReadS ListResourcesAssociatedToCustomLineItemFilter
ReadS [ListResourcesAssociatedToCustomLineItemFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItemFilter]
$creadListPrec :: ReadPrec [ListResourcesAssociatedToCustomLineItemFilter]
readPrec :: ReadPrec ListResourcesAssociatedToCustomLineItemFilter
$creadPrec :: ReadPrec ListResourcesAssociatedToCustomLineItemFilter
readList :: ReadS [ListResourcesAssociatedToCustomLineItemFilter]
$creadList :: ReadS [ListResourcesAssociatedToCustomLineItemFilter]
readsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItemFilter
$creadsPrec :: Int -> ReadS ListResourcesAssociatedToCustomLineItemFilter
Prelude.Read, Int -> ListResourcesAssociatedToCustomLineItemFilter -> ShowS
[ListResourcesAssociatedToCustomLineItemFilter] -> ShowS
ListResourcesAssociatedToCustomLineItemFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResourcesAssociatedToCustomLineItemFilter] -> ShowS
$cshowList :: [ListResourcesAssociatedToCustomLineItemFilter] -> ShowS
show :: ListResourcesAssociatedToCustomLineItemFilter -> String
$cshow :: ListResourcesAssociatedToCustomLineItemFilter -> String
showsPrec :: Int -> ListResourcesAssociatedToCustomLineItemFilter -> ShowS
$cshowsPrec :: Int -> ListResourcesAssociatedToCustomLineItemFilter -> ShowS
Prelude.Show, forall x.
Rep ListResourcesAssociatedToCustomLineItemFilter x
-> ListResourcesAssociatedToCustomLineItemFilter
forall x.
ListResourcesAssociatedToCustomLineItemFilter
-> Rep ListResourcesAssociatedToCustomLineItemFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResourcesAssociatedToCustomLineItemFilter x
-> ListResourcesAssociatedToCustomLineItemFilter
$cfrom :: forall x.
ListResourcesAssociatedToCustomLineItemFilter
-> Rep ListResourcesAssociatedToCustomLineItemFilter x
Prelude.Generic)

-- |
-- Create a value of 'ListResourcesAssociatedToCustomLineItemFilter' 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:
--
-- 'relationship', 'listResourcesAssociatedToCustomLineItemFilter_relationship' - The type of relationship between the custom line item and the associated
-- resource.
newListResourcesAssociatedToCustomLineItemFilter ::
  ListResourcesAssociatedToCustomLineItemFilter
newListResourcesAssociatedToCustomLineItemFilter :: ListResourcesAssociatedToCustomLineItemFilter
newListResourcesAssociatedToCustomLineItemFilter =
  ListResourcesAssociatedToCustomLineItemFilter'
    { $sel:relationship:ListResourcesAssociatedToCustomLineItemFilter' :: Maybe CustomLineItemRelationship
relationship =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The type of relationship between the custom line item and the associated
-- resource.
listResourcesAssociatedToCustomLineItemFilter_relationship :: Lens.Lens' ListResourcesAssociatedToCustomLineItemFilter (Prelude.Maybe CustomLineItemRelationship)
listResourcesAssociatedToCustomLineItemFilter_relationship :: Lens'
  ListResourcesAssociatedToCustomLineItemFilter
  (Maybe CustomLineItemRelationship)
listResourcesAssociatedToCustomLineItemFilter_relationship = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResourcesAssociatedToCustomLineItemFilter' {Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
$sel:relationship:ListResourcesAssociatedToCustomLineItemFilter' :: ListResourcesAssociatedToCustomLineItemFilter
-> Maybe CustomLineItemRelationship
relationship} -> Maybe CustomLineItemRelationship
relationship) (\s :: ListResourcesAssociatedToCustomLineItemFilter
s@ListResourcesAssociatedToCustomLineItemFilter' {} Maybe CustomLineItemRelationship
a -> ListResourcesAssociatedToCustomLineItemFilter
s {$sel:relationship:ListResourcesAssociatedToCustomLineItemFilter' :: Maybe CustomLineItemRelationship
relationship = Maybe CustomLineItemRelationship
a} :: ListResourcesAssociatedToCustomLineItemFilter)

instance
  Prelude.Hashable
    ListResourcesAssociatedToCustomLineItemFilter
  where
  hashWithSalt :: Int -> ListResourcesAssociatedToCustomLineItemFilter -> Int
hashWithSalt
    Int
_salt
    ListResourcesAssociatedToCustomLineItemFilter' {Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
$sel:relationship:ListResourcesAssociatedToCustomLineItemFilter' :: ListResourcesAssociatedToCustomLineItemFilter
-> Maybe CustomLineItemRelationship
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CustomLineItemRelationship
relationship

instance
  Prelude.NFData
    ListResourcesAssociatedToCustomLineItemFilter
  where
  rnf :: ListResourcesAssociatedToCustomLineItemFilter -> ()
rnf
    ListResourcesAssociatedToCustomLineItemFilter' {Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
$sel:relationship:ListResourcesAssociatedToCustomLineItemFilter' :: ListResourcesAssociatedToCustomLineItemFilter
-> Maybe CustomLineItemRelationship
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe CustomLineItemRelationship
relationship

instance
  Data.ToJSON
    ListResourcesAssociatedToCustomLineItemFilter
  where
  toJSON :: ListResourcesAssociatedToCustomLineItemFilter -> Value
toJSON
    ListResourcesAssociatedToCustomLineItemFilter' {Maybe CustomLineItemRelationship
relationship :: Maybe CustomLineItemRelationship
$sel:relationship:ListResourcesAssociatedToCustomLineItemFilter' :: ListResourcesAssociatedToCustomLineItemFilter
-> Maybe CustomLineItemRelationship
..} =
      [Pair] -> Value
Data.object
        ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [(Key
"Relationship" 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 CustomLineItemRelationship
relationship]
        )