{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data Recommendation = Recommendation'
{
Recommendation -> Int
allMatchesCount :: Prelude.Int,
Recommendation -> Double
allMatchesSum :: Prelude.Double,
Recommendation -> ISO8601
endTime :: Data.ISO8601,
Recommendation -> Pattern
pattern' :: Pattern,
Recommendation -> ISO8601
startTime :: Data.ISO8601,
Recommendation -> [Match]
topMatches :: [Match]
}
deriving (Recommendation -> Recommendation -> Bool
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]
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
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. 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'
{ $sel:allMatchesCount:Recommendation' :: Int
allMatchesCount =
Int
pAllMatchesCount_,
$sel:allMatchesSum:Recommendation' :: Double
allMatchesSum = Double
pAllMatchesSum_,
$sel:endTime:Recommendation' :: ISO8601
endTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
$sel:pattern':Recommendation' :: Pattern
pattern' = Pattern
pPattern_,
$sel:startTime:Recommendation' :: ISO8601
startTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
$sel:topMatches:Recommendation' :: [Match]
topMatches = forall a. Monoid a => a
Prelude.mempty
}
recommendation_allMatchesCount :: Lens.Lens' Recommendation Prelude.Int
recommendation_allMatchesCount :: Lens' Recommendation Int
recommendation_allMatchesCount = 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 :: Lens' Recommendation Double
recommendation_allMatchesSum = 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 :: Lens' Recommendation UTCTime
recommendation_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {ISO8601
endTime :: ISO8601
$sel:endTime:Recommendation' :: Recommendation -> ISO8601
endTime} -> ISO8601
endTime) (\s :: Recommendation
s@Recommendation' {} ISO8601
a -> Recommendation
s {$sel:endTime:Recommendation' :: ISO8601
endTime = ISO8601
a} :: Recommendation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
recommendation_pattern :: Lens.Lens' Recommendation Pattern
recommendation_pattern :: Lens' Recommendation Pattern
recommendation_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 :: Lens' Recommendation UTCTime
recommendation_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Recommendation' {ISO8601
startTime :: ISO8601
$sel:startTime:Recommendation' :: Recommendation -> ISO8601
startTime} -> ISO8601
startTime) (\s :: Recommendation
s@Recommendation' {} ISO8601
a -> Recommendation
s {$sel:startTime:Recommendation' :: ISO8601
startTime = ISO8601
a} :: Recommendation) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
recommendation_topMatches :: Lens.Lens' Recommendation [Match]
recommendation_topMatches :: Lens' Recommendation [Match]
recommendation_topMatches = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Recommendation where
parseJSON :: Value -> Parser Recommendation
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Recommendation"
( \Object
x ->
Int
-> Double
-> ISO8601
-> Pattern
-> ISO8601
-> [Match]
-> Recommendation
Recommendation'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"allMatchesCount")
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
"allMatchesSum")
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
"endTime")
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
"pattern")
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
"startTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"topMatches" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Recommendation where
hashWithSalt :: Int -> Recommendation -> Int
hashWithSalt Int
_salt Recommendation' {Double
Int
[Match]
ISO8601
Pattern
topMatches :: [Match]
startTime :: ISO8601
pattern' :: Pattern
endTime :: ISO8601
allMatchesSum :: Double
allMatchesCount :: Int
$sel:topMatches:Recommendation' :: Recommendation -> [Match]
$sel:startTime:Recommendation' :: Recommendation -> ISO8601
$sel:pattern':Recommendation' :: Recommendation -> Pattern
$sel:endTime:Recommendation' :: Recommendation -> ISO8601
$sel:allMatchesSum:Recommendation' :: Recommendation -> Double
$sel:allMatchesCount:Recommendation' :: Recommendation -> Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
allMatchesCount
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Double
allMatchesSum
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
endTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Pattern
pattern'
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
startTime
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Match]
topMatches
instance Prelude.NFData Recommendation where
rnf :: Recommendation -> ()
rnf Recommendation' {Double
Int
[Match]
ISO8601
Pattern
topMatches :: [Match]
startTime :: ISO8601
pattern' :: Pattern
endTime :: ISO8601
allMatchesSum :: Double
allMatchesCount :: Int
$sel:topMatches:Recommendation' :: Recommendation -> [Match]
$sel:startTime:Recommendation' :: Recommendation -> ISO8601
$sel:pattern':Recommendation' :: Recommendation -> Pattern
$sel:endTime:Recommendation' :: Recommendation -> ISO8601
$sel:allMatchesSum:Recommendation' :: Recommendation -> Double
$sel:allMatchesCount:Recommendation' :: Recommendation -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
allMatchesCount
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Double
allMatchesSum
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
endTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Pattern
pattern'
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
startTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Match]
topMatches