{-# 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.ConnectContactLens.Types.CategoryDetails
-- 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.ConnectContactLens.Types.CategoryDetails where

import Amazonka.ConnectContactLens.Types.PointOfInterest
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the category rule that was matched.
--
-- /See:/ 'newCategoryDetails' smart constructor.
data CategoryDetails = CategoryDetails'
  { -- | The section of audio where the category rule was detected.
    CategoryDetails -> [PointOfInterest]
pointsOfInterest :: [PointOfInterest]
  }
  deriving (CategoryDetails -> CategoryDetails -> Bool
(CategoryDetails -> CategoryDetails -> Bool)
-> (CategoryDetails -> CategoryDetails -> Bool)
-> Eq CategoryDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CategoryDetails -> CategoryDetails -> Bool
$c/= :: CategoryDetails -> CategoryDetails -> Bool
== :: CategoryDetails -> CategoryDetails -> Bool
$c== :: CategoryDetails -> CategoryDetails -> Bool
Prelude.Eq, ReadPrec [CategoryDetails]
ReadPrec CategoryDetails
Int -> ReadS CategoryDetails
ReadS [CategoryDetails]
(Int -> ReadS CategoryDetails)
-> ReadS [CategoryDetails]
-> ReadPrec CategoryDetails
-> ReadPrec [CategoryDetails]
-> Read CategoryDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CategoryDetails]
$creadListPrec :: ReadPrec [CategoryDetails]
readPrec :: ReadPrec CategoryDetails
$creadPrec :: ReadPrec CategoryDetails
readList :: ReadS [CategoryDetails]
$creadList :: ReadS [CategoryDetails]
readsPrec :: Int -> ReadS CategoryDetails
$creadsPrec :: Int -> ReadS CategoryDetails
Prelude.Read, Int -> CategoryDetails -> ShowS
[CategoryDetails] -> ShowS
CategoryDetails -> String
(Int -> CategoryDetails -> ShowS)
-> (CategoryDetails -> String)
-> ([CategoryDetails] -> ShowS)
-> Show CategoryDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CategoryDetails] -> ShowS
$cshowList :: [CategoryDetails] -> ShowS
show :: CategoryDetails -> String
$cshow :: CategoryDetails -> String
showsPrec :: Int -> CategoryDetails -> ShowS
$cshowsPrec :: Int -> CategoryDetails -> ShowS
Prelude.Show, (forall x. CategoryDetails -> Rep CategoryDetails x)
-> (forall x. Rep CategoryDetails x -> CategoryDetails)
-> Generic CategoryDetails
forall x. Rep CategoryDetails x -> CategoryDetails
forall x. CategoryDetails -> Rep CategoryDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CategoryDetails x -> CategoryDetails
$cfrom :: forall x. CategoryDetails -> Rep CategoryDetails x
Prelude.Generic)

-- |
-- Create a value of 'CategoryDetails' 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:
--
-- 'pointsOfInterest', 'categoryDetails_pointsOfInterest' - The section of audio where the category rule was detected.
newCategoryDetails ::
  CategoryDetails
newCategoryDetails :: CategoryDetails
newCategoryDetails =
  CategoryDetails' :: [PointOfInterest] -> CategoryDetails
CategoryDetails' {$sel:pointsOfInterest:CategoryDetails' :: [PointOfInterest]
pointsOfInterest = [PointOfInterest]
forall a. Monoid a => a
Prelude.mempty}

-- | The section of audio where the category rule was detected.
categoryDetails_pointsOfInterest :: Lens.Lens' CategoryDetails [PointOfInterest]
categoryDetails_pointsOfInterest :: ([PointOfInterest] -> f [PointOfInterest])
-> CategoryDetails -> f CategoryDetails
categoryDetails_pointsOfInterest = (CategoryDetails -> [PointOfInterest])
-> (CategoryDetails -> [PointOfInterest] -> CategoryDetails)
-> Lens
     CategoryDetails CategoryDetails [PointOfInterest] [PointOfInterest]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CategoryDetails' {[PointOfInterest]
pointsOfInterest :: [PointOfInterest]
$sel:pointsOfInterest:CategoryDetails' :: CategoryDetails -> [PointOfInterest]
pointsOfInterest} -> [PointOfInterest]
pointsOfInterest) (\s :: CategoryDetails
s@CategoryDetails' {} [PointOfInterest]
a -> CategoryDetails
s {$sel:pointsOfInterest:CategoryDetails' :: [PointOfInterest]
pointsOfInterest = [PointOfInterest]
a} :: CategoryDetails) (([PointOfInterest] -> f [PointOfInterest])
 -> CategoryDetails -> f CategoryDetails)
-> (([PointOfInterest] -> f [PointOfInterest])
    -> [PointOfInterest] -> f [PointOfInterest])
-> ([PointOfInterest] -> f [PointOfInterest])
-> CategoryDetails
-> f CategoryDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PointOfInterest] -> f [PointOfInterest])
-> [PointOfInterest] -> f [PointOfInterest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON CategoryDetails where
  parseJSON :: Value -> Parser CategoryDetails
parseJSON =
    String
-> (Object -> Parser CategoryDetails)
-> Value
-> Parser CategoryDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CategoryDetails"
      ( \Object
x ->
          [PointOfInterest] -> CategoryDetails
CategoryDetails'
            ([PointOfInterest] -> CategoryDetails)
-> Parser [PointOfInterest] -> Parser CategoryDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe [PointOfInterest])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PointsOfInterest"
                            Parser (Maybe [PointOfInterest])
-> [PointOfInterest] -> Parser [PointOfInterest]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [PointOfInterest]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable CategoryDetails

instance Prelude.NFData CategoryDetails