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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types.Location
import Amazonka.NetworkManager.Types.SiteState
import Amazonka.NetworkManager.Types.Tag
import qualified Amazonka.Prelude as Prelude

-- | Describes a site.
--
-- /See:/ 'newSite' smart constructor.
data Site = Site'
  { -- | The date and time that the site was created.
    Site -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The description of the site.
    Site -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the global network.
    Site -> Maybe Text
globalNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The location of the site.
    Site -> Maybe (Sensitive Location)
location :: Prelude.Maybe (Data.Sensitive Location),
    -- | The Amazon Resource Name (ARN) of the site.
    Site -> Maybe Text
siteArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the site.
    Site -> Maybe Text
siteId :: Prelude.Maybe Prelude.Text,
    -- | The state of the site.
    Site -> Maybe SiteState
state :: Prelude.Maybe SiteState,
    -- | The tags for the site.
    Site -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  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, 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:
--
-- 'createdAt', 'site_createdAt' - The date and time that the site was created.
--
-- 'description', 'site_description' - The description of the site.
--
-- 'globalNetworkId', 'site_globalNetworkId' - The ID of the global network.
--
-- 'location', 'site_location' - The location of the site.
--
-- 'siteArn', 'site_siteArn' - The Amazon Resource Name (ARN) of the site.
--
-- 'siteId', 'site_siteId' - The ID of the site.
--
-- 'state', 'site_state' - The state of the site.
--
-- 'tags', 'site_tags' - The tags for the site.
newSite ::
  Site
newSite :: Site
newSite =
  Site'
    { $sel:createdAt:Site' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:description:Site' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:Site' :: Maybe Text
globalNetworkId = forall a. Maybe a
Prelude.Nothing,
      $sel:location:Site' :: Maybe (Sensitive Location)
location = forall a. Maybe a
Prelude.Nothing,
      $sel:siteArn:Site' :: Maybe Text
siteArn = forall a. Maybe a
Prelude.Nothing,
      $sel:siteId:Site' :: Maybe Text
siteId = forall a. Maybe a
Prelude.Nothing,
      $sel:state:Site' :: Maybe SiteState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Site' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing
    }

-- | The date and time that the site was created.
site_createdAt :: Lens.Lens' Site (Prelude.Maybe Prelude.UTCTime)
site_createdAt :: Lens' Site (Maybe UTCTime)
site_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:Site' :: Site -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: Site
s@Site' {} Maybe POSIX
a -> Site
s {$sel:createdAt:Site' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: Site) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the site.
site_description :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_description :: Lens' Site (Maybe Text)
site_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
description :: Maybe Text
$sel:description:Site' :: Site -> Maybe Text
description} -> Maybe Text
description) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:description:Site' :: Maybe Text
description = Maybe Text
a} :: Site)

-- | The ID of the global network.
site_globalNetworkId :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_globalNetworkId :: Lens' Site (Maybe Text)
site_globalNetworkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
globalNetworkId :: Maybe Text
$sel:globalNetworkId:Site' :: Site -> Maybe Text
globalNetworkId} -> Maybe Text
globalNetworkId) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:globalNetworkId:Site' :: Maybe Text
globalNetworkId = Maybe Text
a} :: Site)

-- | The location of the site.
site_location :: Lens.Lens' Site (Prelude.Maybe Location)
site_location :: Lens' Site (Maybe Location)
site_location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe (Sensitive Location)
location :: Maybe (Sensitive Location)
$sel:location:Site' :: Site -> Maybe (Sensitive Location)
location} -> Maybe (Sensitive Location)
location) (\s :: Site
s@Site' {} Maybe (Sensitive Location)
a -> Site
s {$sel:location:Site' :: Maybe (Sensitive Location)
location = Maybe (Sensitive Location)
a} :: Site) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive

-- | The Amazon Resource Name (ARN) of the site.
site_siteArn :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_siteArn :: Lens' Site (Maybe Text)
site_siteArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
siteArn :: Maybe Text
$sel:siteArn:Site' :: Site -> Maybe Text
siteArn} -> Maybe Text
siteArn) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:siteArn:Site' :: Maybe Text
siteArn = Maybe Text
a} :: Site)

-- | The ID of the site.
site_siteId :: Lens.Lens' Site (Prelude.Maybe Prelude.Text)
site_siteId :: Lens' Site (Maybe Text)
site_siteId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe Text
siteId :: Maybe Text
$sel:siteId:Site' :: Site -> Maybe Text
siteId} -> Maybe Text
siteId) (\s :: Site
s@Site' {} Maybe Text
a -> Site
s {$sel:siteId:Site' :: Maybe Text
siteId = Maybe Text
a} :: Site)

-- | The state of the site.
site_state :: Lens.Lens' Site (Prelude.Maybe SiteState)
site_state :: Lens' Site (Maybe SiteState)
site_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe SiteState
state :: Maybe SiteState
$sel:state:Site' :: Site -> Maybe SiteState
state} -> Maybe SiteState
state) (\s :: Site
s@Site' {} Maybe SiteState
a -> Site
s {$sel:state:Site' :: Maybe SiteState
state = Maybe SiteState
a} :: Site)

-- | The tags for the site.
site_tags :: Lens.Lens' Site (Prelude.Maybe [Tag])
site_tags :: Lens' Site (Maybe [Tag])
site_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Site' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Site' :: Site -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Site
s@Site' {} Maybe [Tag]
a -> Site
s {$sel:tags:Site' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Site) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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 ->
          Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe (Sensitive Location)
-> Maybe Text
-> Maybe Text
-> Maybe SiteState
-> Maybe [Tag]
-> Site
Site'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedAt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"GlobalNetworkId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Location")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SiteArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"SiteId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable Site where
  hashWithSalt :: Int -> Site -> Int
hashWithSalt Int
_salt Site' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Maybe POSIX
Maybe SiteState
tags :: Maybe [Tag]
state :: Maybe SiteState
siteId :: Maybe Text
siteArn :: Maybe Text
location :: Maybe (Sensitive Location)
globalNetworkId :: Maybe Text
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:tags:Site' :: Site -> Maybe [Tag]
$sel:state:Site' :: Site -> Maybe SiteState
$sel:siteId:Site' :: Site -> Maybe Text
$sel:siteArn:Site' :: Site -> Maybe Text
$sel:location:Site' :: Site -> Maybe (Sensitive Location)
$sel:globalNetworkId:Site' :: Site -> Maybe Text
$sel:description:Site' :: Site -> Maybe Text
$sel:createdAt:Site' :: Site -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
globalNetworkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Location)
location
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
siteArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
siteId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SiteState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags

instance Prelude.NFData Site where
  rnf :: Site -> ()
rnf Site' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Location)
Maybe POSIX
Maybe SiteState
tags :: Maybe [Tag]
state :: Maybe SiteState
siteId :: Maybe Text
siteArn :: Maybe Text
location :: Maybe (Sensitive Location)
globalNetworkId :: Maybe Text
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:tags:Site' :: Site -> Maybe [Tag]
$sel:state:Site' :: Site -> Maybe SiteState
$sel:siteId:Site' :: Site -> Maybe Text
$sel:siteArn:Site' :: Site -> Maybe Text
$sel:location:Site' :: Site -> Maybe (Sensitive Location)
$sel:globalNetworkId:Site' :: Site -> Maybe Text
$sel:description:Site' :: Site -> Maybe Text
$sel:createdAt:Site' :: Site -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
globalNetworkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Location)
location
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
siteArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
siteId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SiteState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags