{-# 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.RangeEndsLabelType
-- 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.RangeEndsLabelType 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.Visibility

-- | The range ends label type of a data path label.
--
-- /See:/ 'newRangeEndsLabelType' smart constructor.
data RangeEndsLabelType = RangeEndsLabelType'
  { -- | The visibility of the range ends label.
    RangeEndsLabelType -> Maybe Visibility
visibility :: Prelude.Maybe Visibility
  }
  deriving (RangeEndsLabelType -> RangeEndsLabelType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RangeEndsLabelType -> RangeEndsLabelType -> Bool
$c/= :: RangeEndsLabelType -> RangeEndsLabelType -> Bool
== :: RangeEndsLabelType -> RangeEndsLabelType -> Bool
$c== :: RangeEndsLabelType -> RangeEndsLabelType -> Bool
Prelude.Eq, ReadPrec [RangeEndsLabelType]
ReadPrec RangeEndsLabelType
Int -> ReadS RangeEndsLabelType
ReadS [RangeEndsLabelType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RangeEndsLabelType]
$creadListPrec :: ReadPrec [RangeEndsLabelType]
readPrec :: ReadPrec RangeEndsLabelType
$creadPrec :: ReadPrec RangeEndsLabelType
readList :: ReadS [RangeEndsLabelType]
$creadList :: ReadS [RangeEndsLabelType]
readsPrec :: Int -> ReadS RangeEndsLabelType
$creadsPrec :: Int -> ReadS RangeEndsLabelType
Prelude.Read, Int -> RangeEndsLabelType -> ShowS
[RangeEndsLabelType] -> ShowS
RangeEndsLabelType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RangeEndsLabelType] -> ShowS
$cshowList :: [RangeEndsLabelType] -> ShowS
show :: RangeEndsLabelType -> String
$cshow :: RangeEndsLabelType -> String
showsPrec :: Int -> RangeEndsLabelType -> ShowS
$cshowsPrec :: Int -> RangeEndsLabelType -> ShowS
Prelude.Show, forall x. Rep RangeEndsLabelType x -> RangeEndsLabelType
forall x. RangeEndsLabelType -> Rep RangeEndsLabelType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RangeEndsLabelType x -> RangeEndsLabelType
$cfrom :: forall x. RangeEndsLabelType -> Rep RangeEndsLabelType x
Prelude.Generic)

-- |
-- Create a value of 'RangeEndsLabelType' 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:
--
-- 'visibility', 'rangeEndsLabelType_visibility' - The visibility of the range ends label.
newRangeEndsLabelType ::
  RangeEndsLabelType
newRangeEndsLabelType :: RangeEndsLabelType
newRangeEndsLabelType =
  RangeEndsLabelType' {$sel:visibility:RangeEndsLabelType' :: Maybe Visibility
visibility = forall a. Maybe a
Prelude.Nothing}

-- | The visibility of the range ends label.
rangeEndsLabelType_visibility :: Lens.Lens' RangeEndsLabelType (Prelude.Maybe Visibility)
rangeEndsLabelType_visibility :: Lens' RangeEndsLabelType (Maybe Visibility)
rangeEndsLabelType_visibility = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RangeEndsLabelType' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:RangeEndsLabelType' :: RangeEndsLabelType -> Maybe Visibility
visibility} -> Maybe Visibility
visibility) (\s :: RangeEndsLabelType
s@RangeEndsLabelType' {} Maybe Visibility
a -> RangeEndsLabelType
s {$sel:visibility:RangeEndsLabelType' :: Maybe Visibility
visibility = Maybe Visibility
a} :: RangeEndsLabelType)

instance Data.FromJSON RangeEndsLabelType where
  parseJSON :: Value -> Parser RangeEndsLabelType
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RangeEndsLabelType"
      ( \Object
x ->
          Maybe Visibility -> RangeEndsLabelType
RangeEndsLabelType'
            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
"Visibility")
      )

instance Prelude.Hashable RangeEndsLabelType where
  hashWithSalt :: Int -> RangeEndsLabelType -> Int
hashWithSalt Int
_salt RangeEndsLabelType' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:RangeEndsLabelType' :: RangeEndsLabelType -> Maybe Visibility
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Visibility
visibility

instance Prelude.NFData RangeEndsLabelType where
  rnf :: RangeEndsLabelType -> ()
rnf RangeEndsLabelType' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:RangeEndsLabelType' :: RangeEndsLabelType -> Maybe Visibility
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Visibility
visibility

instance Data.ToJSON RangeEndsLabelType where
  toJSON :: RangeEndsLabelType -> Value
toJSON RangeEndsLabelType' {Maybe Visibility
visibility :: Maybe Visibility
$sel:visibility:RangeEndsLabelType' :: RangeEndsLabelType -> Maybe Visibility
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"Visibility" 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 Visibility
visibility]
      )