{-# 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.CodeArtifact.Types.LicenseInfo
-- 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.CodeArtifact.Types.LicenseInfo 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

-- | Details of the license data.
--
-- /See:/ 'newLicenseInfo' smart constructor.
data LicenseInfo = LicenseInfo'
  { -- | Name of the license.
    LicenseInfo -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The URL for license data.
    LicenseInfo -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (LicenseInfo -> LicenseInfo -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LicenseInfo -> LicenseInfo -> Bool
$c/= :: LicenseInfo -> LicenseInfo -> Bool
== :: LicenseInfo -> LicenseInfo -> Bool
$c== :: LicenseInfo -> LicenseInfo -> Bool
Prelude.Eq, ReadPrec [LicenseInfo]
ReadPrec LicenseInfo
Int -> ReadS LicenseInfo
ReadS [LicenseInfo]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LicenseInfo]
$creadListPrec :: ReadPrec [LicenseInfo]
readPrec :: ReadPrec LicenseInfo
$creadPrec :: ReadPrec LicenseInfo
readList :: ReadS [LicenseInfo]
$creadList :: ReadS [LicenseInfo]
readsPrec :: Int -> ReadS LicenseInfo
$creadsPrec :: Int -> ReadS LicenseInfo
Prelude.Read, Int -> LicenseInfo -> ShowS
[LicenseInfo] -> ShowS
LicenseInfo -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LicenseInfo] -> ShowS
$cshowList :: [LicenseInfo] -> ShowS
show :: LicenseInfo -> String
$cshow :: LicenseInfo -> String
showsPrec :: Int -> LicenseInfo -> ShowS
$cshowsPrec :: Int -> LicenseInfo -> ShowS
Prelude.Show, forall x. Rep LicenseInfo x -> LicenseInfo
forall x. LicenseInfo -> Rep LicenseInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LicenseInfo x -> LicenseInfo
$cfrom :: forall x. LicenseInfo -> Rep LicenseInfo x
Prelude.Generic)

-- |
-- Create a value of 'LicenseInfo' 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:
--
-- 'name', 'licenseInfo_name' - Name of the license.
--
-- 'url', 'licenseInfo_url' - The URL for license data.
newLicenseInfo ::
  LicenseInfo
newLicenseInfo :: LicenseInfo
newLicenseInfo =
  LicenseInfo'
    { $sel:name:LicenseInfo' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:url:LicenseInfo' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | Name of the license.
licenseInfo_name :: Lens.Lens' LicenseInfo (Prelude.Maybe Prelude.Text)
licenseInfo_name :: Lens' LicenseInfo (Maybe Text)
licenseInfo_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseInfo' {Maybe Text
name :: Maybe Text
$sel:name:LicenseInfo' :: LicenseInfo -> Maybe Text
name} -> Maybe Text
name) (\s :: LicenseInfo
s@LicenseInfo' {} Maybe Text
a -> LicenseInfo
s {$sel:name:LicenseInfo' :: Maybe Text
name = Maybe Text
a} :: LicenseInfo)

-- | The URL for license data.
licenseInfo_url :: Lens.Lens' LicenseInfo (Prelude.Maybe Prelude.Text)
licenseInfo_url :: Lens' LicenseInfo (Maybe Text)
licenseInfo_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LicenseInfo' {Maybe Text
url :: Maybe Text
$sel:url:LicenseInfo' :: LicenseInfo -> Maybe Text
url} -> Maybe Text
url) (\s :: LicenseInfo
s@LicenseInfo' {} Maybe Text
a -> LicenseInfo
s {$sel:url:LicenseInfo' :: Maybe Text
url = Maybe Text
a} :: LicenseInfo)

instance Data.FromJSON LicenseInfo where
  parseJSON :: Value -> Parser LicenseInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LicenseInfo"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> LicenseInfo
LicenseInfo'
            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
"name")
            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
"url")
      )

instance Prelude.Hashable LicenseInfo where
  hashWithSalt :: Int -> LicenseInfo -> Int
hashWithSalt Int
_salt LicenseInfo' {Maybe Text
url :: Maybe Text
name :: Maybe Text
$sel:url:LicenseInfo' :: LicenseInfo -> Maybe Text
$sel:name:LicenseInfo' :: LicenseInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url

instance Prelude.NFData LicenseInfo where
  rnf :: LicenseInfo -> ()
rnf LicenseInfo' {Maybe Text
url :: Maybe Text
name :: Maybe Text
$sel:url:LicenseInfo' :: LicenseInfo -> Maybe Text
$sel:name:LicenseInfo' :: LicenseInfo -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url