{-# 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.LicenseManager.Types.ProductInformationFilter
-- 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.LicenseManager.Types.ProductInformationFilter 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

-- | Describes product information filters.
--
-- /See:/ 'newProductInformationFilter' smart constructor.
data ProductInformationFilter = ProductInformationFilter'
  { -- | Filter value.
    ProductInformationFilter -> Maybe [Text]
productInformationFilterValue :: Prelude.Maybe [Prelude.Text],
    -- | Filter name.
    ProductInformationFilter -> Text
productInformationFilterName :: Prelude.Text,
    -- | Logical operator.
    ProductInformationFilter -> Text
productInformationFilterComparator :: Prelude.Text
  }
  deriving (ProductInformationFilter -> ProductInformationFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProductInformationFilter -> ProductInformationFilter -> Bool
$c/= :: ProductInformationFilter -> ProductInformationFilter -> Bool
== :: ProductInformationFilter -> ProductInformationFilter -> Bool
$c== :: ProductInformationFilter -> ProductInformationFilter -> Bool
Prelude.Eq, ReadPrec [ProductInformationFilter]
ReadPrec ProductInformationFilter
Int -> ReadS ProductInformationFilter
ReadS [ProductInformationFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProductInformationFilter]
$creadListPrec :: ReadPrec [ProductInformationFilter]
readPrec :: ReadPrec ProductInformationFilter
$creadPrec :: ReadPrec ProductInformationFilter
readList :: ReadS [ProductInformationFilter]
$creadList :: ReadS [ProductInformationFilter]
readsPrec :: Int -> ReadS ProductInformationFilter
$creadsPrec :: Int -> ReadS ProductInformationFilter
Prelude.Read, Int -> ProductInformationFilter -> ShowS
[ProductInformationFilter] -> ShowS
ProductInformationFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProductInformationFilter] -> ShowS
$cshowList :: [ProductInformationFilter] -> ShowS
show :: ProductInformationFilter -> String
$cshow :: ProductInformationFilter -> String
showsPrec :: Int -> ProductInformationFilter -> ShowS
$cshowsPrec :: Int -> ProductInformationFilter -> ShowS
Prelude.Show, forall x.
Rep ProductInformationFilter x -> ProductInformationFilter
forall x.
ProductInformationFilter -> Rep ProductInformationFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ProductInformationFilter x -> ProductInformationFilter
$cfrom :: forall x.
ProductInformationFilter -> Rep ProductInformationFilter x
Prelude.Generic)

-- |
-- Create a value of 'ProductInformationFilter' 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:
--
-- 'productInformationFilterValue', 'productInformationFilter_productInformationFilterValue' - Filter value.
--
-- 'productInformationFilterName', 'productInformationFilter_productInformationFilterName' - Filter name.
--
-- 'productInformationFilterComparator', 'productInformationFilter_productInformationFilterComparator' - Logical operator.
newProductInformationFilter ::
  -- | 'productInformationFilterName'
  Prelude.Text ->
  -- | 'productInformationFilterComparator'
  Prelude.Text ->
  ProductInformationFilter
newProductInformationFilter :: Text -> Text -> ProductInformationFilter
newProductInformationFilter
  Text
pProductInformationFilterName_
  Text
pProductInformationFilterComparator_ =
    ProductInformationFilter'
      { $sel:productInformationFilterValue:ProductInformationFilter' :: Maybe [Text]
productInformationFilterValue =
          forall a. Maybe a
Prelude.Nothing,
        $sel:productInformationFilterName:ProductInformationFilter' :: Text
productInformationFilterName =
          Text
pProductInformationFilterName_,
        $sel:productInformationFilterComparator:ProductInformationFilter' :: Text
productInformationFilterComparator =
          Text
pProductInformationFilterComparator_
      }

-- | Filter value.
productInformationFilter_productInformationFilterValue :: Lens.Lens' ProductInformationFilter (Prelude.Maybe [Prelude.Text])
productInformationFilter_productInformationFilterValue :: Lens' ProductInformationFilter (Maybe [Text])
productInformationFilter_productInformationFilterValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformationFilter' {Maybe [Text]
productInformationFilterValue :: Maybe [Text]
$sel:productInformationFilterValue:ProductInformationFilter' :: ProductInformationFilter -> Maybe [Text]
productInformationFilterValue} -> Maybe [Text]
productInformationFilterValue) (\s :: ProductInformationFilter
s@ProductInformationFilter' {} Maybe [Text]
a -> ProductInformationFilter
s {$sel:productInformationFilterValue:ProductInformationFilter' :: Maybe [Text]
productInformationFilterValue = Maybe [Text]
a} :: ProductInformationFilter) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Filter name.
productInformationFilter_productInformationFilterName :: Lens.Lens' ProductInformationFilter Prelude.Text
productInformationFilter_productInformationFilterName :: Lens' ProductInformationFilter Text
productInformationFilter_productInformationFilterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformationFilter' {Text
productInformationFilterName :: Text
$sel:productInformationFilterName:ProductInformationFilter' :: ProductInformationFilter -> Text
productInformationFilterName} -> Text
productInformationFilterName) (\s :: ProductInformationFilter
s@ProductInformationFilter' {} Text
a -> ProductInformationFilter
s {$sel:productInformationFilterName:ProductInformationFilter' :: Text
productInformationFilterName = Text
a} :: ProductInformationFilter)

-- | Logical operator.
productInformationFilter_productInformationFilterComparator :: Lens.Lens' ProductInformationFilter Prelude.Text
productInformationFilter_productInformationFilterComparator :: Lens' ProductInformationFilter Text
productInformationFilter_productInformationFilterComparator = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProductInformationFilter' {Text
productInformationFilterComparator :: Text
$sel:productInformationFilterComparator:ProductInformationFilter' :: ProductInformationFilter -> Text
productInformationFilterComparator} -> Text
productInformationFilterComparator) (\s :: ProductInformationFilter
s@ProductInformationFilter' {} Text
a -> ProductInformationFilter
s {$sel:productInformationFilterComparator:ProductInformationFilter' :: Text
productInformationFilterComparator = Text
a} :: ProductInformationFilter)

instance Data.FromJSON ProductInformationFilter where
  parseJSON :: Value -> Parser ProductInformationFilter
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProductInformationFilter"
      ( \Object
x ->
          Maybe [Text] -> Text -> Text -> ProductInformationFilter
ProductInformationFilter'
            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
"ProductInformationFilterValue"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ProductInformationFilterName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"ProductInformationFilterComparator")
      )

instance Prelude.Hashable ProductInformationFilter where
  hashWithSalt :: Int -> ProductInformationFilter -> Int
hashWithSalt Int
_salt ProductInformationFilter' {Maybe [Text]
Text
productInformationFilterComparator :: Text
productInformationFilterName :: Text
productInformationFilterValue :: Maybe [Text]
$sel:productInformationFilterComparator:ProductInformationFilter' :: ProductInformationFilter -> Text
$sel:productInformationFilterName:ProductInformationFilter' :: ProductInformationFilter -> Text
$sel:productInformationFilterValue:ProductInformationFilter' :: ProductInformationFilter -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
productInformationFilterValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productInformationFilterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productInformationFilterComparator

instance Prelude.NFData ProductInformationFilter where
  rnf :: ProductInformationFilter -> ()
rnf ProductInformationFilter' {Maybe [Text]
Text
productInformationFilterComparator :: Text
productInformationFilterName :: Text
productInformationFilterValue :: Maybe [Text]
$sel:productInformationFilterComparator:ProductInformationFilter' :: ProductInformationFilter -> Text
$sel:productInformationFilterName:ProductInformationFilter' :: ProductInformationFilter -> Text
$sel:productInformationFilterValue:ProductInformationFilter' :: ProductInformationFilter -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
productInformationFilterValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productInformationFilterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productInformationFilterComparator

instance Data.ToJSON ProductInformationFilter where
  toJSON :: ProductInformationFilter -> Value
toJSON ProductInformationFilter' {Maybe [Text]
Text
productInformationFilterComparator :: Text
productInformationFilterName :: Text
productInformationFilterValue :: Maybe [Text]
$sel:productInformationFilterComparator:ProductInformationFilter' :: ProductInformationFilter -> Text
$sel:productInformationFilterName:ProductInformationFilter' :: ProductInformationFilter -> Text
$sel:productInformationFilterValue:ProductInformationFilter' :: ProductInformationFilter -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ProductInformationFilterValue" 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]
productInformationFilterValue,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ProductInformationFilterName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productInformationFilterName
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ProductInformationFilterComparator"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productInformationFilterComparator
              )
          ]
      )