packages feed

amazonka-lexv2-models-2.0: gen/Amazonka/LexV2Models/Types/GrammarSlotTypeSetting.hs

{-# 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.LexV2Models.Types.GrammarSlotTypeSetting
-- 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.LexV2Models.Types.GrammarSlotTypeSetting where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types.GrammarSlotTypeSource
import qualified Amazonka.Prelude as Prelude

-- | Settings requried for a slot type based on a grammar that you provide.
--
-- /See:/ 'newGrammarSlotTypeSetting' smart constructor.
data GrammarSlotTypeSetting = GrammarSlotTypeSetting'
  { -- | The source of the grammar used to create the slot type.
    source :: Prelude.Maybe GrammarSlotTypeSource
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'GrammarSlotTypeSetting' 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:
--
-- 'source', 'grammarSlotTypeSetting_source' - The source of the grammar used to create the slot type.
newGrammarSlotTypeSetting ::
  GrammarSlotTypeSetting
newGrammarSlotTypeSetting =
  GrammarSlotTypeSetting' {source = Prelude.Nothing}

-- | The source of the grammar used to create the slot type.
grammarSlotTypeSetting_source :: Lens.Lens' GrammarSlotTypeSetting (Prelude.Maybe GrammarSlotTypeSource)
grammarSlotTypeSetting_source = Lens.lens (\GrammarSlotTypeSetting' {source} -> source) (\s@GrammarSlotTypeSetting' {} a -> s {source = a} :: GrammarSlotTypeSetting)

instance Data.FromJSON GrammarSlotTypeSetting where
  parseJSON =
    Data.withObject
      "GrammarSlotTypeSetting"
      ( \x ->
          GrammarSlotTypeSetting'
            Prelude.<$> (x Data..:? "source")
      )

instance Prelude.Hashable GrammarSlotTypeSetting where
  hashWithSalt _salt GrammarSlotTypeSetting' {..} =
    _salt `Prelude.hashWithSalt` source

instance Prelude.NFData GrammarSlotTypeSetting where
  rnf GrammarSlotTypeSetting' {..} = Prelude.rnf source

instance Data.ToJSON GrammarSlotTypeSetting where
  toJSON GrammarSlotTypeSetting' {..} =
    Data.object
      ( Prelude.catMaybes
          [("source" Data..=) Prelude.<$> source]
      )