{-# 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.CloudSearch.Types.DateOptions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DateOptions = DateOptions'
{ DateOptions -> Maybe Text
sourceField :: Prelude.Maybe Prelude.Text,
DateOptions -> Maybe Bool
returnEnabled :: Prelude.Maybe Prelude.Bool,
DateOptions -> Maybe Bool
facetEnabled :: Prelude.Maybe Prelude.Bool,
DateOptions -> Maybe Bool
searchEnabled :: Prelude.Maybe Prelude.Bool,
DateOptions -> Maybe Bool
sortEnabled :: Prelude.Maybe Prelude.Bool,
DateOptions -> Maybe Text
defaultValue :: Prelude.Maybe Prelude.Text
}
deriving (DateOptions -> DateOptions -> Bool
(DateOptions -> DateOptions -> Bool)
-> (DateOptions -> DateOptions -> Bool) -> Eq DateOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DateOptions -> DateOptions -> Bool
$c/= :: DateOptions -> DateOptions -> Bool
== :: DateOptions -> DateOptions -> Bool
$c== :: DateOptions -> DateOptions -> Bool
Prelude.Eq, ReadPrec [DateOptions]
ReadPrec DateOptions
Int -> ReadS DateOptions
ReadS [DateOptions]
(Int -> ReadS DateOptions)
-> ReadS [DateOptions]
-> ReadPrec DateOptions
-> ReadPrec [DateOptions]
-> Read DateOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DateOptions]
$creadListPrec :: ReadPrec [DateOptions]
readPrec :: ReadPrec DateOptions
$creadPrec :: ReadPrec DateOptions
readList :: ReadS [DateOptions]
$creadList :: ReadS [DateOptions]
readsPrec :: Int -> ReadS DateOptions
$creadsPrec :: Int -> ReadS DateOptions
Prelude.Read, Int -> DateOptions -> ShowS
[DateOptions] -> ShowS
DateOptions -> String
(Int -> DateOptions -> ShowS)
-> (DateOptions -> String)
-> ([DateOptions] -> ShowS)
-> Show DateOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DateOptions] -> ShowS
$cshowList :: [DateOptions] -> ShowS
show :: DateOptions -> String
$cshow :: DateOptions -> String
showsPrec :: Int -> DateOptions -> ShowS
$cshowsPrec :: Int -> DateOptions -> ShowS
Prelude.Show, (forall x. DateOptions -> Rep DateOptions x)
-> (forall x. Rep DateOptions x -> DateOptions)
-> Generic DateOptions
forall x. Rep DateOptions x -> DateOptions
forall x. DateOptions -> Rep DateOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DateOptions x -> DateOptions
$cfrom :: forall x. DateOptions -> Rep DateOptions x
Prelude.Generic)
newDateOptions ::
DateOptions
newDateOptions :: DateOptions
newDateOptions =
DateOptions' :: Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> DateOptions
DateOptions'
{ $sel:sourceField:DateOptions' :: Maybe Text
sourceField = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:returnEnabled:DateOptions' :: Maybe Bool
returnEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:facetEnabled:DateOptions' :: Maybe Bool
facetEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:searchEnabled:DateOptions' :: Maybe Bool
searchEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:sortEnabled:DateOptions' :: Maybe Bool
sortEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:defaultValue:DateOptions' :: Maybe Text
defaultValue = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
dateOptions_sourceField :: Lens.Lens' DateOptions (Prelude.Maybe Prelude.Text)
dateOptions_sourceField :: (Maybe Text -> f (Maybe Text)) -> DateOptions -> f DateOptions
dateOptions_sourceField = (DateOptions -> Maybe Text)
-> (DateOptions -> Maybe Text -> DateOptions)
-> Lens DateOptions DateOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateOptions' {Maybe Text
sourceField :: Maybe Text
$sel:sourceField:DateOptions' :: DateOptions -> Maybe Text
sourceField} -> Maybe Text
sourceField) (\s :: DateOptions
s@DateOptions' {} Maybe Text
a -> DateOptions
s {$sel:sourceField:DateOptions' :: Maybe Text
sourceField = Maybe Text
a} :: DateOptions)
dateOptions_returnEnabled :: Lens.Lens' DateOptions (Prelude.Maybe Prelude.Bool)
dateOptions_returnEnabled :: (Maybe Bool -> f (Maybe Bool)) -> DateOptions -> f DateOptions
dateOptions_returnEnabled = (DateOptions -> Maybe Bool)
-> (DateOptions -> Maybe Bool -> DateOptions)
-> Lens DateOptions DateOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateOptions' {Maybe Bool
returnEnabled :: Maybe Bool
$sel:returnEnabled:DateOptions' :: DateOptions -> Maybe Bool
returnEnabled} -> Maybe Bool
returnEnabled) (\s :: DateOptions
s@DateOptions' {} Maybe Bool
a -> DateOptions
s {$sel:returnEnabled:DateOptions' :: Maybe Bool
returnEnabled = Maybe Bool
a} :: DateOptions)
dateOptions_facetEnabled :: Lens.Lens' DateOptions (Prelude.Maybe Prelude.Bool)
dateOptions_facetEnabled :: (Maybe Bool -> f (Maybe Bool)) -> DateOptions -> f DateOptions
dateOptions_facetEnabled = (DateOptions -> Maybe Bool)
-> (DateOptions -> Maybe Bool -> DateOptions)
-> Lens DateOptions DateOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateOptions' {Maybe Bool
facetEnabled :: Maybe Bool
$sel:facetEnabled:DateOptions' :: DateOptions -> Maybe Bool
facetEnabled} -> Maybe Bool
facetEnabled) (\s :: DateOptions
s@DateOptions' {} Maybe Bool
a -> DateOptions
s {$sel:facetEnabled:DateOptions' :: Maybe Bool
facetEnabled = Maybe Bool
a} :: DateOptions)
dateOptions_searchEnabled :: Lens.Lens' DateOptions (Prelude.Maybe Prelude.Bool)
dateOptions_searchEnabled :: (Maybe Bool -> f (Maybe Bool)) -> DateOptions -> f DateOptions
dateOptions_searchEnabled = (DateOptions -> Maybe Bool)
-> (DateOptions -> Maybe Bool -> DateOptions)
-> Lens DateOptions DateOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateOptions' {Maybe Bool
searchEnabled :: Maybe Bool
$sel:searchEnabled:DateOptions' :: DateOptions -> Maybe Bool
searchEnabled} -> Maybe Bool
searchEnabled) (\s :: DateOptions
s@DateOptions' {} Maybe Bool
a -> DateOptions
s {$sel:searchEnabled:DateOptions' :: Maybe Bool
searchEnabled = Maybe Bool
a} :: DateOptions)
dateOptions_sortEnabled :: Lens.Lens' DateOptions (Prelude.Maybe Prelude.Bool)
dateOptions_sortEnabled :: (Maybe Bool -> f (Maybe Bool)) -> DateOptions -> f DateOptions
dateOptions_sortEnabled = (DateOptions -> Maybe Bool)
-> (DateOptions -> Maybe Bool -> DateOptions)
-> Lens DateOptions DateOptions (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateOptions' {Maybe Bool
sortEnabled :: Maybe Bool
$sel:sortEnabled:DateOptions' :: DateOptions -> Maybe Bool
sortEnabled} -> Maybe Bool
sortEnabled) (\s :: DateOptions
s@DateOptions' {} Maybe Bool
a -> DateOptions
s {$sel:sortEnabled:DateOptions' :: Maybe Bool
sortEnabled = Maybe Bool
a} :: DateOptions)
dateOptions_defaultValue :: Lens.Lens' DateOptions (Prelude.Maybe Prelude.Text)
dateOptions_defaultValue :: (Maybe Text -> f (Maybe Text)) -> DateOptions -> f DateOptions
dateOptions_defaultValue = (DateOptions -> Maybe Text)
-> (DateOptions -> Maybe Text -> DateOptions)
-> Lens DateOptions DateOptions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateOptions' {Maybe Text
defaultValue :: Maybe Text
$sel:defaultValue:DateOptions' :: DateOptions -> Maybe Text
defaultValue} -> Maybe Text
defaultValue) (\s :: DateOptions
s@DateOptions' {} Maybe Text
a -> DateOptions
s {$sel:defaultValue:DateOptions' :: Maybe Text
defaultValue = Maybe Text
a} :: DateOptions)
instance Core.FromXML DateOptions where
parseXML :: [Node] -> Either String DateOptions
parseXML [Node]
x =
Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> DateOptions
DateOptions'
(Maybe Text
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> DateOptions)
-> Either String (Maybe Text)
-> Either
String
(Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> DateOptions)
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
"SourceField")
Either
String
(Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Bool
-> Maybe Text
-> DateOptions)
-> Either String (Maybe Bool)
-> Either
String
(Maybe Bool
-> Maybe Bool -> Maybe Bool -> Maybe Text -> DateOptions)
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 Bool -> Maybe Text -> DateOptions)
-> Either String (Maybe Bool)
-> Either
String (Maybe Bool -> Maybe Bool -> Maybe Text -> DateOptions)
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 Bool -> Maybe Text -> DateOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Bool -> Maybe Text -> DateOptions)
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 Bool -> Maybe Text -> DateOptions)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> DateOptions)
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
"SortEnabled")
Either String (Maybe Text -> DateOptions)
-> Either String (Maybe Text) -> Either String DateOptions
forall (f :: * -> *) a b. Applicative f => 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
"DefaultValue")
instance Prelude.Hashable DateOptions
instance Prelude.NFData DateOptions
instance Core.ToQuery DateOptions where
toQuery :: DateOptions -> QueryString
toQuery DateOptions' {Maybe Bool
Maybe Text
defaultValue :: Maybe Text
sortEnabled :: Maybe Bool
searchEnabled :: Maybe Bool
facetEnabled :: Maybe Bool
returnEnabled :: Maybe Bool
sourceField :: Maybe Text
$sel:defaultValue:DateOptions' :: DateOptions -> Maybe Text
$sel:sortEnabled:DateOptions' :: DateOptions -> Maybe Bool
$sel:searchEnabled:DateOptions' :: DateOptions -> Maybe Bool
$sel:facetEnabled:DateOptions' :: DateOptions -> Maybe Bool
$sel:returnEnabled:DateOptions' :: DateOptions -> Maybe Bool
$sel:sourceField:DateOptions' :: DateOptions -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"SourceField" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sourceField,
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
"SortEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
sortEnabled,
ByteString
"DefaultValue" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
defaultValue
]