{-# 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.CloudSearch.Types.ExpressionStatus
-- 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.CloudSearch.Types.ExpressionStatus where

import Amazonka.CloudSearch.Types.Expression
import Amazonka.CloudSearch.Types.OptionStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The value of an @Expression@ and its current status.
--
-- /See:/ 'newExpressionStatus' smart constructor.
data ExpressionStatus = ExpressionStatus'
  { -- | The expression that is evaluated for sorting while processing a search
    -- request.
    ExpressionStatus -> Expression
options :: Expression,
    ExpressionStatus -> OptionStatus
status :: OptionStatus
  }
  deriving (ExpressionStatus -> ExpressionStatus -> Bool
(ExpressionStatus -> ExpressionStatus -> Bool)
-> (ExpressionStatus -> ExpressionStatus -> Bool)
-> Eq ExpressionStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExpressionStatus -> ExpressionStatus -> Bool
$c/= :: ExpressionStatus -> ExpressionStatus -> Bool
== :: ExpressionStatus -> ExpressionStatus -> Bool
$c== :: ExpressionStatus -> ExpressionStatus -> Bool
Prelude.Eq, ReadPrec [ExpressionStatus]
ReadPrec ExpressionStatus
Int -> ReadS ExpressionStatus
ReadS [ExpressionStatus]
(Int -> ReadS ExpressionStatus)
-> ReadS [ExpressionStatus]
-> ReadPrec ExpressionStatus
-> ReadPrec [ExpressionStatus]
-> Read ExpressionStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExpressionStatus]
$creadListPrec :: ReadPrec [ExpressionStatus]
readPrec :: ReadPrec ExpressionStatus
$creadPrec :: ReadPrec ExpressionStatus
readList :: ReadS [ExpressionStatus]
$creadList :: ReadS [ExpressionStatus]
readsPrec :: Int -> ReadS ExpressionStatus
$creadsPrec :: Int -> ReadS ExpressionStatus
Prelude.Read, Int -> ExpressionStatus -> ShowS
[ExpressionStatus] -> ShowS
ExpressionStatus -> String
(Int -> ExpressionStatus -> ShowS)
-> (ExpressionStatus -> String)
-> ([ExpressionStatus] -> ShowS)
-> Show ExpressionStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExpressionStatus] -> ShowS
$cshowList :: [ExpressionStatus] -> ShowS
show :: ExpressionStatus -> String
$cshow :: ExpressionStatus -> String
showsPrec :: Int -> ExpressionStatus -> ShowS
$cshowsPrec :: Int -> ExpressionStatus -> ShowS
Prelude.Show, (forall x. ExpressionStatus -> Rep ExpressionStatus x)
-> (forall x. Rep ExpressionStatus x -> ExpressionStatus)
-> Generic ExpressionStatus
forall x. Rep ExpressionStatus x -> ExpressionStatus
forall x. ExpressionStatus -> Rep ExpressionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExpressionStatus x -> ExpressionStatus
$cfrom :: forall x. ExpressionStatus -> Rep ExpressionStatus x
Prelude.Generic)

-- |
-- Create a value of 'ExpressionStatus' 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:
--
-- 'options', 'expressionStatus_options' - The expression that is evaluated for sorting while processing a search
-- request.
--
-- 'status', 'expressionStatus_status' - Undocumented member.
newExpressionStatus ::
  -- | 'options'
  Expression ->
  -- | 'status'
  OptionStatus ->
  ExpressionStatus
newExpressionStatus :: Expression -> OptionStatus -> ExpressionStatus
newExpressionStatus Expression
pOptions_ OptionStatus
pStatus_ =
  ExpressionStatus' :: Expression -> OptionStatus -> ExpressionStatus
ExpressionStatus'
    { $sel:options:ExpressionStatus' :: Expression
options = Expression
pOptions_,
      $sel:status:ExpressionStatus' :: OptionStatus
status = OptionStatus
pStatus_
    }

-- | The expression that is evaluated for sorting while processing a search
-- request.
expressionStatus_options :: Lens.Lens' ExpressionStatus Expression
expressionStatus_options :: (Expression -> f Expression)
-> ExpressionStatus -> f ExpressionStatus
expressionStatus_options = (ExpressionStatus -> Expression)
-> (ExpressionStatus -> Expression -> ExpressionStatus)
-> Lens ExpressionStatus ExpressionStatus Expression Expression
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpressionStatus' {Expression
options :: Expression
$sel:options:ExpressionStatus' :: ExpressionStatus -> Expression
options} -> Expression
options) (\s :: ExpressionStatus
s@ExpressionStatus' {} Expression
a -> ExpressionStatus
s {$sel:options:ExpressionStatus' :: Expression
options = Expression
a} :: ExpressionStatus)

-- | Undocumented member.
expressionStatus_status :: Lens.Lens' ExpressionStatus OptionStatus
expressionStatus_status :: (OptionStatus -> f OptionStatus)
-> ExpressionStatus -> f ExpressionStatus
expressionStatus_status = (ExpressionStatus -> OptionStatus)
-> (ExpressionStatus -> OptionStatus -> ExpressionStatus)
-> Lens ExpressionStatus ExpressionStatus OptionStatus OptionStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExpressionStatus' {OptionStatus
status :: OptionStatus
$sel:status:ExpressionStatus' :: ExpressionStatus -> OptionStatus
status} -> OptionStatus
status) (\s :: ExpressionStatus
s@ExpressionStatus' {} OptionStatus
a -> ExpressionStatus
s {$sel:status:ExpressionStatus' :: OptionStatus
status = OptionStatus
a} :: ExpressionStatus)

instance Core.FromXML ExpressionStatus where
  parseXML :: [Node] -> Either String ExpressionStatus
parseXML [Node]
x =
    Expression -> OptionStatus -> ExpressionStatus
ExpressionStatus'
      (Expression -> OptionStatus -> ExpressionStatus)
-> Either String Expression
-> Either String (OptionStatus -> ExpressionStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Expression
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Options")
      Either String (OptionStatus -> ExpressionStatus)
-> Either String OptionStatus -> Either String ExpressionStatus
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String OptionStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Status")

instance Prelude.Hashable ExpressionStatus

instance Prelude.NFData ExpressionStatus