{-# 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.IndexFieldStatus
-- 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.IndexFieldStatus where

import Amazonka.CloudSearch.Types.IndexField
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 @IndexField@ and its current status.
--
-- /See:/ 'newIndexFieldStatus' smart constructor.
data IndexFieldStatus = IndexFieldStatus'
  { IndexFieldStatus -> IndexField
options :: IndexField,
    IndexFieldStatus -> OptionStatus
status :: OptionStatus
  }
  deriving (IndexFieldStatus -> IndexFieldStatus -> Bool
(IndexFieldStatus -> IndexFieldStatus -> Bool)
-> (IndexFieldStatus -> IndexFieldStatus -> Bool)
-> Eq IndexFieldStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IndexFieldStatus -> IndexFieldStatus -> Bool
$c/= :: IndexFieldStatus -> IndexFieldStatus -> Bool
== :: IndexFieldStatus -> IndexFieldStatus -> Bool
$c== :: IndexFieldStatus -> IndexFieldStatus -> Bool
Prelude.Eq, ReadPrec [IndexFieldStatus]
ReadPrec IndexFieldStatus
Int -> ReadS IndexFieldStatus
ReadS [IndexFieldStatus]
(Int -> ReadS IndexFieldStatus)
-> ReadS [IndexFieldStatus]
-> ReadPrec IndexFieldStatus
-> ReadPrec [IndexFieldStatus]
-> Read IndexFieldStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IndexFieldStatus]
$creadListPrec :: ReadPrec [IndexFieldStatus]
readPrec :: ReadPrec IndexFieldStatus
$creadPrec :: ReadPrec IndexFieldStatus
readList :: ReadS [IndexFieldStatus]
$creadList :: ReadS [IndexFieldStatus]
readsPrec :: Int -> ReadS IndexFieldStatus
$creadsPrec :: Int -> ReadS IndexFieldStatus
Prelude.Read, Int -> IndexFieldStatus -> ShowS
[IndexFieldStatus] -> ShowS
IndexFieldStatus -> String
(Int -> IndexFieldStatus -> ShowS)
-> (IndexFieldStatus -> String)
-> ([IndexFieldStatus] -> ShowS)
-> Show IndexFieldStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IndexFieldStatus] -> ShowS
$cshowList :: [IndexFieldStatus] -> ShowS
show :: IndexFieldStatus -> String
$cshow :: IndexFieldStatus -> String
showsPrec :: Int -> IndexFieldStatus -> ShowS
$cshowsPrec :: Int -> IndexFieldStatus -> ShowS
Prelude.Show, (forall x. IndexFieldStatus -> Rep IndexFieldStatus x)
-> (forall x. Rep IndexFieldStatus x -> IndexFieldStatus)
-> Generic IndexFieldStatus
forall x. Rep IndexFieldStatus x -> IndexFieldStatus
forall x. IndexFieldStatus -> Rep IndexFieldStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IndexFieldStatus x -> IndexFieldStatus
$cfrom :: forall x. IndexFieldStatus -> Rep IndexFieldStatus x
Prelude.Generic)

-- |
-- Create a value of 'IndexFieldStatus' 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', 'indexFieldStatus_options' - Undocumented member.
--
-- 'status', 'indexFieldStatus_status' - Undocumented member.
newIndexFieldStatus ::
  -- | 'options'
  IndexField ->
  -- | 'status'
  OptionStatus ->
  IndexFieldStatus
newIndexFieldStatus :: IndexField -> OptionStatus -> IndexFieldStatus
newIndexFieldStatus IndexField
pOptions_ OptionStatus
pStatus_ =
  IndexFieldStatus' :: IndexField -> OptionStatus -> IndexFieldStatus
IndexFieldStatus'
    { $sel:options:IndexFieldStatus' :: IndexField
options = IndexField
pOptions_,
      $sel:status:IndexFieldStatus' :: OptionStatus
status = OptionStatus
pStatus_
    }

-- | Undocumented member.
indexFieldStatus_options :: Lens.Lens' IndexFieldStatus IndexField
indexFieldStatus_options :: (IndexField -> f IndexField)
-> IndexFieldStatus -> f IndexFieldStatus
indexFieldStatus_options = (IndexFieldStatus -> IndexField)
-> (IndexFieldStatus -> IndexField -> IndexFieldStatus)
-> Lens IndexFieldStatus IndexFieldStatus IndexField IndexField
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IndexFieldStatus' {IndexField
options :: IndexField
$sel:options:IndexFieldStatus' :: IndexFieldStatus -> IndexField
options} -> IndexField
options) (\s :: IndexFieldStatus
s@IndexFieldStatus' {} IndexField
a -> IndexFieldStatus
s {$sel:options:IndexFieldStatus' :: IndexField
options = IndexField
a} :: IndexFieldStatus)

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

instance Core.FromXML IndexFieldStatus where
  parseXML :: [Node] -> Either String IndexFieldStatus
parseXML [Node]
x =
    IndexField -> OptionStatus -> IndexFieldStatus
IndexFieldStatus'
      (IndexField -> OptionStatus -> IndexFieldStatus)
-> Either String IndexField
-> Either String (OptionStatus -> IndexFieldStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String IndexField
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Options")
      Either String (OptionStatus -> IndexFieldStatus)
-> Either String OptionStatus -> Either String IndexFieldStatus
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 IndexFieldStatus

instance Prelude.NFData IndexFieldStatus