{-# 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.LakeFormation.Types.PartitionValueList
-- 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.LakeFormation.Types.PartitionValueList 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

-- | Contains a list of values defining partitions.
--
-- /See:/ 'newPartitionValueList' smart constructor.
data PartitionValueList = PartitionValueList'
  { -- | The list of partition values.
    PartitionValueList -> NonEmpty Text
values :: Prelude.NonEmpty Prelude.Text
  }
  deriving (PartitionValueList -> PartitionValueList -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartitionValueList -> PartitionValueList -> Bool
$c/= :: PartitionValueList -> PartitionValueList -> Bool
== :: PartitionValueList -> PartitionValueList -> Bool
$c== :: PartitionValueList -> PartitionValueList -> Bool
Prelude.Eq, ReadPrec [PartitionValueList]
ReadPrec PartitionValueList
Int -> ReadS PartitionValueList
ReadS [PartitionValueList]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PartitionValueList]
$creadListPrec :: ReadPrec [PartitionValueList]
readPrec :: ReadPrec PartitionValueList
$creadPrec :: ReadPrec PartitionValueList
readList :: ReadS [PartitionValueList]
$creadList :: ReadS [PartitionValueList]
readsPrec :: Int -> ReadS PartitionValueList
$creadsPrec :: Int -> ReadS PartitionValueList
Prelude.Read, Int -> PartitionValueList -> ShowS
[PartitionValueList] -> ShowS
PartitionValueList -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartitionValueList] -> ShowS
$cshowList :: [PartitionValueList] -> ShowS
show :: PartitionValueList -> String
$cshow :: PartitionValueList -> String
showsPrec :: Int -> PartitionValueList -> ShowS
$cshowsPrec :: Int -> PartitionValueList -> ShowS
Prelude.Show, forall x. Rep PartitionValueList x -> PartitionValueList
forall x. PartitionValueList -> Rep PartitionValueList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PartitionValueList x -> PartitionValueList
$cfrom :: forall x. PartitionValueList -> Rep PartitionValueList x
Prelude.Generic)

-- |
-- Create a value of 'PartitionValueList' 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:
--
-- 'values', 'partitionValueList_values' - The list of partition values.
newPartitionValueList ::
  -- | 'values'
  Prelude.NonEmpty Prelude.Text ->
  PartitionValueList
newPartitionValueList :: NonEmpty Text -> PartitionValueList
newPartitionValueList NonEmpty Text
pValues_ =
  PartitionValueList'
    { $sel:values:PartitionValueList' :: NonEmpty Text
values =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pValues_
    }

-- | The list of partition values.
partitionValueList_values :: Lens.Lens' PartitionValueList (Prelude.NonEmpty Prelude.Text)
partitionValueList_values :: Lens' PartitionValueList (NonEmpty Text)
partitionValueList_values = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PartitionValueList' {NonEmpty Text
values :: NonEmpty Text
$sel:values:PartitionValueList' :: PartitionValueList -> NonEmpty Text
values} -> NonEmpty Text
values) (\s :: PartitionValueList
s@PartitionValueList' {} NonEmpty Text
a -> PartitionValueList
s {$sel:values:PartitionValueList' :: NonEmpty Text
values = NonEmpty Text
a} :: PartitionValueList) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable PartitionValueList where
  hashWithSalt :: Int -> PartitionValueList -> Int
hashWithSalt Int
_salt PartitionValueList' {NonEmpty Text
values :: NonEmpty Text
$sel:values:PartitionValueList' :: PartitionValueList -> NonEmpty Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
values

instance Prelude.NFData PartitionValueList where
  rnf :: PartitionValueList -> ()
rnf PartitionValueList' {NonEmpty Text
values :: NonEmpty Text
$sel:values:PartitionValueList' :: PartitionValueList -> NonEmpty Text
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
values

instance Data.ToJSON PartitionValueList where
  toJSON :: PartitionValueList -> Value
toJSON PartitionValueList' {NonEmpty Text
values :: NonEmpty Text
$sel:values:PartitionValueList' :: PartitionValueList -> NonEmpty Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Values" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
values)]
      )