{-# 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.IoTRoboRunner.Types.Site
-- 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.IoTRoboRunner.Types.Site 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

-- | Facility containing destinations, workers, activities, and tasks.
--
-- /See:/ 'newSite' smart constructor.
data Site = Site'
  { Site -> Text
arn :: Prelude.Text,
    -- | The name of the site. Mutable after creation and unique within a given
    -- account.
    Site -> Text
name :: Prelude.Text,
    Site -> Text
countryCode :: Prelude.Text,
    Site -> POSIX
createdAt :: Data.POSIX
  }
  deriving (Site -> Site -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Site -> Site -> Bool
$c/= :: Site -> Site -> Bool
== :: Site -> Site -> Bool
$c== :: Site -> Site -> Bool
Prelude.Eq, ReadPrec [Site]
ReadPrec Site
Int -> ReadS Site
ReadS [Site]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Site]
$creadListPrec :: ReadPrec [Site]
readPrec :: ReadPrec Site
$creadPrec :: ReadPrec Site
readList :: ReadS [Site]
$creadList :: ReadS [Site]
readsPrec :: Int -> ReadS Site
$creadsPrec :: Int -> ReadS Site
Prelude.Read, Int -> Site -> ShowS
[Site] -> ShowS
Site -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Site] -> ShowS
$cshowList :: [Site] -> ShowS
show :: Site -> String
$cshow :: Site -> String
showsPrec :: Int -> Site -> ShowS
$cshowsPrec :: Int -> Site -> ShowS
Prelude.Show, forall x. Rep Site x -> Site
forall x. Site -> Rep Site x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Site x -> Site
$cfrom :: forall x. Site -> Rep Site x
Prelude.Generic)

-- |
-- Create a value of 'Site' 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:
--
-- 'arn', 'site_arn' - Undocumented member.
--
-- 'name', 'site_name' - The name of the site. Mutable after creation and unique within a given
-- account.
--
-- 'countryCode', 'site_countryCode' - Undocumented member.
--
-- 'createdAt', 'site_createdAt' - Undocumented member.
newSite ::
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'countryCode'
  Prelude.Text ->
  -- | 'createdAt'
  Prelude.UTCTime ->
  Site
newSite :: Text -> Text -> Text -> UTCTime -> Site
newSite Text
pArn_ Text
pName_ Text
pCountryCode_ UTCTime
pCreatedAt_ =
  Site'
    { $sel:arn:Site' :: Text
arn = Text
pArn_,
      $sel:name:Site' :: Text
name = Text
pName_,
      $sel:countryCode:Site' :: Text
countryCode = Text
pCountryCode_,
      $sel:createdAt:Site' :: POSIX
createdAt = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreatedAt_
    }

-- | Undocumented member.
site_arn :: Lens.Lens' Site Prelude.Text
site_arn :: Lens' Site Text
site_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Text
arn :: Text
$sel:arn:Site' :: Site -> Text
arn} -> Text
arn) (\s :: Site
s@Site' {} Text
a -> Site
s {$sel:arn:Site' :: Text
arn = Text
a} :: Site)

-- | The name of the site. Mutable after creation and unique within a given
-- account.
site_name :: Lens.Lens' Site Prelude.Text
site_name :: Lens' Site Text
site_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Text
name :: Text
$sel:name:Site' :: Site -> Text
name} -> Text
name) (\s :: Site
s@Site' {} Text
a -> Site
s {$sel:name:Site' :: Text
name = Text
a} :: Site)

-- | Undocumented member.
site_countryCode :: Lens.Lens' Site Prelude.Text
site_countryCode :: Lens' Site Text
site_countryCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Text
countryCode :: Text
$sel:countryCode:Site' :: Site -> Text
countryCode} -> Text
countryCode) (\s :: Site
s@Site' {} Text
a -> Site
s {$sel:countryCode:Site' :: Text
countryCode = Text
a} :: Site)

-- | Undocumented member.
site_createdAt :: Lens.Lens' Site Prelude.UTCTime
site_createdAt :: Lens' Site UTCTime
site_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {POSIX
createdAt :: POSIX
$sel:createdAt:Site' :: Site -> POSIX
createdAt} -> POSIX
createdAt) (\s :: Site
s@Site' {} POSIX
a -> Site
s {$sel:createdAt:Site' :: POSIX
createdAt = POSIX
a} :: Site) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance Data.FromJSON Site where
  parseJSON :: Value -> Parser Site
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Site"
      ( \Object
x ->
          Text -> Text -> Text -> POSIX -> Site
Site'
            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
"arn")
            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
"name")
            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
"countryCode")
            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
"createdAt")
      )

instance Prelude.Hashable Site where
  hashWithSalt :: Int -> Site -> Int
hashWithSalt Int
_salt Site' {Text
POSIX
createdAt :: POSIX
countryCode :: Text
name :: Text
arn :: Text
$sel:createdAt:Site' :: Site -> POSIX
$sel:countryCode:Site' :: Site -> Text
$sel:name:Site' :: Site -> Text
$sel:arn:Site' :: Site -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
countryCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` POSIX
createdAt

instance Prelude.NFData Site where
  rnf :: Site -> ()
rnf Site' {Text
POSIX
createdAt :: POSIX
countryCode :: Text
name :: Text
arn :: Text
$sel:createdAt:Site' :: Site -> POSIX
$sel:countryCode:Site' :: Site -> Text
$sel:name:Site' :: Site -> Text
$sel:arn:Site' :: Site -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
countryCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
createdAt