{-# 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.WorkUnitRange
-- 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.WorkUnitRange 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

-- | Defines the valid range of work unit IDs for querying the execution
-- service.
--
-- /See:/ 'newWorkUnitRange' smart constructor.
data WorkUnitRange = WorkUnitRange'
  { -- | Defines the maximum work unit ID in the range. The maximum value is
    -- inclusive.
    WorkUnitRange -> Integer
workUnitIdMax :: Prelude.Integer,
    -- | Defines the minimum work unit ID in the range.
    WorkUnitRange -> Integer
workUnitIdMin :: Prelude.Integer,
    -- | A work token used to query the execution service.
    WorkUnitRange -> Text
workUnitToken :: Prelude.Text
  }
  deriving (WorkUnitRange -> WorkUnitRange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkUnitRange -> WorkUnitRange -> Bool
$c/= :: WorkUnitRange -> WorkUnitRange -> Bool
== :: WorkUnitRange -> WorkUnitRange -> Bool
$c== :: WorkUnitRange -> WorkUnitRange -> Bool
Prelude.Eq, ReadPrec [WorkUnitRange]
ReadPrec WorkUnitRange
Int -> ReadS WorkUnitRange
ReadS [WorkUnitRange]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkUnitRange]
$creadListPrec :: ReadPrec [WorkUnitRange]
readPrec :: ReadPrec WorkUnitRange
$creadPrec :: ReadPrec WorkUnitRange
readList :: ReadS [WorkUnitRange]
$creadList :: ReadS [WorkUnitRange]
readsPrec :: Int -> ReadS WorkUnitRange
$creadsPrec :: Int -> ReadS WorkUnitRange
Prelude.Read, Int -> WorkUnitRange -> ShowS
[WorkUnitRange] -> ShowS
WorkUnitRange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkUnitRange] -> ShowS
$cshowList :: [WorkUnitRange] -> ShowS
show :: WorkUnitRange -> String
$cshow :: WorkUnitRange -> String
showsPrec :: Int -> WorkUnitRange -> ShowS
$cshowsPrec :: Int -> WorkUnitRange -> ShowS
Prelude.Show, forall x. Rep WorkUnitRange x -> WorkUnitRange
forall x. WorkUnitRange -> Rep WorkUnitRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkUnitRange x -> WorkUnitRange
$cfrom :: forall x. WorkUnitRange -> Rep WorkUnitRange x
Prelude.Generic)

-- |
-- Create a value of 'WorkUnitRange' 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:
--
-- 'workUnitIdMax', 'workUnitRange_workUnitIdMax' - Defines the maximum work unit ID in the range. The maximum value is
-- inclusive.
--
-- 'workUnitIdMin', 'workUnitRange_workUnitIdMin' - Defines the minimum work unit ID in the range.
--
-- 'workUnitToken', 'workUnitRange_workUnitToken' - A work token used to query the execution service.
newWorkUnitRange ::
  -- | 'workUnitIdMax'
  Prelude.Integer ->
  -- | 'workUnitIdMin'
  Prelude.Integer ->
  -- | 'workUnitToken'
  Prelude.Text ->
  WorkUnitRange
newWorkUnitRange :: Integer -> Integer -> Text -> WorkUnitRange
newWorkUnitRange
  Integer
pWorkUnitIdMax_
  Integer
pWorkUnitIdMin_
  Text
pWorkUnitToken_ =
    WorkUnitRange'
      { $sel:workUnitIdMax:WorkUnitRange' :: Integer
workUnitIdMax = Integer
pWorkUnitIdMax_,
        $sel:workUnitIdMin:WorkUnitRange' :: Integer
workUnitIdMin = Integer
pWorkUnitIdMin_,
        $sel:workUnitToken:WorkUnitRange' :: Text
workUnitToken = Text
pWorkUnitToken_
      }

-- | Defines the maximum work unit ID in the range. The maximum value is
-- inclusive.
workUnitRange_workUnitIdMax :: Lens.Lens' WorkUnitRange Prelude.Integer
workUnitRange_workUnitIdMax :: Lens' WorkUnitRange Integer
workUnitRange_workUnitIdMax = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkUnitRange' {Integer
workUnitIdMax :: Integer
$sel:workUnitIdMax:WorkUnitRange' :: WorkUnitRange -> Integer
workUnitIdMax} -> Integer
workUnitIdMax) (\s :: WorkUnitRange
s@WorkUnitRange' {} Integer
a -> WorkUnitRange
s {$sel:workUnitIdMax:WorkUnitRange' :: Integer
workUnitIdMax = Integer
a} :: WorkUnitRange)

-- | Defines the minimum work unit ID in the range.
workUnitRange_workUnitIdMin :: Lens.Lens' WorkUnitRange Prelude.Integer
workUnitRange_workUnitIdMin :: Lens' WorkUnitRange Integer
workUnitRange_workUnitIdMin = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkUnitRange' {Integer
workUnitIdMin :: Integer
$sel:workUnitIdMin:WorkUnitRange' :: WorkUnitRange -> Integer
workUnitIdMin} -> Integer
workUnitIdMin) (\s :: WorkUnitRange
s@WorkUnitRange' {} Integer
a -> WorkUnitRange
s {$sel:workUnitIdMin:WorkUnitRange' :: Integer
workUnitIdMin = Integer
a} :: WorkUnitRange)

-- | A work token used to query the execution service.
workUnitRange_workUnitToken :: Lens.Lens' WorkUnitRange Prelude.Text
workUnitRange_workUnitToken :: Lens' WorkUnitRange Text
workUnitRange_workUnitToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkUnitRange' {Text
workUnitToken :: Text
$sel:workUnitToken:WorkUnitRange' :: WorkUnitRange -> Text
workUnitToken} -> Text
workUnitToken) (\s :: WorkUnitRange
s@WorkUnitRange' {} Text
a -> WorkUnitRange
s {$sel:workUnitToken:WorkUnitRange' :: Text
workUnitToken = Text
a} :: WorkUnitRange)

instance Data.FromJSON WorkUnitRange where
  parseJSON :: Value -> Parser WorkUnitRange
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkUnitRange"
      ( \Object
x ->
          Integer -> Integer -> Text -> WorkUnitRange
WorkUnitRange'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"WorkUnitIdMax")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"WorkUnitIdMin")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"WorkUnitToken")
      )

instance Prelude.Hashable WorkUnitRange where
  hashWithSalt :: Int -> WorkUnitRange -> Int
hashWithSalt Int
_salt WorkUnitRange' {Integer
Text
workUnitToken :: Text
workUnitIdMin :: Integer
workUnitIdMax :: Integer
$sel:workUnitToken:WorkUnitRange' :: WorkUnitRange -> Text
$sel:workUnitIdMin:WorkUnitRange' :: WorkUnitRange -> Integer
$sel:workUnitIdMax:WorkUnitRange' :: WorkUnitRange -> Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
workUnitIdMax
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
workUnitIdMin
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workUnitToken

instance Prelude.NFData WorkUnitRange where
  rnf :: WorkUnitRange -> ()
rnf WorkUnitRange' {Integer
Text
workUnitToken :: Text
workUnitIdMin :: Integer
workUnitIdMax :: Integer
$sel:workUnitToken:WorkUnitRange' :: WorkUnitRange -> Text
$sel:workUnitIdMin:WorkUnitRange' :: WorkUnitRange -> Integer
$sel:workUnitIdMax:WorkUnitRange' :: WorkUnitRange -> Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Integer
workUnitIdMax
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Integer
workUnitIdMin
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workUnitToken