{-# 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.DirectConnect.Types.CustomerAgreement
-- 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)
module Amazonka.DirectConnect.Types.CustomerAgreement where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The name and status of a customer agreement.
--
-- /See:/ 'newCustomerAgreement' smart constructor.
data CustomerAgreement = CustomerAgreement'
  { -- | The status of the customer agreement. This will be either @signed@ or
    -- @unsigned@
    CustomerAgreement -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the agreement.
    CustomerAgreement -> Maybe Text
agreementName :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomerAgreement -> CustomerAgreement -> Bool
(CustomerAgreement -> CustomerAgreement -> Bool)
-> (CustomerAgreement -> CustomerAgreement -> Bool)
-> Eq CustomerAgreement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomerAgreement -> CustomerAgreement -> Bool
$c/= :: CustomerAgreement -> CustomerAgreement -> Bool
== :: CustomerAgreement -> CustomerAgreement -> Bool
$c== :: CustomerAgreement -> CustomerAgreement -> Bool
Prelude.Eq, ReadPrec [CustomerAgreement]
ReadPrec CustomerAgreement
Int -> ReadS CustomerAgreement
ReadS [CustomerAgreement]
(Int -> ReadS CustomerAgreement)
-> ReadS [CustomerAgreement]
-> ReadPrec CustomerAgreement
-> ReadPrec [CustomerAgreement]
-> Read CustomerAgreement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomerAgreement]
$creadListPrec :: ReadPrec [CustomerAgreement]
readPrec :: ReadPrec CustomerAgreement
$creadPrec :: ReadPrec CustomerAgreement
readList :: ReadS [CustomerAgreement]
$creadList :: ReadS [CustomerAgreement]
readsPrec :: Int -> ReadS CustomerAgreement
$creadsPrec :: Int -> ReadS CustomerAgreement
Prelude.Read, Int -> CustomerAgreement -> ShowS
[CustomerAgreement] -> ShowS
CustomerAgreement -> String
(Int -> CustomerAgreement -> ShowS)
-> (CustomerAgreement -> String)
-> ([CustomerAgreement] -> ShowS)
-> Show CustomerAgreement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomerAgreement] -> ShowS
$cshowList :: [CustomerAgreement] -> ShowS
show :: CustomerAgreement -> String
$cshow :: CustomerAgreement -> String
showsPrec :: Int -> CustomerAgreement -> ShowS
$cshowsPrec :: Int -> CustomerAgreement -> ShowS
Prelude.Show, (forall x. CustomerAgreement -> Rep CustomerAgreement x)
-> (forall x. Rep CustomerAgreement x -> CustomerAgreement)
-> Generic CustomerAgreement
forall x. Rep CustomerAgreement x -> CustomerAgreement
forall x. CustomerAgreement -> Rep CustomerAgreement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomerAgreement x -> CustomerAgreement
$cfrom :: forall x. CustomerAgreement -> Rep CustomerAgreement x
Prelude.Generic)

-- |
-- Create a value of 'CustomerAgreement' 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:
--
-- 'status', 'customerAgreement_status' - The status of the customer agreement. This will be either @signed@ or
-- @unsigned@
--
-- 'agreementName', 'customerAgreement_agreementName' - The name of the agreement.
newCustomerAgreement ::
  CustomerAgreement
newCustomerAgreement :: CustomerAgreement
newCustomerAgreement =
  CustomerAgreement' :: Maybe Text -> Maybe Text -> CustomerAgreement
CustomerAgreement'
    { $sel:status:CustomerAgreement' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:agreementName:CustomerAgreement' :: Maybe Text
agreementName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the customer agreement. This will be either @signed@ or
-- @unsigned@
customerAgreement_status :: Lens.Lens' CustomerAgreement (Prelude.Maybe Prelude.Text)
customerAgreement_status :: (Maybe Text -> f (Maybe Text))
-> CustomerAgreement -> f CustomerAgreement
customerAgreement_status = (CustomerAgreement -> Maybe Text)
-> (CustomerAgreement -> Maybe Text -> CustomerAgreement)
-> Lens
     CustomerAgreement CustomerAgreement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAgreement' {Maybe Text
status :: Maybe Text
$sel:status:CustomerAgreement' :: CustomerAgreement -> Maybe Text
status} -> Maybe Text
status) (\s :: CustomerAgreement
s@CustomerAgreement' {} Maybe Text
a -> CustomerAgreement
s {$sel:status:CustomerAgreement' :: Maybe Text
status = Maybe Text
a} :: CustomerAgreement)

-- | The name of the agreement.
customerAgreement_agreementName :: Lens.Lens' CustomerAgreement (Prelude.Maybe Prelude.Text)
customerAgreement_agreementName :: (Maybe Text -> f (Maybe Text))
-> CustomerAgreement -> f CustomerAgreement
customerAgreement_agreementName = (CustomerAgreement -> Maybe Text)
-> (CustomerAgreement -> Maybe Text -> CustomerAgreement)
-> Lens
     CustomerAgreement CustomerAgreement (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomerAgreement' {Maybe Text
agreementName :: Maybe Text
$sel:agreementName:CustomerAgreement' :: CustomerAgreement -> Maybe Text
agreementName} -> Maybe Text
agreementName) (\s :: CustomerAgreement
s@CustomerAgreement' {} Maybe Text
a -> CustomerAgreement
s {$sel:agreementName:CustomerAgreement' :: Maybe Text
agreementName = Maybe Text
a} :: CustomerAgreement)

instance Core.FromJSON CustomerAgreement where
  parseJSON :: Value -> Parser CustomerAgreement
parseJSON =
    String
-> (Object -> Parser CustomerAgreement)
-> Value
-> Parser CustomerAgreement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CustomerAgreement"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> CustomerAgreement
CustomerAgreement'
            (Maybe Text -> Maybe Text -> CustomerAgreement)
-> Parser (Maybe Text) -> Parser (Maybe Text -> CustomerAgreement)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser (Maybe Text -> CustomerAgreement)
-> Parser (Maybe Text) -> Parser CustomerAgreement
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"agreementName")
      )

instance Prelude.Hashable CustomerAgreement

instance Prelude.NFData CustomerAgreement