{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MechanicalTurk.DisassociateQualificationFromWorker
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- The @DisassociateQualificationFromWorker@ revokes a previously granted
-- Qualification from a user.
--
-- You can provide a text message explaining why the Qualification was
-- revoked. The user who had the Qualification can see this message.
module Amazonka.MechanicalTurk.DisassociateQualificationFromWorker
  ( -- * Creating a Request
    DisassociateQualificationFromWorker (..),
    newDisassociateQualificationFromWorker,

    -- * Request Lenses
    disassociateQualificationFromWorker_reason,
    disassociateQualificationFromWorker_workerId,
    disassociateQualificationFromWorker_qualificationTypeId,

    -- * Destructuring the Response
    DisassociateQualificationFromWorkerResponse (..),
    newDisassociateQualificationFromWorkerResponse,

    -- * Response Lenses
    disassociateQualificationFromWorkerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MechanicalTurk.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDisassociateQualificationFromWorker' smart constructor.
data DisassociateQualificationFromWorker = DisassociateQualificationFromWorker'
  { -- | A text message that explains why the Qualification was revoked. The user
    -- who had the Qualification sees this message.
    DisassociateQualificationFromWorker -> Maybe Text
reason :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Worker who possesses the Qualification to be revoked.
    DisassociateQualificationFromWorker -> Text
workerId :: Prelude.Text,
    -- | The ID of the Qualification type of the Qualification to be revoked.
    DisassociateQualificationFromWorker -> Text
qualificationTypeId :: Prelude.Text
  }
  deriving (DisassociateQualificationFromWorker
-> DisassociateQualificationFromWorker -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateQualificationFromWorker
-> DisassociateQualificationFromWorker -> Bool
$c/= :: DisassociateQualificationFromWorker
-> DisassociateQualificationFromWorker -> Bool
== :: DisassociateQualificationFromWorker
-> DisassociateQualificationFromWorker -> Bool
$c== :: DisassociateQualificationFromWorker
-> DisassociateQualificationFromWorker -> Bool
Prelude.Eq, ReadPrec [DisassociateQualificationFromWorker]
ReadPrec DisassociateQualificationFromWorker
Int -> ReadS DisassociateQualificationFromWorker
ReadS [DisassociateQualificationFromWorker]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateQualificationFromWorker]
$creadListPrec :: ReadPrec [DisassociateQualificationFromWorker]
readPrec :: ReadPrec DisassociateQualificationFromWorker
$creadPrec :: ReadPrec DisassociateQualificationFromWorker
readList :: ReadS [DisassociateQualificationFromWorker]
$creadList :: ReadS [DisassociateQualificationFromWorker]
readsPrec :: Int -> ReadS DisassociateQualificationFromWorker
$creadsPrec :: Int -> ReadS DisassociateQualificationFromWorker
Prelude.Read, Int -> DisassociateQualificationFromWorker -> ShowS
[DisassociateQualificationFromWorker] -> ShowS
DisassociateQualificationFromWorker -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateQualificationFromWorker] -> ShowS
$cshowList :: [DisassociateQualificationFromWorker] -> ShowS
show :: DisassociateQualificationFromWorker -> String
$cshow :: DisassociateQualificationFromWorker -> String
showsPrec :: Int -> DisassociateQualificationFromWorker -> ShowS
$cshowsPrec :: Int -> DisassociateQualificationFromWorker -> ShowS
Prelude.Show, forall x.
Rep DisassociateQualificationFromWorker x
-> DisassociateQualificationFromWorker
forall x.
DisassociateQualificationFromWorker
-> Rep DisassociateQualificationFromWorker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateQualificationFromWorker x
-> DisassociateQualificationFromWorker
$cfrom :: forall x.
DisassociateQualificationFromWorker
-> Rep DisassociateQualificationFromWorker x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateQualificationFromWorker' 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:
--
-- 'reason', 'disassociateQualificationFromWorker_reason' - A text message that explains why the Qualification was revoked. The user
-- who had the Qualification sees this message.
--
-- 'workerId', 'disassociateQualificationFromWorker_workerId' - The ID of the Worker who possesses the Qualification to be revoked.
--
-- 'qualificationTypeId', 'disassociateQualificationFromWorker_qualificationTypeId' - The ID of the Qualification type of the Qualification to be revoked.
newDisassociateQualificationFromWorker ::
  -- | 'workerId'
  Prelude.Text ->
  -- | 'qualificationTypeId'
  Prelude.Text ->
  DisassociateQualificationFromWorker
newDisassociateQualificationFromWorker :: Text -> Text -> DisassociateQualificationFromWorker
newDisassociateQualificationFromWorker
  Text
pWorkerId_
  Text
pQualificationTypeId_ =
    DisassociateQualificationFromWorker'
      { $sel:reason:DisassociateQualificationFromWorker' :: Maybe Text
reason =
          forall a. Maybe a
Prelude.Nothing,
        $sel:workerId:DisassociateQualificationFromWorker' :: Text
workerId = Text
pWorkerId_,
        $sel:qualificationTypeId:DisassociateQualificationFromWorker' :: Text
qualificationTypeId =
          Text
pQualificationTypeId_
      }

-- | A text message that explains why the Qualification was revoked. The user
-- who had the Qualification sees this message.
disassociateQualificationFromWorker_reason :: Lens.Lens' DisassociateQualificationFromWorker (Prelude.Maybe Prelude.Text)
disassociateQualificationFromWorker_reason :: Lens' DisassociateQualificationFromWorker (Maybe Text)
disassociateQualificationFromWorker_reason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateQualificationFromWorker' {Maybe Text
reason :: Maybe Text
$sel:reason:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Maybe Text
reason} -> Maybe Text
reason) (\s :: DisassociateQualificationFromWorker
s@DisassociateQualificationFromWorker' {} Maybe Text
a -> DisassociateQualificationFromWorker
s {$sel:reason:DisassociateQualificationFromWorker' :: Maybe Text
reason = Maybe Text
a} :: DisassociateQualificationFromWorker)

-- | The ID of the Worker who possesses the Qualification to be revoked.
disassociateQualificationFromWorker_workerId :: Lens.Lens' DisassociateQualificationFromWorker Prelude.Text
disassociateQualificationFromWorker_workerId :: Lens' DisassociateQualificationFromWorker Text
disassociateQualificationFromWorker_workerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateQualificationFromWorker' {Text
workerId :: Text
$sel:workerId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
workerId} -> Text
workerId) (\s :: DisassociateQualificationFromWorker
s@DisassociateQualificationFromWorker' {} Text
a -> DisassociateQualificationFromWorker
s {$sel:workerId:DisassociateQualificationFromWorker' :: Text
workerId = Text
a} :: DisassociateQualificationFromWorker)

-- | The ID of the Qualification type of the Qualification to be revoked.
disassociateQualificationFromWorker_qualificationTypeId :: Lens.Lens' DisassociateQualificationFromWorker Prelude.Text
disassociateQualificationFromWorker_qualificationTypeId :: Lens' DisassociateQualificationFromWorker Text
disassociateQualificationFromWorker_qualificationTypeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateQualificationFromWorker' {Text
qualificationTypeId :: Text
$sel:qualificationTypeId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
qualificationTypeId} -> Text
qualificationTypeId) (\s :: DisassociateQualificationFromWorker
s@DisassociateQualificationFromWorker' {} Text
a -> DisassociateQualificationFromWorker
s {$sel:qualificationTypeId:DisassociateQualificationFromWorker' :: Text
qualificationTypeId = Text
a} :: DisassociateQualificationFromWorker)

instance
  Core.AWSRequest
    DisassociateQualificationFromWorker
  where
  type
    AWSResponse DisassociateQualificationFromWorker =
      DisassociateQualificationFromWorkerResponse
  request :: (Service -> Service)
-> DisassociateQualificationFromWorker
-> Request DisassociateQualificationFromWorker
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisassociateQualificationFromWorker
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisassociateQualificationFromWorker)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisassociateQualificationFromWorkerResponse
DisassociateQualificationFromWorkerResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DisassociateQualificationFromWorker
  where
  hashWithSalt :: Int -> DisassociateQualificationFromWorker -> Int
hashWithSalt
    Int
_salt
    DisassociateQualificationFromWorker' {Maybe Text
Text
qualificationTypeId :: Text
workerId :: Text
reason :: Maybe Text
$sel:qualificationTypeId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
$sel:workerId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
$sel:reason:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Maybe Text
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reason
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workerId
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
qualificationTypeId

instance
  Prelude.NFData
    DisassociateQualificationFromWorker
  where
  rnf :: DisassociateQualificationFromWorker -> ()
rnf DisassociateQualificationFromWorker' {Maybe Text
Text
qualificationTypeId :: Text
workerId :: Text
reason :: Maybe Text
$sel:qualificationTypeId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
$sel:workerId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
$sel:reason:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
reason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
qualificationTypeId

instance
  Data.ToHeaders
    DisassociateQualificationFromWorker
  where
  toHeaders :: DisassociateQualificationFromWorker -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"MTurkRequesterServiceV20170117.DisassociateQualificationFromWorker" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance
  Data.ToJSON
    DisassociateQualificationFromWorker
  where
  toJSON :: DisassociateQualificationFromWorker -> Value
toJSON DisassociateQualificationFromWorker' {Maybe Text
Text
qualificationTypeId :: Text
workerId :: Text
reason :: Maybe Text
$sel:qualificationTypeId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
$sel:workerId:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Text
$sel:reason:DisassociateQualificationFromWorker' :: DisassociateQualificationFromWorker -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Reason" 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
reason,
            forall a. a -> Maybe a
Prelude.Just (Key
"WorkerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workerId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"QualificationTypeId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
qualificationTypeId)
          ]
      )

instance
  Data.ToPath
    DisassociateQualificationFromWorker
  where
  toPath :: DisassociateQualificationFromWorker -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Data.ToQuery
    DisassociateQualificationFromWorker
  where
  toQuery :: DisassociateQualificationFromWorker -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDisassociateQualificationFromWorkerResponse' smart constructor.
data DisassociateQualificationFromWorkerResponse = DisassociateQualificationFromWorkerResponse'
  { -- | The response's http status code.
    DisassociateQualificationFromWorkerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DisassociateQualificationFromWorkerResponse
-> DisassociateQualificationFromWorkerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisassociateQualificationFromWorkerResponse
-> DisassociateQualificationFromWorkerResponse -> Bool
$c/= :: DisassociateQualificationFromWorkerResponse
-> DisassociateQualificationFromWorkerResponse -> Bool
== :: DisassociateQualificationFromWorkerResponse
-> DisassociateQualificationFromWorkerResponse -> Bool
$c== :: DisassociateQualificationFromWorkerResponse
-> DisassociateQualificationFromWorkerResponse -> Bool
Prelude.Eq, ReadPrec [DisassociateQualificationFromWorkerResponse]
ReadPrec DisassociateQualificationFromWorkerResponse
Int -> ReadS DisassociateQualificationFromWorkerResponse
ReadS [DisassociateQualificationFromWorkerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisassociateQualificationFromWorkerResponse]
$creadListPrec :: ReadPrec [DisassociateQualificationFromWorkerResponse]
readPrec :: ReadPrec DisassociateQualificationFromWorkerResponse
$creadPrec :: ReadPrec DisassociateQualificationFromWorkerResponse
readList :: ReadS [DisassociateQualificationFromWorkerResponse]
$creadList :: ReadS [DisassociateQualificationFromWorkerResponse]
readsPrec :: Int -> ReadS DisassociateQualificationFromWorkerResponse
$creadsPrec :: Int -> ReadS DisassociateQualificationFromWorkerResponse
Prelude.Read, Int -> DisassociateQualificationFromWorkerResponse -> ShowS
[DisassociateQualificationFromWorkerResponse] -> ShowS
DisassociateQualificationFromWorkerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisassociateQualificationFromWorkerResponse] -> ShowS
$cshowList :: [DisassociateQualificationFromWorkerResponse] -> ShowS
show :: DisassociateQualificationFromWorkerResponse -> String
$cshow :: DisassociateQualificationFromWorkerResponse -> String
showsPrec :: Int -> DisassociateQualificationFromWorkerResponse -> ShowS
$cshowsPrec :: Int -> DisassociateQualificationFromWorkerResponse -> ShowS
Prelude.Show, forall x.
Rep DisassociateQualificationFromWorkerResponse x
-> DisassociateQualificationFromWorkerResponse
forall x.
DisassociateQualificationFromWorkerResponse
-> Rep DisassociateQualificationFromWorkerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisassociateQualificationFromWorkerResponse x
-> DisassociateQualificationFromWorkerResponse
$cfrom :: forall x.
DisassociateQualificationFromWorkerResponse
-> Rep DisassociateQualificationFromWorkerResponse x
Prelude.Generic)

-- |
-- Create a value of 'DisassociateQualificationFromWorkerResponse' 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:
--
-- 'httpStatus', 'disassociateQualificationFromWorkerResponse_httpStatus' - The response's http status code.
newDisassociateQualificationFromWorkerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisassociateQualificationFromWorkerResponse
newDisassociateQualificationFromWorkerResponse :: Int -> DisassociateQualificationFromWorkerResponse
newDisassociateQualificationFromWorkerResponse
  Int
pHttpStatus_ =
    DisassociateQualificationFromWorkerResponse'
      { $sel:httpStatus:DisassociateQualificationFromWorkerResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

-- | The response's http status code.
disassociateQualificationFromWorkerResponse_httpStatus :: Lens.Lens' DisassociateQualificationFromWorkerResponse Prelude.Int
disassociateQualificationFromWorkerResponse_httpStatus :: Lens' DisassociateQualificationFromWorkerResponse Int
disassociateQualificationFromWorkerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisassociateQualificationFromWorkerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateQualificationFromWorkerResponse' :: DisassociateQualificationFromWorkerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisassociateQualificationFromWorkerResponse
s@DisassociateQualificationFromWorkerResponse' {} Int
a -> DisassociateQualificationFromWorkerResponse
s {$sel:httpStatus:DisassociateQualificationFromWorkerResponse' :: Int
httpStatus = Int
a} :: DisassociateQualificationFromWorkerResponse)

instance
  Prelude.NFData
    DisassociateQualificationFromWorkerResponse
  where
  rnf :: DisassociateQualificationFromWorkerResponse -> ()
rnf DisassociateQualificationFromWorkerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisassociateQualificationFromWorkerResponse' :: DisassociateQualificationFromWorkerResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus