{-# 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.Connect.Types.Filters
-- 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.Connect.Types.Filters where

import Amazonka.Connect.Types.Channel
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

-- | Contains the filter to apply when retrieving metrics.
--
-- /See:/ 'newFilters' smart constructor.
data Filters = Filters'
  { -- | The channel to use to filter the metrics.
    Filters -> Maybe [Channel]
channels :: Prelude.Maybe [Channel],
    -- | The queues to use to filter the metrics. You should specify at least one
    -- queue, and can specify up to 100 queues per request. The
    -- @GetCurrentMetricsData@ API in particular requires a queue when you
    -- include a @Filter@ in your request.
    Filters -> Maybe (NonEmpty Text)
queues :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | A list of up to 100 routing profile IDs or ARNs.
    Filters -> Maybe (NonEmpty Text)
routingProfiles :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (Filters -> Filters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Filters -> Filters -> Bool
$c/= :: Filters -> Filters -> Bool
== :: Filters -> Filters -> Bool
$c== :: Filters -> Filters -> Bool
Prelude.Eq, ReadPrec [Filters]
ReadPrec Filters
Int -> ReadS Filters
ReadS [Filters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Filters]
$creadListPrec :: ReadPrec [Filters]
readPrec :: ReadPrec Filters
$creadPrec :: ReadPrec Filters
readList :: ReadS [Filters]
$creadList :: ReadS [Filters]
readsPrec :: Int -> ReadS Filters
$creadsPrec :: Int -> ReadS Filters
Prelude.Read, Int -> Filters -> ShowS
[Filters] -> ShowS
Filters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Filters] -> ShowS
$cshowList :: [Filters] -> ShowS
show :: Filters -> String
$cshow :: Filters -> String
showsPrec :: Int -> Filters -> ShowS
$cshowsPrec :: Int -> Filters -> ShowS
Prelude.Show, forall x. Rep Filters x -> Filters
forall x. Filters -> Rep Filters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Filters x -> Filters
$cfrom :: forall x. Filters -> Rep Filters x
Prelude.Generic)

-- |
-- Create a value of 'Filters' 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:
--
-- 'channels', 'filters_channels' - The channel to use to filter the metrics.
--
-- 'queues', 'filters_queues' - The queues to use to filter the metrics. You should specify at least one
-- queue, and can specify up to 100 queues per request. The
-- @GetCurrentMetricsData@ API in particular requires a queue when you
-- include a @Filter@ in your request.
--
-- 'routingProfiles', 'filters_routingProfiles' - A list of up to 100 routing profile IDs or ARNs.
newFilters ::
  Filters
newFilters :: Filters
newFilters =
  Filters'
    { $sel:channels:Filters' :: Maybe [Channel]
channels = forall a. Maybe a
Prelude.Nothing,
      $sel:queues:Filters' :: Maybe (NonEmpty Text)
queues = forall a. Maybe a
Prelude.Nothing,
      $sel:routingProfiles:Filters' :: Maybe (NonEmpty Text)
routingProfiles = forall a. Maybe a
Prelude.Nothing
    }

-- | The channel to use to filter the metrics.
filters_channels :: Lens.Lens' Filters (Prelude.Maybe [Channel])
filters_channels :: Lens' Filters (Maybe [Channel])
filters_channels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Filters' {Maybe [Channel]
channels :: Maybe [Channel]
$sel:channels:Filters' :: Filters -> Maybe [Channel]
channels} -> Maybe [Channel]
channels) (\s :: Filters
s@Filters' {} Maybe [Channel]
a -> Filters
s {$sel:channels:Filters' :: Maybe [Channel]
channels = Maybe [Channel]
a} :: Filters) 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

-- | The queues to use to filter the metrics. You should specify at least one
-- queue, and can specify up to 100 queues per request. The
-- @GetCurrentMetricsData@ API in particular requires a queue when you
-- include a @Filter@ in your request.
filters_queues :: Lens.Lens' Filters (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
filters_queues :: Lens' Filters (Maybe (NonEmpty Text))
filters_queues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Filters' {Maybe (NonEmpty Text)
queues :: Maybe (NonEmpty Text)
$sel:queues:Filters' :: Filters -> Maybe (NonEmpty Text)
queues} -> Maybe (NonEmpty Text)
queues) (\s :: Filters
s@Filters' {} Maybe (NonEmpty Text)
a -> Filters
s {$sel:queues:Filters' :: Maybe (NonEmpty Text)
queues = Maybe (NonEmpty Text)
a} :: Filters) 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

-- | A list of up to 100 routing profile IDs or ARNs.
filters_routingProfiles :: Lens.Lens' Filters (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
filters_routingProfiles :: Lens' Filters (Maybe (NonEmpty Text))
filters_routingProfiles = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Filters' {Maybe (NonEmpty Text)
routingProfiles :: Maybe (NonEmpty Text)
$sel:routingProfiles:Filters' :: Filters -> Maybe (NonEmpty Text)
routingProfiles} -> Maybe (NonEmpty Text)
routingProfiles) (\s :: Filters
s@Filters' {} Maybe (NonEmpty Text)
a -> Filters
s {$sel:routingProfiles:Filters' :: Maybe (NonEmpty Text)
routingProfiles = Maybe (NonEmpty Text)
a} :: Filters) 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

instance Prelude.Hashable Filters where
  hashWithSalt :: Int -> Filters -> Int
hashWithSalt Int
_salt Filters' {Maybe [Channel]
Maybe (NonEmpty Text)
routingProfiles :: Maybe (NonEmpty Text)
queues :: Maybe (NonEmpty Text)
channels :: Maybe [Channel]
$sel:routingProfiles:Filters' :: Filters -> Maybe (NonEmpty Text)
$sel:queues:Filters' :: Filters -> Maybe (NonEmpty Text)
$sel:channels:Filters' :: Filters -> Maybe [Channel]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Channel]
channels
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
queues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
routingProfiles

instance Prelude.NFData Filters where
  rnf :: Filters -> ()
rnf Filters' {Maybe [Channel]
Maybe (NonEmpty Text)
routingProfiles :: Maybe (NonEmpty Text)
queues :: Maybe (NonEmpty Text)
channels :: Maybe [Channel]
$sel:routingProfiles:Filters' :: Filters -> Maybe (NonEmpty Text)
$sel:queues:Filters' :: Filters -> Maybe (NonEmpty Text)
$sel:channels:Filters' :: Filters -> Maybe [Channel]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Channel]
channels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
queues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
routingProfiles

instance Data.ToJSON Filters where
  toJSON :: Filters -> Value
toJSON Filters' {Maybe [Channel]
Maybe (NonEmpty Text)
routingProfiles :: Maybe (NonEmpty Text)
queues :: Maybe (NonEmpty Text)
channels :: Maybe [Channel]
$sel:routingProfiles:Filters' :: Filters -> Maybe (NonEmpty Text)
$sel:queues:Filters' :: Filters -> Maybe (NonEmpty Text)
$sel:channels:Filters' :: Filters -> Maybe [Channel]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Channels" 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 [Channel]
channels,
            (Key
"Queues" 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 (NonEmpty Text)
queues,
            (Key
"RoutingProfiles" 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 (NonEmpty Text)
routingProfiles
          ]
      )