{-# 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.DeviceFarm.Types.DevicePoolCompatibilityResult
-- 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.DeviceFarm.Types.DevicePoolCompatibilityResult where

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types.Device
import Amazonka.DeviceFarm.Types.IncompatibilityMessage
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a device pool compatibility result.
--
-- /See:/ 'newDevicePoolCompatibilityResult' smart constructor.
data DevicePoolCompatibilityResult = DevicePoolCompatibilityResult'
  { -- | The device (phone or tablet) to return information about.
    DevicePoolCompatibilityResult -> Maybe Device
device :: Prelude.Maybe Device,
    -- | Whether the result was compatible with the device pool.
    DevicePoolCompatibilityResult -> Maybe Bool
compatible :: Prelude.Maybe Prelude.Bool,
    -- | Information about the compatibility.
    DevicePoolCompatibilityResult -> Maybe [IncompatibilityMessage]
incompatibilityMessages :: Prelude.Maybe [IncompatibilityMessage]
  }
  deriving (DevicePoolCompatibilityResult
-> DevicePoolCompatibilityResult -> Bool
(DevicePoolCompatibilityResult
 -> DevicePoolCompatibilityResult -> Bool)
-> (DevicePoolCompatibilityResult
    -> DevicePoolCompatibilityResult -> Bool)
-> Eq DevicePoolCompatibilityResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DevicePoolCompatibilityResult
-> DevicePoolCompatibilityResult -> Bool
$c/= :: DevicePoolCompatibilityResult
-> DevicePoolCompatibilityResult -> Bool
== :: DevicePoolCompatibilityResult
-> DevicePoolCompatibilityResult -> Bool
$c== :: DevicePoolCompatibilityResult
-> DevicePoolCompatibilityResult -> Bool
Prelude.Eq, ReadPrec [DevicePoolCompatibilityResult]
ReadPrec DevicePoolCompatibilityResult
Int -> ReadS DevicePoolCompatibilityResult
ReadS [DevicePoolCompatibilityResult]
(Int -> ReadS DevicePoolCompatibilityResult)
-> ReadS [DevicePoolCompatibilityResult]
-> ReadPrec DevicePoolCompatibilityResult
-> ReadPrec [DevicePoolCompatibilityResult]
-> Read DevicePoolCompatibilityResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DevicePoolCompatibilityResult]
$creadListPrec :: ReadPrec [DevicePoolCompatibilityResult]
readPrec :: ReadPrec DevicePoolCompatibilityResult
$creadPrec :: ReadPrec DevicePoolCompatibilityResult
readList :: ReadS [DevicePoolCompatibilityResult]
$creadList :: ReadS [DevicePoolCompatibilityResult]
readsPrec :: Int -> ReadS DevicePoolCompatibilityResult
$creadsPrec :: Int -> ReadS DevicePoolCompatibilityResult
Prelude.Read, Int -> DevicePoolCompatibilityResult -> ShowS
[DevicePoolCompatibilityResult] -> ShowS
DevicePoolCompatibilityResult -> String
(Int -> DevicePoolCompatibilityResult -> ShowS)
-> (DevicePoolCompatibilityResult -> String)
-> ([DevicePoolCompatibilityResult] -> ShowS)
-> Show DevicePoolCompatibilityResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DevicePoolCompatibilityResult] -> ShowS
$cshowList :: [DevicePoolCompatibilityResult] -> ShowS
show :: DevicePoolCompatibilityResult -> String
$cshow :: DevicePoolCompatibilityResult -> String
showsPrec :: Int -> DevicePoolCompatibilityResult -> ShowS
$cshowsPrec :: Int -> DevicePoolCompatibilityResult -> ShowS
Prelude.Show, (forall x.
 DevicePoolCompatibilityResult
 -> Rep DevicePoolCompatibilityResult x)
-> (forall x.
    Rep DevicePoolCompatibilityResult x
    -> DevicePoolCompatibilityResult)
-> Generic DevicePoolCompatibilityResult
forall x.
Rep DevicePoolCompatibilityResult x
-> DevicePoolCompatibilityResult
forall x.
DevicePoolCompatibilityResult
-> Rep DevicePoolCompatibilityResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DevicePoolCompatibilityResult x
-> DevicePoolCompatibilityResult
$cfrom :: forall x.
DevicePoolCompatibilityResult
-> Rep DevicePoolCompatibilityResult x
Prelude.Generic)

-- |
-- Create a value of 'DevicePoolCompatibilityResult' 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:
--
-- 'device', 'devicePoolCompatibilityResult_device' - The device (phone or tablet) to return information about.
--
-- 'compatible', 'devicePoolCompatibilityResult_compatible' - Whether the result was compatible with the device pool.
--
-- 'incompatibilityMessages', 'devicePoolCompatibilityResult_incompatibilityMessages' - Information about the compatibility.
newDevicePoolCompatibilityResult ::
  DevicePoolCompatibilityResult
newDevicePoolCompatibilityResult :: DevicePoolCompatibilityResult
newDevicePoolCompatibilityResult =
  DevicePoolCompatibilityResult' :: Maybe Device
-> Maybe Bool
-> Maybe [IncompatibilityMessage]
-> DevicePoolCompatibilityResult
DevicePoolCompatibilityResult'
    { $sel:device:DevicePoolCompatibilityResult' :: Maybe Device
device =
        Maybe Device
forall a. Maybe a
Prelude.Nothing,
      $sel:compatible:DevicePoolCompatibilityResult' :: Maybe Bool
compatible = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:incompatibilityMessages:DevicePoolCompatibilityResult' :: Maybe [IncompatibilityMessage]
incompatibilityMessages = Maybe [IncompatibilityMessage]
forall a. Maybe a
Prelude.Nothing
    }

-- | The device (phone or tablet) to return information about.
devicePoolCompatibilityResult_device :: Lens.Lens' DevicePoolCompatibilityResult (Prelude.Maybe Device)
devicePoolCompatibilityResult_device :: (Maybe Device -> f (Maybe Device))
-> DevicePoolCompatibilityResult -> f DevicePoolCompatibilityResult
devicePoolCompatibilityResult_device = (DevicePoolCompatibilityResult -> Maybe Device)
-> (DevicePoolCompatibilityResult
    -> Maybe Device -> DevicePoolCompatibilityResult)
-> Lens
     DevicePoolCompatibilityResult
     DevicePoolCompatibilityResult
     (Maybe Device)
     (Maybe Device)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePoolCompatibilityResult' {Maybe Device
device :: Maybe Device
$sel:device:DevicePoolCompatibilityResult' :: DevicePoolCompatibilityResult -> Maybe Device
device} -> Maybe Device
device) (\s :: DevicePoolCompatibilityResult
s@DevicePoolCompatibilityResult' {} Maybe Device
a -> DevicePoolCompatibilityResult
s {$sel:device:DevicePoolCompatibilityResult' :: Maybe Device
device = Maybe Device
a} :: DevicePoolCompatibilityResult)

-- | Whether the result was compatible with the device pool.
devicePoolCompatibilityResult_compatible :: Lens.Lens' DevicePoolCompatibilityResult (Prelude.Maybe Prelude.Bool)
devicePoolCompatibilityResult_compatible :: (Maybe Bool -> f (Maybe Bool))
-> DevicePoolCompatibilityResult -> f DevicePoolCompatibilityResult
devicePoolCompatibilityResult_compatible = (DevicePoolCompatibilityResult -> Maybe Bool)
-> (DevicePoolCompatibilityResult
    -> Maybe Bool -> DevicePoolCompatibilityResult)
-> Lens
     DevicePoolCompatibilityResult
     DevicePoolCompatibilityResult
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePoolCompatibilityResult' {Maybe Bool
compatible :: Maybe Bool
$sel:compatible:DevicePoolCompatibilityResult' :: DevicePoolCompatibilityResult -> Maybe Bool
compatible} -> Maybe Bool
compatible) (\s :: DevicePoolCompatibilityResult
s@DevicePoolCompatibilityResult' {} Maybe Bool
a -> DevicePoolCompatibilityResult
s {$sel:compatible:DevicePoolCompatibilityResult' :: Maybe Bool
compatible = Maybe Bool
a} :: DevicePoolCompatibilityResult)

-- | Information about the compatibility.
devicePoolCompatibilityResult_incompatibilityMessages :: Lens.Lens' DevicePoolCompatibilityResult (Prelude.Maybe [IncompatibilityMessage])
devicePoolCompatibilityResult_incompatibilityMessages :: (Maybe [IncompatibilityMessage]
 -> f (Maybe [IncompatibilityMessage]))
-> DevicePoolCompatibilityResult -> f DevicePoolCompatibilityResult
devicePoolCompatibilityResult_incompatibilityMessages = (DevicePoolCompatibilityResult -> Maybe [IncompatibilityMessage])
-> (DevicePoolCompatibilityResult
    -> Maybe [IncompatibilityMessage] -> DevicePoolCompatibilityResult)
-> Lens
     DevicePoolCompatibilityResult
     DevicePoolCompatibilityResult
     (Maybe [IncompatibilityMessage])
     (Maybe [IncompatibilityMessage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DevicePoolCompatibilityResult' {Maybe [IncompatibilityMessage]
incompatibilityMessages :: Maybe [IncompatibilityMessage]
$sel:incompatibilityMessages:DevicePoolCompatibilityResult' :: DevicePoolCompatibilityResult -> Maybe [IncompatibilityMessage]
incompatibilityMessages} -> Maybe [IncompatibilityMessage]
incompatibilityMessages) (\s :: DevicePoolCompatibilityResult
s@DevicePoolCompatibilityResult' {} Maybe [IncompatibilityMessage]
a -> DevicePoolCompatibilityResult
s {$sel:incompatibilityMessages:DevicePoolCompatibilityResult' :: Maybe [IncompatibilityMessage]
incompatibilityMessages = Maybe [IncompatibilityMessage]
a} :: DevicePoolCompatibilityResult) ((Maybe [IncompatibilityMessage]
  -> f (Maybe [IncompatibilityMessage]))
 -> DevicePoolCompatibilityResult
 -> f DevicePoolCompatibilityResult)
-> ((Maybe [IncompatibilityMessage]
     -> f (Maybe [IncompatibilityMessage]))
    -> Maybe [IncompatibilityMessage]
    -> f (Maybe [IncompatibilityMessage]))
-> (Maybe [IncompatibilityMessage]
    -> f (Maybe [IncompatibilityMessage]))
-> DevicePoolCompatibilityResult
-> f DevicePoolCompatibilityResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [IncompatibilityMessage]
  [IncompatibilityMessage]
  [IncompatibilityMessage]
  [IncompatibilityMessage]
-> Iso
     (Maybe [IncompatibilityMessage])
     (Maybe [IncompatibilityMessage])
     (Maybe [IncompatibilityMessage])
     (Maybe [IncompatibilityMessage])
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 AnIso
  [IncompatibilityMessage]
  [IncompatibilityMessage]
  [IncompatibilityMessage]
  [IncompatibilityMessage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON DevicePoolCompatibilityResult where
  parseJSON :: Value -> Parser DevicePoolCompatibilityResult
parseJSON =
    String
-> (Object -> Parser DevicePoolCompatibilityResult)
-> Value
-> Parser DevicePoolCompatibilityResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DevicePoolCompatibilityResult"
      ( \Object
x ->
          Maybe Device
-> Maybe Bool
-> Maybe [IncompatibilityMessage]
-> DevicePoolCompatibilityResult
DevicePoolCompatibilityResult'
            (Maybe Device
 -> Maybe Bool
 -> Maybe [IncompatibilityMessage]
 -> DevicePoolCompatibilityResult)
-> Parser (Maybe Device)
-> Parser
     (Maybe Bool
      -> Maybe [IncompatibilityMessage] -> DevicePoolCompatibilityResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Device)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"device")
            Parser
  (Maybe Bool
   -> Maybe [IncompatibilityMessage] -> DevicePoolCompatibilityResult)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [IncompatibilityMessage] -> DevicePoolCompatibilityResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"compatible")
            Parser
  (Maybe [IncompatibilityMessage] -> DevicePoolCompatibilityResult)
-> Parser (Maybe [IncompatibilityMessage])
-> Parser DevicePoolCompatibilityResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [IncompatibilityMessage]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"incompatibilityMessages"
                            Parser (Maybe (Maybe [IncompatibilityMessage]))
-> Maybe [IncompatibilityMessage]
-> Parser (Maybe [IncompatibilityMessage])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [IncompatibilityMessage]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance
  Prelude.Hashable
    DevicePoolCompatibilityResult

instance Prelude.NFData DevicePoolCompatibilityResult