{-# 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.WorkSpaces.Types.OperatingSystem
-- 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.WorkSpaces.Types.OperatingSystem 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
import Amazonka.WorkSpaces.Types.OperatingSystemType

-- | The operating system that the image is running.
--
-- /See:/ 'newOperatingSystem' smart constructor.
data OperatingSystem = OperatingSystem'
  { -- | The operating system.
    OperatingSystem -> Maybe OperatingSystemType
type' :: Prelude.Maybe OperatingSystemType
  }
  deriving (OperatingSystem -> OperatingSystem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OperatingSystem -> OperatingSystem -> Bool
$c/= :: OperatingSystem -> OperatingSystem -> Bool
== :: OperatingSystem -> OperatingSystem -> Bool
$c== :: OperatingSystem -> OperatingSystem -> Bool
Prelude.Eq, ReadPrec [OperatingSystem]
ReadPrec OperatingSystem
Int -> ReadS OperatingSystem
ReadS [OperatingSystem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OperatingSystem]
$creadListPrec :: ReadPrec [OperatingSystem]
readPrec :: ReadPrec OperatingSystem
$creadPrec :: ReadPrec OperatingSystem
readList :: ReadS [OperatingSystem]
$creadList :: ReadS [OperatingSystem]
readsPrec :: Int -> ReadS OperatingSystem
$creadsPrec :: Int -> ReadS OperatingSystem
Prelude.Read, Int -> OperatingSystem -> ShowS
[OperatingSystem] -> ShowS
OperatingSystem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OperatingSystem] -> ShowS
$cshowList :: [OperatingSystem] -> ShowS
show :: OperatingSystem -> String
$cshow :: OperatingSystem -> String
showsPrec :: Int -> OperatingSystem -> ShowS
$cshowsPrec :: Int -> OperatingSystem -> ShowS
Prelude.Show, forall x. Rep OperatingSystem x -> OperatingSystem
forall x. OperatingSystem -> Rep OperatingSystem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OperatingSystem x -> OperatingSystem
$cfrom :: forall x. OperatingSystem -> Rep OperatingSystem x
Prelude.Generic)

-- |
-- Create a value of 'OperatingSystem' 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:
--
-- 'type'', 'operatingSystem_type' - The operating system.
newOperatingSystem ::
  OperatingSystem
newOperatingSystem :: OperatingSystem
newOperatingSystem =
  OperatingSystem' {$sel:type':OperatingSystem' :: Maybe OperatingSystemType
type' = forall a. Maybe a
Prelude.Nothing}

-- | The operating system.
operatingSystem_type :: Lens.Lens' OperatingSystem (Prelude.Maybe OperatingSystemType)
operatingSystem_type :: Lens' OperatingSystem (Maybe OperatingSystemType)
operatingSystem_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OperatingSystem' {Maybe OperatingSystemType
type' :: Maybe OperatingSystemType
$sel:type':OperatingSystem' :: OperatingSystem -> Maybe OperatingSystemType
type'} -> Maybe OperatingSystemType
type') (\s :: OperatingSystem
s@OperatingSystem' {} Maybe OperatingSystemType
a -> OperatingSystem
s {$sel:type':OperatingSystem' :: Maybe OperatingSystemType
type' = Maybe OperatingSystemType
a} :: OperatingSystem)

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

instance Prelude.Hashable OperatingSystem where
  hashWithSalt :: Int -> OperatingSystem -> Int
hashWithSalt Int
_salt OperatingSystem' {Maybe OperatingSystemType
type' :: Maybe OperatingSystemType
$sel:type':OperatingSystem' :: OperatingSystem -> Maybe OperatingSystemType
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OperatingSystemType
type'

instance Prelude.NFData OperatingSystem where
  rnf :: OperatingSystem -> ()
rnf OperatingSystem' {Maybe OperatingSystemType
type' :: Maybe OperatingSystemType
$sel:type':OperatingSystem' :: OperatingSystem -> Maybe OperatingSystemType
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe OperatingSystemType
type'