{-# 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 #-}
module Amazonka.CodeGuruProfiler.Types.Recommendation where
import Amazonka.CodeGuruProfiler.Types.Match
import Amazonka.CodeGuruProfiler.Types.Pattern
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Recommendation = Recommendation'
{
Recommendation -> Int
allMatchesCount :: Prelude.Int,
Recommendation -> Double
allMatchesSum :: Prelude.Double,
Recommendation -> POSIX
endTime :: Core.POSIX,
Recommendation -> Pattern
pattern' :: Pattern,
Recommendation -> POSIX
startTime :: Core.POSIX,
Recommendation -> [Match]
topMatches :: [Match]
}
deriving (Recommendation -> Recommendation -> Bool
(Recommendation -> Recommendation -> Bool)
-> (Recommendation -> Recommendation -> Bool) -> Eq Recommendation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Recommendation -> Recommendation -> Bool
$c/= :: Recommendation -> Recommendation -> Bool
== :: Recommendation -> Recommendation -> Bool
$c== :: Recommendation -> Recommendation -> Bool
Prelude.Eq, ReadPrec [Recommendation]
ReadPrec Recommendation
Int -> ReadS Recommendation
ReadS [Recommendation]
(Int -> ReadS Recommendation)
-> ReadS [Recommendation]
-> ReadPrec Recommendation
-> ReadPrec [Recommendation]
-> Read Recommendation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Recommendation]
$creadListPrec :: ReadPrec [Recommendation]
readPrec :: ReadPrec Recommendation
$creadPrec :: ReadPrec Recommendation
readList :: ReadS [Recommendation]
$creadList :: ReadS [Recommendation]
readsPrec :: Int -> ReadS Recommendation
$creadsPrec :: Int -> ReadS Recommendation
Prelude.Read, Int -> Recommendation -> ShowS
[Recommendation] -> ShowS
Recommendation -> String
(Int -> Recommendation -> ShowS)
-> (Recommendation -> String)
-> ([Recommendation] -> ShowS)
-> Show Recommendation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Recommendation] -> ShowS
$cshowList :: [Recommendation] -> ShowS
show :: Recommendation -> String
$cshow :: Recommendation -> String
showsPrec :: Int -> Recommendation -> ShowS
$cshowsPrec :: Int -> Recommendation -> ShowS
Prelude.Show, (forall x. Recommendation -> Rep Recommendation x)
-> (forall x. Rep Recommendation x -> Recommendation)
-> Generic Recommendation
forall x. Rep Recommendation x -> Recommendation
forall x. Recommendation -> Rep Recommendation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Recommendation x -> Recommendation
$cfrom :: forall x. Recommendation -> Rep Recommendation x
Prelude.Generic)
newRecommendation ::
Prelude.Int ->
Prelude.Double ->
Prelude.UTCTime ->
Pattern ->
Prelude.UTCTime ->
Recommendation
newRecommendation :: Int -> Double -> UTCTime -> Pattern -> UTCTime -> Recommendation
newRecommendation
Int
pAllMatchesCount_
Double
pAllMatchesSum_
UTCTime
pEndTime_
Pattern
pPattern_
UTCTime
pStartTime_ =
Recommendation' :: Int
-> Double -> POSIX -> Pattern -> POSIX -> [Match] -> Recommendation
Recommendation'
{ $sel:allMatchesCount:Recommendation' :: Int
allMatchesCount =
Int
pAllMatchesCount_,
$sel:allMatchesSum:Recommendation' :: Double
allMatchesSum = Double
pAllMatchesSum_,
$sel:endTime:Recommendation' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
$sel:pattern':Recommendation' :: Pattern
pattern' = Pattern
pPattern_,
$sel:startTime:Recommendation' :: POSIX
startTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
$sel:topMatches:Recommendation' :: [Match]
topMatches = [Match]
forall a. Monoid a => a
Prelude.mempty
}
recommendation_allMatchesCount :: Lens.Lens' Recommendation Prelude.Int
recommendation_allMatchesCount :: (Int -> f Int) -> Recommendation -> f Recommendation
recommendation_allMatchesCount = (Recommendation -> Int)
-> (Recommendation -> Int -> Recommendation)
-> Lens Recommendation Recommendation Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Int
allMatchesCount :: Int
$sel:allMatchesCount:Recommendation' :: Recommendation -> Int
allMatchesCount} -> Int
allMatchesCount) (\s :: Recommendation
s@Recommendation' {} Int
a -> Recommendation
s {$sel:allMatchesCount:Recommendation' :: Int
allMatchesCount = Int
a} :: Recommendation)
recommendation_allMatchesSum :: Lens.Lens' Recommendation Prelude.Double
recommendation_allMatchesSum :: (Double -> f Double) -> Recommendation -> f Recommendation
recommendation_allMatchesSum = (Recommendation -> Double)
-> (Recommendation -> Double -> Recommendation)
-> Lens Recommendation Recommendation Double Double
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Double
allMatchesSum :: Double
$sel:allMatchesSum:Recommendation' :: Recommendation -> Double
allMatchesSum} -> Double
allMatchesSum) (\s :: Recommendation
s@Recommendation' {} Double
a -> Recommendation
s {$sel:allMatchesSum:Recommendation' :: Double
allMatchesSum = Double
a} :: Recommendation)
recommendation_endTime :: Lens.Lens' Recommendation Prelude.UTCTime
recommendation_endTime :: (UTCTime -> f UTCTime) -> Recommendation -> f Recommendation
recommendation_endTime = (Recommendation -> POSIX)
-> (Recommendation -> POSIX -> Recommendation)
-> Lens Recommendation Recommendation POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {POSIX
endTime :: POSIX
$sel:endTime:Recommendation' :: Recommendation -> POSIX
endTime} -> POSIX
endTime) (\s :: Recommendation
s@Recommendation' {} POSIX
a -> Recommendation
s {$sel:endTime:Recommendation' :: POSIX
endTime = POSIX
a} :: Recommendation) ((POSIX -> f POSIX) -> Recommendation -> f Recommendation)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Recommendation
-> f Recommendation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
recommendation_pattern :: Lens.Lens' Recommendation Pattern
recommendation_pattern :: (Pattern -> f Pattern) -> Recommendation -> f Recommendation
recommendation_pattern = (Recommendation -> Pattern)
-> (Recommendation -> Pattern -> Recommendation)
-> Lens Recommendation Recommendation Pattern Pattern
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {Pattern
pattern' :: Pattern
$sel:pattern':Recommendation' :: Recommendation -> Pattern
pattern'} -> Pattern
pattern') (\s :: Recommendation
s@Recommendation' {} Pattern
a -> Recommendation
s {$sel:pattern':Recommendation' :: Pattern
pattern' = Pattern
a} :: Recommendation)
recommendation_startTime :: Lens.Lens' Recommendation Prelude.UTCTime
recommendation_startTime :: (UTCTime -> f UTCTime) -> Recommendation -> f Recommendation
recommendation_startTime = (Recommendation -> POSIX)
-> (Recommendation -> POSIX -> Recommendation)
-> Lens Recommendation Recommendation POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {POSIX
startTime :: POSIX
$sel:startTime:Recommendation' :: Recommendation -> POSIX
startTime} -> POSIX
startTime) (\s :: Recommendation
s@Recommendation' {} POSIX
a -> Recommendation
s {$sel:startTime:Recommendation' :: POSIX
startTime = POSIX
a} :: Recommendation) ((POSIX -> f POSIX) -> Recommendation -> f Recommendation)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> Recommendation
-> f Recommendation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
recommendation_topMatches :: Lens.Lens' Recommendation [Match]
recommendation_topMatches :: ([Match] -> f [Match]) -> Recommendation -> f Recommendation
recommendation_topMatches = (Recommendation -> [Match])
-> (Recommendation -> [Match] -> Recommendation)
-> Lens Recommendation Recommendation [Match] [Match]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {[Match]
topMatches :: [Match]
$sel:topMatches:Recommendation' :: Recommendation -> [Match]
topMatches} -> [Match]
topMatches) (\s :: Recommendation
s@Recommendation' {} [Match]
a -> Recommendation
s {$sel:topMatches:Recommendation' :: [Match]
topMatches = [Match]
a} :: Recommendation) (([Match] -> f [Match]) -> Recommendation -> f Recommendation)
-> (([Match] -> f [Match]) -> [Match] -> f [Match])
-> ([Match] -> f [Match])
-> Recommendation
-> f Recommendation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Match] -> f [Match]) -> [Match] -> f [Match]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Recommendation where
parseJSON :: Value -> Parser Recommendation
parseJSON =
String
-> (Object -> Parser Recommendation)
-> Value
-> Parser Recommendation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Recommendation"
( \Object
x ->
Int
-> Double -> POSIX -> Pattern -> POSIX -> [Match] -> Recommendation
Recommendation'
(Int
-> Double
-> POSIX
-> Pattern
-> POSIX
-> [Match]
-> Recommendation)
-> Parser Int
-> Parser
(Double -> POSIX -> Pattern -> POSIX -> [Match] -> Recommendation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"allMatchesCount")
Parser
(Double -> POSIX -> Pattern -> POSIX -> [Match] -> Recommendation)
-> Parser Double
-> Parser (POSIX -> Pattern -> POSIX -> [Match] -> Recommendation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Double
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"allMatchesSum")
Parser (POSIX -> Pattern -> POSIX -> [Match] -> Recommendation)
-> Parser POSIX
-> Parser (Pattern -> POSIX -> [Match] -> Recommendation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"endTime")
Parser (Pattern -> POSIX -> [Match] -> Recommendation)
-> Parser Pattern -> Parser (POSIX -> [Match] -> Recommendation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Pattern
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"pattern")
Parser (POSIX -> [Match] -> Recommendation)
-> Parser POSIX -> Parser ([Match] -> Recommendation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"startTime")
Parser ([Match] -> Recommendation)
-> Parser [Match] -> Parser Recommendation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Match])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"topMatches" Parser (Maybe [Match]) -> [Match] -> Parser [Match]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Match]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Recommendation
instance Prelude.NFData Recommendation