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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Options for a field that contains an array of double-precision 64-bit
-- floating point values. Present if @IndexFieldType@ specifies the field
-- is of type @double-array@. All options are enabled by default.
--
-- /See:/ 'newDoubleArrayOptions' smart constructor.
data DoubleArrayOptions = DoubleArrayOptions'
  { -- | A list of source fields to map to the field.
    DoubleArrayOptions -> Maybe Text
sourceFields :: Prelude.Maybe Prelude.Text,
    -- | Whether the contents of the field can be returned in the search results.
    DoubleArrayOptions -> Maybe Bool
returnEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Whether facet information can be returned for the field.
    DoubleArrayOptions -> Maybe Bool
facetEnabled :: Prelude.Maybe Prelude.Bool,
    -- | Whether the contents of the field are searchable.
    DoubleArrayOptions -> Maybe Bool
searchEnabled :: Prelude.Maybe Prelude.Bool,
    -- | A value to use for the field if the field isn\'t specified for a
    -- document.
    DoubleArrayOptions -> Maybe Double
defaultValue :: Prelude.Maybe Prelude.Double
  }
  deriving (DoubleArrayOptions -> DoubleArrayOptions -> Bool
(DoubleArrayOptions -> DoubleArrayOptions -> Bool)
-> (DoubleArrayOptions -> DoubleArrayOptions -> Bool)
-> Eq DoubleArrayOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DoubleArrayOptions -> DoubleArrayOptions -> Bool
$c/= :: DoubleArrayOptions -> DoubleArrayOptions -> Bool
== :: DoubleArrayOptions -> DoubleArrayOptions -> Bool
$c== :: DoubleArrayOptions -> DoubleArrayOptions -> Bool
Prelude.Eq, ReadPrec [DoubleArrayOptions]
ReadPrec DoubleArrayOptions
Int -> ReadS DoubleArrayOptions
ReadS [DoubleArrayOptions]
(Int -> ReadS DoubleArrayOptions)
-> ReadS [DoubleArrayOptions]
-> ReadPrec DoubleArrayOptions
-> ReadPrec [DoubleArrayOptions]
-> Read DoubleArrayOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DoubleArrayOptions]
$creadListPrec :: ReadPrec [DoubleArrayOptions]
readPrec :: ReadPrec DoubleArrayOptions
$creadPrec :: ReadPrec DoubleArrayOptions
readList :: ReadS [DoubleArrayOptions]
$creadList :: ReadS [DoubleArrayOptions]
readsPrec :: Int -> ReadS DoubleArrayOptions
$creadsPrec :: Int -> ReadS DoubleArrayOptions
Prelude.Read, Int -> DoubleArrayOptions -> ShowS
[DoubleArrayOptions] -> ShowS
DoubleArrayOptions -> String
(Int -> DoubleArrayOptions -> ShowS)
-> (DoubleArrayOptions -> String)
-> ([DoubleArrayOptions] -> ShowS)
-> Show DoubleArrayOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DoubleArrayOptions] -> ShowS
$cshowList :: [DoubleArrayOptions] -> ShowS
show :: DoubleArrayOptions -> String
$cshow :: DoubleArrayOptions -> String
showsPrec :: Int -> DoubleArrayOptions -> ShowS
$cshowsPrec :: Int -> DoubleArrayOptions -> ShowS
Prelude.Show, (forall x. DoubleArrayOptions -> Rep DoubleArrayOptions x)
-> (forall x. Rep DoubleArrayOptions x -> DoubleArrayOptions)
-> Generic DoubleArrayOptions
forall x. Rep DoubleArrayOptions x -> DoubleArrayOptions
forall x. DoubleArrayOptions -> Rep DoubleArrayOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DoubleArrayOptions x -> DoubleArrayOptions
$cfrom :: forall x. DoubleArrayOptions -> Rep DoubleArrayOptions x
Prelude.Generic)

-- |
-- Create a value of 'DoubleArrayOptions' 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:
--
-- 'sourceFields', 'doubleArrayOptions_sourceFields' - A list of source fields to map to the field.
--
-- 'returnEnabled', 'doubleArrayOptions_returnEnabled' - Whether the contents of the field can be returned in the search results.
--
-- 'facetEnabled', 'doubleArrayOptions_facetEnabled' - Whether facet information can be returned for the field.
--
-- 'searchEnabled', 'doubleArrayOptions_searchEnabled' - Whether the contents of the field are searchable.
--
-- 'defaultValue', 'doubleArrayOptions_defaultValue' - A value to use for the field if the field isn\'t specified for a
-- document.
newDoubleArrayOptions ::
  DoubleArrayOptions
newDoubleArrayOptions :: DoubleArrayOptions
newDoubleArrayOptions =
  DoubleArrayOptions' :: Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Double
-> DoubleArrayOptions
DoubleArrayOptions'
    { $sel:sourceFields:DoubleArrayOptions' :: Maybe Text
sourceFields = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:returnEnabled:DoubleArrayOptions' :: Maybe Bool
returnEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:facetEnabled:DoubleArrayOptions' :: Maybe Bool
facetEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:searchEnabled:DoubleArrayOptions' :: Maybe Bool
searchEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultValue:DoubleArrayOptions' :: Maybe Double
defaultValue = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of source fields to map to the field.
doubleArrayOptions_sourceFields :: Lens.Lens' DoubleArrayOptions (Prelude.Maybe Prelude.Text)
doubleArrayOptions_sourceFields :: (Maybe Text -> f (Maybe Text))
-> DoubleArrayOptions -> f DoubleArrayOptions
doubleArrayOptions_sourceFields = (DoubleArrayOptions -> Maybe Text)
-> (DoubleArrayOptions -> Maybe Text -> DoubleArrayOptions)
-> Lens
     DoubleArrayOptions DoubleArrayOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DoubleArrayOptions' {Maybe Text
sourceFields :: Maybe Text
$sel:sourceFields:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Text
sourceFields} -> Maybe Text
sourceFields) (\s :: DoubleArrayOptions
s@DoubleArrayOptions' {} Maybe Text
a -> DoubleArrayOptions
s {$sel:sourceFields:DoubleArrayOptions' :: Maybe Text
sourceFields = Maybe Text
a} :: DoubleArrayOptions)

-- | Whether the contents of the field can be returned in the search results.
doubleArrayOptions_returnEnabled :: Lens.Lens' DoubleArrayOptions (Prelude.Maybe Prelude.Bool)
doubleArrayOptions_returnEnabled :: (Maybe Bool -> f (Maybe Bool))
-> DoubleArrayOptions -> f DoubleArrayOptions
doubleArrayOptions_returnEnabled = (DoubleArrayOptions -> Maybe Bool)
-> (DoubleArrayOptions -> Maybe Bool -> DoubleArrayOptions)
-> Lens
     DoubleArrayOptions DoubleArrayOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DoubleArrayOptions' {Maybe Bool
returnEnabled :: Maybe Bool
$sel:returnEnabled:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Bool
returnEnabled} -> Maybe Bool
returnEnabled) (\s :: DoubleArrayOptions
s@DoubleArrayOptions' {} Maybe Bool
a -> DoubleArrayOptions
s {$sel:returnEnabled:DoubleArrayOptions' :: Maybe Bool
returnEnabled = Maybe Bool
a} :: DoubleArrayOptions)

-- | Whether facet information can be returned for the field.
doubleArrayOptions_facetEnabled :: Lens.Lens' DoubleArrayOptions (Prelude.Maybe Prelude.Bool)
doubleArrayOptions_facetEnabled :: (Maybe Bool -> f (Maybe Bool))
-> DoubleArrayOptions -> f DoubleArrayOptions
doubleArrayOptions_facetEnabled = (DoubleArrayOptions -> Maybe Bool)
-> (DoubleArrayOptions -> Maybe Bool -> DoubleArrayOptions)
-> Lens
     DoubleArrayOptions DoubleArrayOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DoubleArrayOptions' {Maybe Bool
facetEnabled :: Maybe Bool
$sel:facetEnabled:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Bool
facetEnabled} -> Maybe Bool
facetEnabled) (\s :: DoubleArrayOptions
s@DoubleArrayOptions' {} Maybe Bool
a -> DoubleArrayOptions
s {$sel:facetEnabled:DoubleArrayOptions' :: Maybe Bool
facetEnabled = Maybe Bool
a} :: DoubleArrayOptions)

-- | Whether the contents of the field are searchable.
doubleArrayOptions_searchEnabled :: Lens.Lens' DoubleArrayOptions (Prelude.Maybe Prelude.Bool)
doubleArrayOptions_searchEnabled :: (Maybe Bool -> f (Maybe Bool))
-> DoubleArrayOptions -> f DoubleArrayOptions
doubleArrayOptions_searchEnabled = (DoubleArrayOptions -> Maybe Bool)
-> (DoubleArrayOptions -> Maybe Bool -> DoubleArrayOptions)
-> Lens
     DoubleArrayOptions DoubleArrayOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DoubleArrayOptions' {Maybe Bool
searchEnabled :: Maybe Bool
$sel:searchEnabled:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Bool
searchEnabled} -> Maybe Bool
searchEnabled) (\s :: DoubleArrayOptions
s@DoubleArrayOptions' {} Maybe Bool
a -> DoubleArrayOptions
s {$sel:searchEnabled:DoubleArrayOptions' :: Maybe Bool
searchEnabled = Maybe Bool
a} :: DoubleArrayOptions)

-- | A value to use for the field if the field isn\'t specified for a
-- document.
doubleArrayOptions_defaultValue :: Lens.Lens' DoubleArrayOptions (Prelude.Maybe Prelude.Double)
doubleArrayOptions_defaultValue :: (Maybe Double -> f (Maybe Double))
-> DoubleArrayOptions -> f DoubleArrayOptions
doubleArrayOptions_defaultValue = (DoubleArrayOptions -> Maybe Double)
-> (DoubleArrayOptions -> Maybe Double -> DoubleArrayOptions)
-> Lens
     DoubleArrayOptions DoubleArrayOptions (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DoubleArrayOptions' {Maybe Double
defaultValue :: Maybe Double
$sel:defaultValue:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Double
defaultValue} -> Maybe Double
defaultValue) (\s :: DoubleArrayOptions
s@DoubleArrayOptions' {} Maybe Double
a -> DoubleArrayOptions
s {$sel:defaultValue:DoubleArrayOptions' :: Maybe Double
defaultValue = Maybe Double
a} :: DoubleArrayOptions)

instance Core.FromXML DoubleArrayOptions where
  parseXML :: [Node] -> Either String DoubleArrayOptions
parseXML [Node]
x =
    Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Double
-> DoubleArrayOptions
DoubleArrayOptions'
      (Maybe Text
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe Double
 -> DoubleArrayOptions)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Bool -> Maybe Bool -> Maybe Double -> DoubleArrayOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SourceFields")
      Either
  String
  (Maybe Bool
   -> Maybe Bool -> Maybe Bool -> Maybe Double -> DoubleArrayOptions)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Bool -> Maybe Bool -> Maybe Double -> DoubleArrayOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReturnEnabled")
      Either
  String
  (Maybe Bool -> Maybe Bool -> Maybe Double -> DoubleArrayOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Bool -> Maybe Double -> DoubleArrayOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FacetEnabled")
      Either String (Maybe Bool -> Maybe Double -> DoubleArrayOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Double -> DoubleArrayOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SearchEnabled")
      Either String (Maybe Double -> DoubleArrayOptions)
-> Either String (Maybe Double) -> Either String DoubleArrayOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DefaultValue")

instance Prelude.Hashable DoubleArrayOptions

instance Prelude.NFData DoubleArrayOptions

instance Core.ToQuery DoubleArrayOptions where
  toQuery :: DoubleArrayOptions -> QueryString
toQuery DoubleArrayOptions' {Maybe Bool
Maybe Double
Maybe Text
defaultValue :: Maybe Double
searchEnabled :: Maybe Bool
facetEnabled :: Maybe Bool
returnEnabled :: Maybe Bool
sourceFields :: Maybe Text
$sel:defaultValue:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Double
$sel:searchEnabled:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Bool
$sel:facetEnabled:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Bool
$sel:returnEnabled:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Bool
$sel:sourceFields:DoubleArrayOptions' :: DoubleArrayOptions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"SourceFields" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sourceFields,
        ByteString
"ReturnEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
returnEnabled,
        ByteString
"FacetEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
facetEnabled,
        ByteString
"SearchEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
searchEnabled,
        ByteString
"DefaultValue" ByteString -> Maybe Double -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Double
defaultValue
      ]