{-# 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.QuickSight.Types.DateTimePickerControlDisplayOptions
-- 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.QuickSight.Types.DateTimePickerControlDisplayOptions where

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
import Amazonka.QuickSight.Types.LabelOptions

-- | The display options of a control.
--
-- /See:/ 'newDateTimePickerControlDisplayOptions' smart constructor.
data DateTimePickerControlDisplayOptions = DateTimePickerControlDisplayOptions'
  { -- | Customize how dates are formatted in controls.
    DateTimePickerControlDisplayOptions -> Maybe Text
dateTimeFormat :: Prelude.Maybe Prelude.Text,
    -- | The options to configure the title visibility, name, and font size.
    DateTimePickerControlDisplayOptions -> Maybe LabelOptions
titleOptions :: Prelude.Maybe LabelOptions
  }
  deriving (DateTimePickerControlDisplayOptions
-> DateTimePickerControlDisplayOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DateTimePickerControlDisplayOptions
-> DateTimePickerControlDisplayOptions -> Bool
$c/= :: DateTimePickerControlDisplayOptions
-> DateTimePickerControlDisplayOptions -> Bool
== :: DateTimePickerControlDisplayOptions
-> DateTimePickerControlDisplayOptions -> Bool
$c== :: DateTimePickerControlDisplayOptions
-> DateTimePickerControlDisplayOptions -> Bool
Prelude.Eq, ReadPrec [DateTimePickerControlDisplayOptions]
ReadPrec DateTimePickerControlDisplayOptions
Int -> ReadS DateTimePickerControlDisplayOptions
ReadS [DateTimePickerControlDisplayOptions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DateTimePickerControlDisplayOptions]
$creadListPrec :: ReadPrec [DateTimePickerControlDisplayOptions]
readPrec :: ReadPrec DateTimePickerControlDisplayOptions
$creadPrec :: ReadPrec DateTimePickerControlDisplayOptions
readList :: ReadS [DateTimePickerControlDisplayOptions]
$creadList :: ReadS [DateTimePickerControlDisplayOptions]
readsPrec :: Int -> ReadS DateTimePickerControlDisplayOptions
$creadsPrec :: Int -> ReadS DateTimePickerControlDisplayOptions
Prelude.Read, Int -> DateTimePickerControlDisplayOptions -> ShowS
[DateTimePickerControlDisplayOptions] -> ShowS
DateTimePickerControlDisplayOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DateTimePickerControlDisplayOptions] -> ShowS
$cshowList :: [DateTimePickerControlDisplayOptions] -> ShowS
show :: DateTimePickerControlDisplayOptions -> String
$cshow :: DateTimePickerControlDisplayOptions -> String
showsPrec :: Int -> DateTimePickerControlDisplayOptions -> ShowS
$cshowsPrec :: Int -> DateTimePickerControlDisplayOptions -> ShowS
Prelude.Show, forall x.
Rep DateTimePickerControlDisplayOptions x
-> DateTimePickerControlDisplayOptions
forall x.
DateTimePickerControlDisplayOptions
-> Rep DateTimePickerControlDisplayOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DateTimePickerControlDisplayOptions x
-> DateTimePickerControlDisplayOptions
$cfrom :: forall x.
DateTimePickerControlDisplayOptions
-> Rep DateTimePickerControlDisplayOptions x
Prelude.Generic)

-- |
-- Create a value of 'DateTimePickerControlDisplayOptions' 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:
--
-- 'dateTimeFormat', 'dateTimePickerControlDisplayOptions_dateTimeFormat' - Customize how dates are formatted in controls.
--
-- 'titleOptions', 'dateTimePickerControlDisplayOptions_titleOptions' - The options to configure the title visibility, name, and font size.
newDateTimePickerControlDisplayOptions ::
  DateTimePickerControlDisplayOptions
newDateTimePickerControlDisplayOptions :: DateTimePickerControlDisplayOptions
newDateTimePickerControlDisplayOptions =
  DateTimePickerControlDisplayOptions'
    { $sel:dateTimeFormat:DateTimePickerControlDisplayOptions' :: Maybe Text
dateTimeFormat =
        forall a. Maybe a
Prelude.Nothing,
      $sel:titleOptions:DateTimePickerControlDisplayOptions' :: Maybe LabelOptions
titleOptions = forall a. Maybe a
Prelude.Nothing
    }

-- | Customize how dates are formatted in controls.
dateTimePickerControlDisplayOptions_dateTimeFormat :: Lens.Lens' DateTimePickerControlDisplayOptions (Prelude.Maybe Prelude.Text)
dateTimePickerControlDisplayOptions_dateTimeFormat :: Lens' DateTimePickerControlDisplayOptions (Maybe Text)
dateTimePickerControlDisplayOptions_dateTimeFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateTimePickerControlDisplayOptions' {Maybe Text
dateTimeFormat :: Maybe Text
$sel:dateTimeFormat:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe Text
dateTimeFormat} -> Maybe Text
dateTimeFormat) (\s :: DateTimePickerControlDisplayOptions
s@DateTimePickerControlDisplayOptions' {} Maybe Text
a -> DateTimePickerControlDisplayOptions
s {$sel:dateTimeFormat:DateTimePickerControlDisplayOptions' :: Maybe Text
dateTimeFormat = Maybe Text
a} :: DateTimePickerControlDisplayOptions)

-- | The options to configure the title visibility, name, and font size.
dateTimePickerControlDisplayOptions_titleOptions :: Lens.Lens' DateTimePickerControlDisplayOptions (Prelude.Maybe LabelOptions)
dateTimePickerControlDisplayOptions_titleOptions :: Lens' DateTimePickerControlDisplayOptions (Maybe LabelOptions)
dateTimePickerControlDisplayOptions_titleOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DateTimePickerControlDisplayOptions' {Maybe LabelOptions
titleOptions :: Maybe LabelOptions
$sel:titleOptions:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe LabelOptions
titleOptions} -> Maybe LabelOptions
titleOptions) (\s :: DateTimePickerControlDisplayOptions
s@DateTimePickerControlDisplayOptions' {} Maybe LabelOptions
a -> DateTimePickerControlDisplayOptions
s {$sel:titleOptions:DateTimePickerControlDisplayOptions' :: Maybe LabelOptions
titleOptions = Maybe LabelOptions
a} :: DateTimePickerControlDisplayOptions)

instance
  Data.FromJSON
    DateTimePickerControlDisplayOptions
  where
  parseJSON :: Value -> Parser DateTimePickerControlDisplayOptions
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DateTimePickerControlDisplayOptions"
      ( \Object
x ->
          Maybe Text
-> Maybe LabelOptions -> DateTimePickerControlDisplayOptions
DateTimePickerControlDisplayOptions'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DateTimeFormat")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TitleOptions")
      )

instance
  Prelude.Hashable
    DateTimePickerControlDisplayOptions
  where
  hashWithSalt :: Int -> DateTimePickerControlDisplayOptions -> Int
hashWithSalt
    Int
_salt
    DateTimePickerControlDisplayOptions' {Maybe Text
Maybe LabelOptions
titleOptions :: Maybe LabelOptions
dateTimeFormat :: Maybe Text
$sel:titleOptions:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe LabelOptions
$sel:dateTimeFormat:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
dateTimeFormat
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe LabelOptions
titleOptions

instance
  Prelude.NFData
    DateTimePickerControlDisplayOptions
  where
  rnf :: DateTimePickerControlDisplayOptions -> ()
rnf DateTimePickerControlDisplayOptions' {Maybe Text
Maybe LabelOptions
titleOptions :: Maybe LabelOptions
dateTimeFormat :: Maybe Text
$sel:titleOptions:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe LabelOptions
$sel:dateTimeFormat:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
dateTimeFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe LabelOptions
titleOptions

instance
  Data.ToJSON
    DateTimePickerControlDisplayOptions
  where
  toJSON :: DateTimePickerControlDisplayOptions -> Value
toJSON DateTimePickerControlDisplayOptions' {Maybe Text
Maybe LabelOptions
titleOptions :: Maybe LabelOptions
dateTimeFormat :: Maybe Text
$sel:titleOptions:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe LabelOptions
$sel:dateTimeFormat:DateTimePickerControlDisplayOptions' :: DateTimePickerControlDisplayOptions -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"DateTimeFormat" 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 Text
dateTimeFormat,
            (Key
"TitleOptions" 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 LabelOptions
titleOptions
          ]
      )