{-# 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.Connect.DescribeHoursOfOperation
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the hours of operation.
module Amazonka.Connect.DescribeHoursOfOperation
  ( -- * Creating a Request
    DescribeHoursOfOperation (..),
    newDescribeHoursOfOperation,

    -- * Request Lenses
    describeHoursOfOperation_instanceId,
    describeHoursOfOperation_hoursOfOperationId,

    -- * Destructuring the Response
    DescribeHoursOfOperationResponse (..),
    newDescribeHoursOfOperationResponse,

    -- * Response Lenses
    describeHoursOfOperationResponse_hoursOfOperation,
    describeHoursOfOperationResponse_httpStatus,
  )
where

import Amazonka.Connect.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeHoursOfOperation' smart constructor.
data DescribeHoursOfOperation = DescribeHoursOfOperation'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    DescribeHoursOfOperation -> Text
instanceId :: Prelude.Text,
    -- | The identifier for the hours of operation.
    DescribeHoursOfOperation -> Text
hoursOfOperationId :: Prelude.Text
  }
  deriving (DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool
(DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool)
-> (DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool)
-> Eq DescribeHoursOfOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool
$c/= :: DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool
== :: DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool
$c== :: DescribeHoursOfOperation -> DescribeHoursOfOperation -> Bool
Prelude.Eq, ReadPrec [DescribeHoursOfOperation]
ReadPrec DescribeHoursOfOperation
Int -> ReadS DescribeHoursOfOperation
ReadS [DescribeHoursOfOperation]
(Int -> ReadS DescribeHoursOfOperation)
-> ReadS [DescribeHoursOfOperation]
-> ReadPrec DescribeHoursOfOperation
-> ReadPrec [DescribeHoursOfOperation]
-> Read DescribeHoursOfOperation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeHoursOfOperation]
$creadListPrec :: ReadPrec [DescribeHoursOfOperation]
readPrec :: ReadPrec DescribeHoursOfOperation
$creadPrec :: ReadPrec DescribeHoursOfOperation
readList :: ReadS [DescribeHoursOfOperation]
$creadList :: ReadS [DescribeHoursOfOperation]
readsPrec :: Int -> ReadS DescribeHoursOfOperation
$creadsPrec :: Int -> ReadS DescribeHoursOfOperation
Prelude.Read, Int -> DescribeHoursOfOperation -> ShowS
[DescribeHoursOfOperation] -> ShowS
DescribeHoursOfOperation -> String
(Int -> DescribeHoursOfOperation -> ShowS)
-> (DescribeHoursOfOperation -> String)
-> ([DescribeHoursOfOperation] -> ShowS)
-> Show DescribeHoursOfOperation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeHoursOfOperation] -> ShowS
$cshowList :: [DescribeHoursOfOperation] -> ShowS
show :: DescribeHoursOfOperation -> String
$cshow :: DescribeHoursOfOperation -> String
showsPrec :: Int -> DescribeHoursOfOperation -> ShowS
$cshowsPrec :: Int -> DescribeHoursOfOperation -> ShowS
Prelude.Show, (forall x.
 DescribeHoursOfOperation -> Rep DescribeHoursOfOperation x)
-> (forall x.
    Rep DescribeHoursOfOperation x -> DescribeHoursOfOperation)
-> Generic DescribeHoursOfOperation
forall x.
Rep DescribeHoursOfOperation x -> DescribeHoursOfOperation
forall x.
DescribeHoursOfOperation -> Rep DescribeHoursOfOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeHoursOfOperation x -> DescribeHoursOfOperation
$cfrom :: forall x.
DescribeHoursOfOperation -> Rep DescribeHoursOfOperation x
Prelude.Generic)

-- |
-- Create a value of 'DescribeHoursOfOperation' 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:
--
-- 'instanceId', 'describeHoursOfOperation_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'hoursOfOperationId', 'describeHoursOfOperation_hoursOfOperationId' - The identifier for the hours of operation.
newDescribeHoursOfOperation ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'hoursOfOperationId'
  Prelude.Text ->
  DescribeHoursOfOperation
newDescribeHoursOfOperation :: Text -> Text -> DescribeHoursOfOperation
newDescribeHoursOfOperation
  Text
pInstanceId_
  Text
pHoursOfOperationId_ =
    DescribeHoursOfOperation' :: Text -> Text -> DescribeHoursOfOperation
DescribeHoursOfOperation'
      { $sel:instanceId:DescribeHoursOfOperation' :: Text
instanceId =
          Text
pInstanceId_,
        $sel:hoursOfOperationId:DescribeHoursOfOperation' :: Text
hoursOfOperationId = Text
pHoursOfOperationId_
      }

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
describeHoursOfOperation_instanceId :: Lens.Lens' DescribeHoursOfOperation Prelude.Text
describeHoursOfOperation_instanceId :: (Text -> f Text)
-> DescribeHoursOfOperation -> f DescribeHoursOfOperation
describeHoursOfOperation_instanceId = (DescribeHoursOfOperation -> Text)
-> (DescribeHoursOfOperation -> Text -> DescribeHoursOfOperation)
-> Lens DescribeHoursOfOperation DescribeHoursOfOperation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHoursOfOperation' {Text
instanceId :: Text
$sel:instanceId:DescribeHoursOfOperation' :: DescribeHoursOfOperation -> Text
instanceId} -> Text
instanceId) (\s :: DescribeHoursOfOperation
s@DescribeHoursOfOperation' {} Text
a -> DescribeHoursOfOperation
s {$sel:instanceId:DescribeHoursOfOperation' :: Text
instanceId = Text
a} :: DescribeHoursOfOperation)

-- | The identifier for the hours of operation.
describeHoursOfOperation_hoursOfOperationId :: Lens.Lens' DescribeHoursOfOperation Prelude.Text
describeHoursOfOperation_hoursOfOperationId :: (Text -> f Text)
-> DescribeHoursOfOperation -> f DescribeHoursOfOperation
describeHoursOfOperation_hoursOfOperationId = (DescribeHoursOfOperation -> Text)
-> (DescribeHoursOfOperation -> Text -> DescribeHoursOfOperation)
-> Lens DescribeHoursOfOperation DescribeHoursOfOperation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHoursOfOperation' {Text
hoursOfOperationId :: Text
$sel:hoursOfOperationId:DescribeHoursOfOperation' :: DescribeHoursOfOperation -> Text
hoursOfOperationId} -> Text
hoursOfOperationId) (\s :: DescribeHoursOfOperation
s@DescribeHoursOfOperation' {} Text
a -> DescribeHoursOfOperation
s {$sel:hoursOfOperationId:DescribeHoursOfOperation' :: Text
hoursOfOperationId = Text
a} :: DescribeHoursOfOperation)

instance Core.AWSRequest DescribeHoursOfOperation where
  type
    AWSResponse DescribeHoursOfOperation =
      DescribeHoursOfOperationResponse
  request :: DescribeHoursOfOperation -> Request DescribeHoursOfOperation
request = Service
-> DescribeHoursOfOperation -> Request DescribeHoursOfOperation
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeHoursOfOperation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeHoursOfOperation)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeHoursOfOperation))
-> Logger
-> Service
-> Proxy DescribeHoursOfOperation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeHoursOfOperation)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe HoursOfOperation -> Int -> DescribeHoursOfOperationResponse
DescribeHoursOfOperationResponse'
            (Maybe HoursOfOperation -> Int -> DescribeHoursOfOperationResponse)
-> Either String (Maybe HoursOfOperation)
-> Either String (Int -> DescribeHoursOfOperationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe HoursOfOperation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"HoursOfOperation")
            Either String (Int -> DescribeHoursOfOperationResponse)
-> Either String Int
-> Either String DescribeHoursOfOperationResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeHoursOfOperation

instance Prelude.NFData DescribeHoursOfOperation

instance Core.ToHeaders DescribeHoursOfOperation where
  toHeaders :: DescribeHoursOfOperation -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeHoursOfOperation -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeHoursOfOperation where
  toPath :: DescribeHoursOfOperation -> ByteString
toPath DescribeHoursOfOperation' {Text
hoursOfOperationId :: Text
instanceId :: Text
$sel:hoursOfOperationId:DescribeHoursOfOperation' :: DescribeHoursOfOperation -> Text
$sel:instanceId:DescribeHoursOfOperation' :: DescribeHoursOfOperation -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/hours-of-operations/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
instanceId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
hoursOfOperationId
      ]

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

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

-- |
-- Create a value of 'DescribeHoursOfOperationResponse' 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:
--
-- 'hoursOfOperation', 'describeHoursOfOperationResponse_hoursOfOperation' - The hours of operation.
--
-- 'httpStatus', 'describeHoursOfOperationResponse_httpStatus' - The response's http status code.
newDescribeHoursOfOperationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeHoursOfOperationResponse
newDescribeHoursOfOperationResponse :: Int -> DescribeHoursOfOperationResponse
newDescribeHoursOfOperationResponse Int
pHttpStatus_ =
  DescribeHoursOfOperationResponse' :: Maybe HoursOfOperation -> Int -> DescribeHoursOfOperationResponse
DescribeHoursOfOperationResponse'
    { $sel:hoursOfOperation:DescribeHoursOfOperationResponse' :: Maybe HoursOfOperation
hoursOfOperation =
        Maybe HoursOfOperation
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeHoursOfOperationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The hours of operation.
describeHoursOfOperationResponse_hoursOfOperation :: Lens.Lens' DescribeHoursOfOperationResponse (Prelude.Maybe HoursOfOperation)
describeHoursOfOperationResponse_hoursOfOperation :: (Maybe HoursOfOperation -> f (Maybe HoursOfOperation))
-> DescribeHoursOfOperationResponse
-> f DescribeHoursOfOperationResponse
describeHoursOfOperationResponse_hoursOfOperation = (DescribeHoursOfOperationResponse -> Maybe HoursOfOperation)
-> (DescribeHoursOfOperationResponse
    -> Maybe HoursOfOperation -> DescribeHoursOfOperationResponse)
-> Lens
     DescribeHoursOfOperationResponse
     DescribeHoursOfOperationResponse
     (Maybe HoursOfOperation)
     (Maybe HoursOfOperation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeHoursOfOperationResponse' {Maybe HoursOfOperation
hoursOfOperation :: Maybe HoursOfOperation
$sel:hoursOfOperation:DescribeHoursOfOperationResponse' :: DescribeHoursOfOperationResponse -> Maybe HoursOfOperation
hoursOfOperation} -> Maybe HoursOfOperation
hoursOfOperation) (\s :: DescribeHoursOfOperationResponse
s@DescribeHoursOfOperationResponse' {} Maybe HoursOfOperation
a -> DescribeHoursOfOperationResponse
s {$sel:hoursOfOperation:DescribeHoursOfOperationResponse' :: Maybe HoursOfOperation
hoursOfOperation = Maybe HoursOfOperation
a} :: DescribeHoursOfOperationResponse)

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

instance
  Prelude.NFData
    DescribeHoursOfOperationResponse