{-# 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.CodeBuild.Types.ReportFilter
-- 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.CodeBuild.Types.ReportFilter where

import Amazonka.CodeBuild.Types.ReportStatusType
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

-- | A filter used to return reports with the status specified by the input
-- @status@ parameter.
--
-- /See:/ 'newReportFilter' smart constructor.
data ReportFilter = ReportFilter'
  { -- | The status used to filter reports. You can filter using one status only.
    ReportFilter -> Maybe ReportStatusType
status :: Prelude.Maybe ReportStatusType
  }
  deriving (ReportFilter -> ReportFilter -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportFilter -> ReportFilter -> Bool
$c/= :: ReportFilter -> ReportFilter -> Bool
== :: ReportFilter -> ReportFilter -> Bool
$c== :: ReportFilter -> ReportFilter -> Bool
Prelude.Eq, ReadPrec [ReportFilter]
ReadPrec ReportFilter
Int -> ReadS ReportFilter
ReadS [ReportFilter]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportFilter]
$creadListPrec :: ReadPrec [ReportFilter]
readPrec :: ReadPrec ReportFilter
$creadPrec :: ReadPrec ReportFilter
readList :: ReadS [ReportFilter]
$creadList :: ReadS [ReportFilter]
readsPrec :: Int -> ReadS ReportFilter
$creadsPrec :: Int -> ReadS ReportFilter
Prelude.Read, Int -> ReportFilter -> ShowS
[ReportFilter] -> ShowS
ReportFilter -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportFilter] -> ShowS
$cshowList :: [ReportFilter] -> ShowS
show :: ReportFilter -> String
$cshow :: ReportFilter -> String
showsPrec :: Int -> ReportFilter -> ShowS
$cshowsPrec :: Int -> ReportFilter -> ShowS
Prelude.Show, forall x. Rep ReportFilter x -> ReportFilter
forall x. ReportFilter -> Rep ReportFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportFilter x -> ReportFilter
$cfrom :: forall x. ReportFilter -> Rep ReportFilter x
Prelude.Generic)

-- |
-- Create a value of 'ReportFilter' 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:
--
-- 'status', 'reportFilter_status' - The status used to filter reports. You can filter using one status only.
newReportFilter ::
  ReportFilter
newReportFilter :: ReportFilter
newReportFilter =
  ReportFilter' {$sel:status:ReportFilter' :: Maybe ReportStatusType
status = forall a. Maybe a
Prelude.Nothing}

-- | The status used to filter reports. You can filter using one status only.
reportFilter_status :: Lens.Lens' ReportFilter (Prelude.Maybe ReportStatusType)
reportFilter_status :: Lens' ReportFilter (Maybe ReportStatusType)
reportFilter_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportFilter' {Maybe ReportStatusType
status :: Maybe ReportStatusType
$sel:status:ReportFilter' :: ReportFilter -> Maybe ReportStatusType
status} -> Maybe ReportStatusType
status) (\s :: ReportFilter
s@ReportFilter' {} Maybe ReportStatusType
a -> ReportFilter
s {$sel:status:ReportFilter' :: Maybe ReportStatusType
status = Maybe ReportStatusType
a} :: ReportFilter)

instance Prelude.Hashable ReportFilter where
  hashWithSalt :: Int -> ReportFilter -> Int
hashWithSalt Int
_salt ReportFilter' {Maybe ReportStatusType
status :: Maybe ReportStatusType
$sel:status:ReportFilter' :: ReportFilter -> Maybe ReportStatusType
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ReportStatusType
status

instance Prelude.NFData ReportFilter where
  rnf :: ReportFilter -> ()
rnf ReportFilter' {Maybe ReportStatusType
status :: Maybe ReportStatusType
$sel:status:ReportFilter' :: ReportFilter -> Maybe ReportStatusType
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe ReportStatusType
status

instance Data.ToJSON ReportFilter where
  toJSON :: ReportFilter -> Value
toJSON ReportFilter' {Maybe ReportStatusType
status :: Maybe ReportStatusType
$sel:status:ReportFilter' :: ReportFilter -> Maybe ReportStatusType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"status" 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 ReportStatusType
status]
      )