{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE NoImplicitPrelude  #-}
{-# LANGUAGE OverloadedStrings  #-}
{-# LANGUAGE RecordWildCards    #-}

{-# OPTIONS_GHC -fno-warn-unused-binds   #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}

-- |
-- Module      : Network.Google.AndroidManagement.Types.Product
-- Copyright   : (c) 2015-2016 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.Google.AndroidManagement.Types.Product where

import           Network.Google.AndroidManagement.Types.Sum
import           Network.Google.Prelude

-- | The Status type defines a logical error model that is suitable for
-- different programming environments, including REST APIs and RPC APIs. It
-- is used by gRPC (https:\/\/github.com\/grpc). The error model is
-- designed to be: Simple to use and understand for most users Flexible
-- enough to meet unexpected needsOverviewThe Status message contains three
-- pieces of data: error code, error message, and error details. The error
-- code should be an enum value of google.rpc.Code, but it may accept
-- additional error codes if needed. The error message should be a
-- developer-facing English message that helps developers understand and
-- resolve the error. If a localized user-facing error message is needed,
-- put the localized message in the error details or localize it in the
-- client. The optional error details may contain arbitrary information
-- about the error. There is a predefined set of error detail types in the
-- package google.rpc that can be used for common error conditions.Language
-- mappingThe Status message is the logical representation of the error
-- model, but it is not necessarily the actual wire format. When the Status
-- message is exposed in different client libraries and different wire
-- protocols, it can be mapped differently. For example, it will likely be
-- mapped to some exceptions in Java, but more likely mapped to some error
-- codes in C.Other usesThe error model and the Status message can be used
-- in a variety of environments, either with or without APIs, to provide a
-- consistent developer experience across different environments.Example
-- uses of this error model include: Partial errors. If a service needs to
-- return partial errors to the client, it may embed the Status in the
-- normal response to indicate the partial errors. Workflow errors. A
-- typical workflow has multiple steps. Each step may have a Status message
-- for error reporting. Batch operations. If a client uses batch request
-- and batch response, the Status message should be used directly inside
-- batch response, one for each error sub-response. Asynchronous
-- operations. If an API call embeds asynchronous operation results in its
-- response, the status of those operations should be represented directly
-- using the Status message. Logging. If some API errors are stored in
-- logs, the message Status could be used directly after any stripping
-- needed for security\/privacy reasons.
--
-- /See:/ 'status' smart constructor.
data Status =
  Status'
    { _sDetails :: !(Maybe [StatusDetailsItem])
    , _sCode    :: !(Maybe (Textual Int32))
    , _sMessage :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Status' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sDetails'
--
-- * 'sCode'
--
-- * 'sMessage'
status
    :: Status
status = Status' {_sDetails = Nothing, _sCode = Nothing, _sMessage = Nothing}


-- | A list of messages that carry the error details. There is a common set
-- of message types for APIs to use.
sDetails :: Lens' Status [StatusDetailsItem]
sDetails
  = lens _sDetails (\ s a -> s{_sDetails = a}) .
      _Default
      . _Coerce

-- | The status code, which should be an enum value of google.rpc.Code.
sCode :: Lens' Status (Maybe Int32)
sCode
  = lens _sCode (\ s a -> s{_sCode = a}) .
      mapping _Coerce

-- | A developer-facing error message, which should be in English. Any
-- user-facing error message should be localized and sent in the
-- google.rpc.Status.details field, or localized by the client.
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})

instance FromJSON Status where
        parseJSON
          = withObject "Status"
              (\ o ->
                 Status' <$>
                   (o .:? "details" .!= mempty) <*> (o .:? "code") <*>
                     (o .:? "message"))

instance ToJSON Status where
        toJSON Status'{..}
          = object
              (catMaybes
                 [("details" .=) <$> _sDetails,
                  ("code" .=) <$> _sCode,
                  ("message" .=) <$> _sMessage])

-- | Response to a request to list policies for a given enterprise.
--
-- /See:/ 'listPoliciesResponse' smart constructor.
data ListPoliciesResponse =
  ListPoliciesResponse'
    { _lprNextPageToken :: !(Maybe Text)
    , _lprPolicies      :: !(Maybe [Policy])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ListPoliciesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lprNextPageToken'
--
-- * 'lprPolicies'
listPoliciesResponse
    :: ListPoliciesResponse
listPoliciesResponse =
  ListPoliciesResponse' {_lprNextPageToken = Nothing, _lprPolicies = Nothing}


-- | If there are more results, a token to retrieve next page of results.
lprNextPageToken :: Lens' ListPoliciesResponse (Maybe Text)
lprNextPageToken
  = lens _lprNextPageToken
      (\ s a -> s{_lprNextPageToken = a})

-- | The list of policies.
lprPolicies :: Lens' ListPoliciesResponse [Policy]
lprPolicies
  = lens _lprPolicies (\ s a -> s{_lprPolicies = a}) .
      _Default
      . _Coerce

instance FromJSON ListPoliciesResponse where
        parseJSON
          = withObject "ListPoliciesResponse"
              (\ o ->
                 ListPoliciesResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "policies" .!= mempty))

instance ToJSON ListPoliciesResponse where
        toJSON ListPoliciesResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _lprNextPageToken,
                  ("policies" .=) <$> _lprPolicies])

-- | Information about device memory and storage.
--
-- /See:/ 'memoryInfo' smart constructor.
data MemoryInfo =
  MemoryInfo'
    { _miTotalInternalStorage :: !(Maybe (Textual Int64))
    , _miTotalRam             :: !(Maybe (Textual Int64))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'MemoryInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'miTotalInternalStorage'
--
-- * 'miTotalRam'
memoryInfo
    :: MemoryInfo
memoryInfo =
  MemoryInfo' {_miTotalInternalStorage = Nothing, _miTotalRam = Nothing}


-- | Total internal storage on device in bytes.
miTotalInternalStorage :: Lens' MemoryInfo (Maybe Int64)
miTotalInternalStorage
  = lens _miTotalInternalStorage
      (\ s a -> s{_miTotalInternalStorage = a})
      . mapping _Coerce

-- | Total RAM on device in bytes.
miTotalRam :: Lens' MemoryInfo (Maybe Int64)
miTotalRam
  = lens _miTotalRam (\ s a -> s{_miTotalRam = a}) .
      mapping _Coerce

instance FromJSON MemoryInfo where
        parseJSON
          = withObject "MemoryInfo"
              (\ o ->
                 MemoryInfo' <$>
                   (o .:? "totalInternalStorage") <*>
                     (o .:? "totalRam"))

instance ToJSON MemoryInfo where
        toJSON MemoryInfo'{..}
          = object
              (catMaybes
                 [("totalInternalStorage" .=) <$>
                    _miTotalInternalStorage,
                  ("totalRam" .=) <$> _miTotalRam])

-- | A list of package names.
--
-- /See:/ 'packageNameList' smart constructor.
newtype PackageNameList =
  PackageNameList'
    { _pnlPackageNames :: Maybe [Text]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PackageNameList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pnlPackageNames'
packageNameList
    :: PackageNameList
packageNameList = PackageNameList' {_pnlPackageNames = Nothing}


-- | A list of package names.
pnlPackageNames :: Lens' PackageNameList [Text]
pnlPackageNames
  = lens _pnlPackageNames
      (\ s a -> s{_pnlPackageNames = a})
      . _Default
      . _Coerce

instance FromJSON PackageNameList where
        parseJSON
          = withObject "PackageNameList"
              (\ o ->
                 PackageNameList' <$>
                   (o .:? "packageNames" .!= mempty))

instance ToJSON PackageNameList where
        toJSON PackageNameList'{..}
          = object
              (catMaybes
                 [("packageNames" .=) <$> _pnlPackageNames])

-- | A command.
--
-- /See:/ 'command' smart constructor.
data Command =
  Command'
    { _cResetPasswordFlags :: !(Maybe [Text])
    , _cNewPassword        :: !(Maybe Text)
    , _cUserName           :: !(Maybe Text)
    , _cErrorCode          :: !(Maybe CommandErrorCode)
    , _cType               :: !(Maybe CommandType)
    , _cDuration           :: !(Maybe GDuration)
    , _cCreateTime         :: !(Maybe DateTime')
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Command' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cResetPasswordFlags'
--
-- * 'cNewPassword'
--
-- * 'cUserName'
--
-- * 'cErrorCode'
--
-- * 'cType'
--
-- * 'cDuration'
--
-- * 'cCreateTime'
command
    :: Command
command =
  Command'
    { _cResetPasswordFlags = Nothing
    , _cNewPassword = Nothing
    , _cUserName = Nothing
    , _cErrorCode = Nothing
    , _cType = Nothing
    , _cDuration = Nothing
    , _cCreateTime = Nothing
    }


-- | For commands of type RESET_PASSWORD, optionally specifies flags.
cResetPasswordFlags :: Lens' Command [Text]
cResetPasswordFlags
  = lens _cResetPasswordFlags
      (\ s a -> s{_cResetPasswordFlags = a})
      . _Default
      . _Coerce

-- | For commands of type RESET_PASSWORD, optionally specifies the new
-- password.
cNewPassword :: Lens' Command (Maybe Text)
cNewPassword
  = lens _cNewPassword (\ s a -> s{_cNewPassword = a})

-- | The resource name of the user that owns the device in the form
-- enterprises\/{enterpriseId}\/users\/{userId}. This is automatically
-- generated by the server based on the device the command is sent to.
cUserName :: Lens' Command (Maybe Text)
cUserName
  = lens _cUserName (\ s a -> s{_cUserName = a})

-- | If the command failed, an error code explaining the failure. This is not
-- set when the command is cancelled by the caller.
cErrorCode :: Lens' Command (Maybe CommandErrorCode)
cErrorCode
  = lens _cErrorCode (\ s a -> s{_cErrorCode = a})

-- | The type of the command.
cType :: Lens' Command (Maybe CommandType)
cType = lens _cType (\ s a -> s{_cType = a})

-- | The duration for which the command is valid. The command will expire if
-- not executed by the device during this time. The default duration if
-- unspecified is ten minutes. There is no maximum duration.
cDuration :: Lens' Command (Maybe Scientific)
cDuration
  = lens _cDuration (\ s a -> s{_cDuration = a}) .
      mapping _GDuration

-- | The timestamp at which the command was created. The timestamp is
-- automatically generated by the server.
cCreateTime :: Lens' Command (Maybe UTCTime)
cCreateTime
  = lens _cCreateTime (\ s a -> s{_cCreateTime = a}) .
      mapping _DateTime

instance FromJSON Command where
        parseJSON
          = withObject "Command"
              (\ o ->
                 Command' <$>
                   (o .:? "resetPasswordFlags" .!= mempty) <*>
                     (o .:? "newPassword")
                     <*> (o .:? "userName")
                     <*> (o .:? "errorCode")
                     <*> (o .:? "type")
                     <*> (o .:? "duration")
                     <*> (o .:? "createTime"))

instance ToJSON Command where
        toJSON Command'{..}
          = object
              (catMaybes
                 [("resetPasswordFlags" .=) <$> _cResetPasswordFlags,
                  ("newPassword" .=) <$> _cNewPassword,
                  ("userName" .=) <$> _cUserName,
                  ("errorCode" .=) <$> _cErrorCode,
                  ("type" .=) <$> _cType,
                  ("duration" .=) <$> _cDuration,
                  ("createTime" .=) <$> _cCreateTime])

-- | The response message for Operations.ListOperations.
--
-- /See:/ 'listOperationsResponse' smart constructor.
data ListOperationsResponse =
  ListOperationsResponse'
    { _lorNextPageToken :: !(Maybe Text)
    , _lorOperations    :: !(Maybe [Operation])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ListOperationsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lorNextPageToken'
--
-- * 'lorOperations'
listOperationsResponse
    :: ListOperationsResponse
listOperationsResponse =
  ListOperationsResponse'
    {_lorNextPageToken = Nothing, _lorOperations = Nothing}


-- | The standard List next-page token.
lorNextPageToken :: Lens' ListOperationsResponse (Maybe Text)
lorNextPageToken
  = lens _lorNextPageToken
      (\ s a -> s{_lorNextPageToken = a})

-- | A list of operations that matches the specified filter in the request.
lorOperations :: Lens' ListOperationsResponse [Operation]
lorOperations
  = lens _lorOperations
      (\ s a -> s{_lorOperations = a})
      . _Default
      . _Coerce

instance FromJSON ListOperationsResponse where
        parseJSON
          = withObject "ListOperationsResponse"
              (\ o ->
                 ListOperationsResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "operations" .!= mempty))

instance ToJSON ListOperationsResponse where
        toJSON ListOperationsResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _lorNextPageToken,
                  ("operations" .=) <$> _lorOperations])

-- | Device display information.
--
-- /See:/ 'display' smart constructor.
data Display =
  Display'
    { _dHeight      :: !(Maybe (Textual Int32))
    , _dState       :: !(Maybe DisplayState)
    , _dWidth       :: !(Maybe (Textual Int32))
    , _dName        :: !(Maybe Text)
    , _dRefreshRate :: !(Maybe (Textual Int32))
    , _dDisplayId   :: !(Maybe (Textual Int32))
    , _dDensity     :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Display' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dHeight'
--
-- * 'dState'
--
-- * 'dWidth'
--
-- * 'dName'
--
-- * 'dRefreshRate'
--
-- * 'dDisplayId'
--
-- * 'dDensity'
display
    :: Display
display =
  Display'
    { _dHeight = Nothing
    , _dState = Nothing
    , _dWidth = Nothing
    , _dName = Nothing
    , _dRefreshRate = Nothing
    , _dDisplayId = Nothing
    , _dDensity = Nothing
    }


-- | Display height in pixels.
dHeight :: Lens' Display (Maybe Int32)
dHeight
  = lens _dHeight (\ s a -> s{_dHeight = a}) .
      mapping _Coerce

-- | State of the display.
dState :: Lens' Display (Maybe DisplayState)
dState = lens _dState (\ s a -> s{_dState = a})

-- | Display width in pixels.
dWidth :: Lens' Display (Maybe Int32)
dWidth
  = lens _dWidth (\ s a -> s{_dWidth = a}) .
      mapping _Coerce

-- | Name of the display.
dName :: Lens' Display (Maybe Text)
dName = lens _dName (\ s a -> s{_dName = a})

-- | Refresh rate of the display in frames per second.
dRefreshRate :: Lens' Display (Maybe Int32)
dRefreshRate
  = lens _dRefreshRate (\ s a -> s{_dRefreshRate = a})
      . mapping _Coerce

-- | Unique display id.
dDisplayId :: Lens' Display (Maybe Int32)
dDisplayId
  = lens _dDisplayId (\ s a -> s{_dDisplayId = a}) .
      mapping _Coerce

-- | Display density expressed as dots-per-inch.
dDensity :: Lens' Display (Maybe Int32)
dDensity
  = lens _dDensity (\ s a -> s{_dDensity = a}) .
      mapping _Coerce

instance FromJSON Display where
        parseJSON
          = withObject "Display"
              (\ o ->
                 Display' <$>
                   (o .:? "height") <*> (o .:? "state") <*>
                     (o .:? "width")
                     <*> (o .:? "name")
                     <*> (o .:? "refreshRate")
                     <*> (o .:? "displayId")
                     <*> (o .:? "density"))

instance ToJSON Display where
        toJSON Display'{..}
          = object
              (catMaybes
                 [("height" .=) <$> _dHeight,
                  ("state" .=) <$> _dState, ("width" .=) <$> _dWidth,
                  ("name" .=) <$> _dName,
                  ("refreshRate" .=) <$> _dRefreshRate,
                  ("displayId" .=) <$> _dDisplayId,
                  ("density" .=) <$> _dDensity])

-- | Configuration for an always-on VPN connection.
--
-- /See:/ 'alwaysOnVPNPackage' smart constructor.
data AlwaysOnVPNPackage =
  AlwaysOnVPNPackage'
    { _aovpLockdownEnabled :: !(Maybe Bool)
    , _aovpPackageName     :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AlwaysOnVPNPackage' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aovpLockdownEnabled'
--
-- * 'aovpPackageName'
alwaysOnVPNPackage
    :: AlwaysOnVPNPackage
alwaysOnVPNPackage =
  AlwaysOnVPNPackage'
    {_aovpLockdownEnabled = Nothing, _aovpPackageName = Nothing}


-- | Disallows networking when the VPN is not connected.
aovpLockdownEnabled :: Lens' AlwaysOnVPNPackage (Maybe Bool)
aovpLockdownEnabled
  = lens _aovpLockdownEnabled
      (\ s a -> s{_aovpLockdownEnabled = a})

-- | The package name of the VPN app.
aovpPackageName :: Lens' AlwaysOnVPNPackage (Maybe Text)
aovpPackageName
  = lens _aovpPackageName
      (\ s a -> s{_aovpPackageName = a})

instance FromJSON AlwaysOnVPNPackage where
        parseJSON
          = withObject "AlwaysOnVPNPackage"
              (\ o ->
                 AlwaysOnVPNPackage' <$>
                   (o .:? "lockdownEnabled") <*> (o .:? "packageName"))

instance ToJSON AlwaysOnVPNPackage where
        toJSON AlwaysOnVPNPackage'{..}
          = object
              (catMaybes
                 [("lockdownEnabled" .=) <$> _aovpLockdownEnabled,
                  ("packageName" .=) <$> _aovpPackageName])

-- | Network configuration for the device. See configure networks for more
-- information.
--
-- /See:/ 'policyOpenNetworkConfiguration' smart constructor.
newtype PolicyOpenNetworkConfiguration =
  PolicyOpenNetworkConfiguration'
    { _poncAddtional :: HashMap Text JSONValue
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PolicyOpenNetworkConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'poncAddtional'
policyOpenNetworkConfiguration
    :: HashMap Text JSONValue -- ^ 'poncAddtional'
    -> PolicyOpenNetworkConfiguration
policyOpenNetworkConfiguration pPoncAddtional_ =
  PolicyOpenNetworkConfiguration' {_poncAddtional = _Coerce # pPoncAddtional_}


-- | Properties of the object.
poncAddtional :: Lens' PolicyOpenNetworkConfiguration (HashMap Text JSONValue)
poncAddtional
  = lens _poncAddtional
      (\ s a -> s{_poncAddtional = a})
      . _Coerce

instance FromJSON PolicyOpenNetworkConfiguration
         where
        parseJSON
          = withObject "PolicyOpenNetworkConfiguration"
              (\ o ->
                 PolicyOpenNetworkConfiguration' <$>
                   (parseJSONObject o))

instance ToJSON PolicyOpenNetworkConfiguration where
        toJSON = toJSON . _poncAddtional

-- | An action to launch an app.
--
-- /See:/ 'launchAppAction' smart constructor.
newtype LaunchAppAction =
  LaunchAppAction'
    { _laaPackageName :: Maybe Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'LaunchAppAction' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'laaPackageName'
launchAppAction
    :: LaunchAppAction
launchAppAction = LaunchAppAction' {_laaPackageName = Nothing}


-- | Package name of app to be launched
laaPackageName :: Lens' LaunchAppAction (Maybe Text)
laaPackageName
  = lens _laaPackageName
      (\ s a -> s{_laaPackageName = a})

instance FromJSON LaunchAppAction where
        parseJSON
          = withObject "LaunchAppAction"
              (\ o -> LaunchAppAction' <$> (o .:? "packageName"))

instance ToJSON LaunchAppAction where
        toJSON LaunchAppAction'{..}
          = object
              (catMaybes [("packageName" .=) <$> _laaPackageName])

-- | Hardware status. Temperatures may be compared to the temperature
-- thresholds available in hardwareInfo to determine hardware health.
--
-- /See:/ 'hardwareStatus' smart constructor.
data HardwareStatus =
  HardwareStatus'
    { _hsCPUTemperatures     :: !(Maybe [Textual Double])
    , _hsBatteryTemperatures :: !(Maybe [Textual Double])
    , _hsGpuTemperatures     :: !(Maybe [Textual Double])
    , _hsFanSpeeds           :: !(Maybe [Textual Double])
    , _hsSkinTemperatures    :: !(Maybe [Textual Double])
    , _hsCPUUsages           :: !(Maybe [Textual Double])
    , _hsCreateTime          :: !(Maybe DateTime')
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'HardwareStatus' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'hsCPUTemperatures'
--
-- * 'hsBatteryTemperatures'
--
-- * 'hsGpuTemperatures'
--
-- * 'hsFanSpeeds'
--
-- * 'hsSkinTemperatures'
--
-- * 'hsCPUUsages'
--
-- * 'hsCreateTime'
hardwareStatus
    :: HardwareStatus
hardwareStatus =
  HardwareStatus'
    { _hsCPUTemperatures = Nothing
    , _hsBatteryTemperatures = Nothing
    , _hsGpuTemperatures = Nothing
    , _hsFanSpeeds = Nothing
    , _hsSkinTemperatures = Nothing
    , _hsCPUUsages = Nothing
    , _hsCreateTime = Nothing
    }


-- | Current CPU temperatures in Celsius for each CPU on the device.
hsCPUTemperatures :: Lens' HardwareStatus [Double]
hsCPUTemperatures
  = lens _hsCPUTemperatures
      (\ s a -> s{_hsCPUTemperatures = a})
      . _Default
      . _Coerce

-- | Current battery temperatures in Celsius for each battery on the device.
hsBatteryTemperatures :: Lens' HardwareStatus [Double]
hsBatteryTemperatures
  = lens _hsBatteryTemperatures
      (\ s a -> s{_hsBatteryTemperatures = a})
      . _Default
      . _Coerce

-- | Current GPU temperatures in Celsius for each GPU on the device.
hsGpuTemperatures :: Lens' HardwareStatus [Double]
hsGpuTemperatures
  = lens _hsGpuTemperatures
      (\ s a -> s{_hsGpuTemperatures = a})
      . _Default
      . _Coerce

-- | Fan speeds in RPM for each fan on the device. Empty array means that
-- there are no fans or fan speed is not supported on the system.
hsFanSpeeds :: Lens' HardwareStatus [Double]
hsFanSpeeds
  = lens _hsFanSpeeds (\ s a -> s{_hsFanSpeeds = a}) .
      _Default
      . _Coerce

-- | Current device skin temperatures in Celsius.
hsSkinTemperatures :: Lens' HardwareStatus [Double]
hsSkinTemperatures
  = lens _hsSkinTemperatures
      (\ s a -> s{_hsSkinTemperatures = a})
      . _Default
      . _Coerce

-- | CPU usages in percentage for each core available on the device. Usage is
-- 0 for each unplugged core. Empty array implies that CPU usage is not
-- supported in the system.
hsCPUUsages :: Lens' HardwareStatus [Double]
hsCPUUsages
  = lens _hsCPUUsages (\ s a -> s{_hsCPUUsages = a}) .
      _Default
      . _Coerce

-- | The time the measurements were taken.
hsCreateTime :: Lens' HardwareStatus (Maybe UTCTime)
hsCreateTime
  = lens _hsCreateTime (\ s a -> s{_hsCreateTime = a})
      . mapping _DateTime

instance FromJSON HardwareStatus where
        parseJSON
          = withObject "HardwareStatus"
              (\ o ->
                 HardwareStatus' <$>
                   (o .:? "cpuTemperatures" .!= mempty) <*>
                     (o .:? "batteryTemperatures" .!= mempty)
                     <*> (o .:? "gpuTemperatures" .!= mempty)
                     <*> (o .:? "fanSpeeds" .!= mempty)
                     <*> (o .:? "skinTemperatures" .!= mempty)
                     <*> (o .:? "cpuUsages" .!= mempty)
                     <*> (o .:? "createTime"))

instance ToJSON HardwareStatus where
        toJSON HardwareStatus'{..}
          = object
              (catMaybes
                 [("cpuTemperatures" .=) <$> _hsCPUTemperatures,
                  ("batteryTemperatures" .=) <$>
                    _hsBatteryTemperatures,
                  ("gpuTemperatures" .=) <$> _hsGpuTemperatures,
                  ("fanSpeeds" .=) <$> _hsFanSpeeds,
                  ("skinTemperatures" .=) <$> _hsSkinTemperatures,
                  ("cpuUsages" .=) <$> _hsCPUUsages,
                  ("createTime" .=) <$> _hsCreateTime])

-- | Information about an app.
--
-- /See:/ 'application' smart constructor.
data Application =
  Application'
    { _aManagedProperties :: !(Maybe [ManagedProperty])
    , _aName              :: !(Maybe Text)
    , _aPermissions       :: !(Maybe [ApplicationPermission])
    , _aTitle             :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Application' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aManagedProperties'
--
-- * 'aName'
--
-- * 'aPermissions'
--
-- * 'aTitle'
application
    :: Application
application =
  Application'
    { _aManagedProperties = Nothing
    , _aName = Nothing
    , _aPermissions = Nothing
    , _aTitle = Nothing
    }


-- | The set of managed properties available to be pre-configured for the
-- app.
aManagedProperties :: Lens' Application [ManagedProperty]
aManagedProperties
  = lens _aManagedProperties
      (\ s a -> s{_aManagedProperties = a})
      . _Default
      . _Coerce

-- | The name of the app in the form
-- enterprises\/{enterpriseId}\/applications\/{package_name}.
aName :: Lens' Application (Maybe Text)
aName = lens _aName (\ s a -> s{_aName = a})

-- | The permissions required by the app.
aPermissions :: Lens' Application [ApplicationPermission]
aPermissions
  = lens _aPermissions (\ s a -> s{_aPermissions = a})
      . _Default
      . _Coerce

-- | The title of the app. Localized.
aTitle :: Lens' Application (Maybe Text)
aTitle = lens _aTitle (\ s a -> s{_aTitle = a})

instance FromJSON Application where
        parseJSON
          = withObject "Application"
              (\ o ->
                 Application' <$>
                   (o .:? "managedProperties" .!= mempty) <*>
                     (o .:? "name")
                     <*> (o .:? "permissions" .!= mempty)
                     <*> (o .:? "title"))

instance ToJSON Application where
        toJSON Application'{..}
          = object
              (catMaybes
                 [("managedProperties" .=) <$> _aManagedProperties,
                  ("name" .=) <$> _aName,
                  ("permissions" .=) <$> _aPermissions,
                  ("title" .=) <$> _aTitle])

-- | Managed property.
--
-- /See:/ 'managedProperty' smart constructor.
data ManagedProperty =
  ManagedProperty'
    { _mpEntries          :: !(Maybe [ManagedPropertyEntry])
    , _mpNestedProperties :: !(Maybe [ManagedProperty])
    , _mpKey              :: !(Maybe Text)
    , _mpDefaultValue     :: !(Maybe JSONValue)
    , _mpTitle            :: !(Maybe Text)
    , _mpType             :: !(Maybe ManagedPropertyType)
    , _mpDescription      :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ManagedProperty' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mpEntries'
--
-- * 'mpNestedProperties'
--
-- * 'mpKey'
--
-- * 'mpDefaultValue'
--
-- * 'mpTitle'
--
-- * 'mpType'
--
-- * 'mpDescription'
managedProperty
    :: ManagedProperty
managedProperty =
  ManagedProperty'
    { _mpEntries = Nothing
    , _mpNestedProperties = Nothing
    , _mpKey = Nothing
    , _mpDefaultValue = Nothing
    , _mpTitle = Nothing
    , _mpType = Nothing
    , _mpDescription = Nothing
    }


-- | For CHOICE or MULTISELECT properties, the list of possible entries.
mpEntries :: Lens' ManagedProperty [ManagedPropertyEntry]
mpEntries
  = lens _mpEntries (\ s a -> s{_mpEntries = a}) .
      _Default
      . _Coerce

-- | For BUNDLE_ARRAY properties, the list of nested properties. A
-- BUNDLE_ARRAY property is at most two levels deep.
mpNestedProperties :: Lens' ManagedProperty [ManagedProperty]
mpNestedProperties
  = lens _mpNestedProperties
      (\ s a -> s{_mpNestedProperties = a})
      . _Default
      . _Coerce

-- | The unique key that the app uses to identify the property, e.g.
-- \"com.google.android.gm.fieldname\".
mpKey :: Lens' ManagedProperty (Maybe Text)
mpKey = lens _mpKey (\ s a -> s{_mpKey = a})

-- | The default value of the property. BUNDLE_ARRAY properties don\'t have a
-- default value.
mpDefaultValue :: Lens' ManagedProperty (Maybe JSONValue)
mpDefaultValue
  = lens _mpDefaultValue
      (\ s a -> s{_mpDefaultValue = a})

-- | The name of the property. Localized.
mpTitle :: Lens' ManagedProperty (Maybe Text)
mpTitle = lens _mpTitle (\ s a -> s{_mpTitle = a})

-- | The type of the property.
mpType :: Lens' ManagedProperty (Maybe ManagedPropertyType)
mpType = lens _mpType (\ s a -> s{_mpType = a})

-- | A longer description of the property, providing more detail of what it
-- affects. Localized.
mpDescription :: Lens' ManagedProperty (Maybe Text)
mpDescription
  = lens _mpDescription
      (\ s a -> s{_mpDescription = a})

instance FromJSON ManagedProperty where
        parseJSON
          = withObject "ManagedProperty"
              (\ o ->
                 ManagedProperty' <$>
                   (o .:? "entries" .!= mempty) <*>
                     (o .:? "nestedProperties" .!= mempty)
                     <*> (o .:? "key")
                     <*> (o .:? "defaultValue")
                     <*> (o .:? "title")
                     <*> (o .:? "type")
                     <*> (o .:? "description"))

instance ToJSON ManagedProperty where
        toJSON ManagedProperty'{..}
          = object
              (catMaybes
                 [("entries" .=) <$> _mpEntries,
                  ("nestedProperties" .=) <$> _mpNestedProperties,
                  ("key" .=) <$> _mpKey,
                  ("defaultValue" .=) <$> _mpDefaultValue,
                  ("title" .=) <$> _mpTitle, ("type" .=) <$> _mpType,
                  ("description" .=) <$> _mpDescription])

-- | Configuration info for an HTTP proxy. For a direct proxy, set the host,
-- port, and excluded_hosts fields. For a PAC script proxy, set the pac_uri
-- field.
--
-- /See:/ 'proxyInfo' smart constructor.
data ProxyInfo =
  ProxyInfo'
    { _piPacURI        :: !(Maybe Text)
    , _piHost          :: !(Maybe Text)
    , _piExcludedHosts :: !(Maybe [Text])
    , _piPort          :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ProxyInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'piPacURI'
--
-- * 'piHost'
--
-- * 'piExcludedHosts'
--
-- * 'piPort'
proxyInfo
    :: ProxyInfo
proxyInfo =
  ProxyInfo'
    { _piPacURI = Nothing
    , _piHost = Nothing
    , _piExcludedHosts = Nothing
    , _piPort = Nothing
    }


-- | The URI of the PAC script used to configure the proxy.
piPacURI :: Lens' ProxyInfo (Maybe Text)
piPacURI = lens _piPacURI (\ s a -> s{_piPacURI = a})

-- | The host of the direct proxy.
piHost :: Lens' ProxyInfo (Maybe Text)
piHost = lens _piHost (\ s a -> s{_piHost = a})

-- | For a direct proxy, the hosts for which the proxy is bypassed. The host
-- names may contain wildcards such as *.example.com.
piExcludedHosts :: Lens' ProxyInfo [Text]
piExcludedHosts
  = lens _piExcludedHosts
      (\ s a -> s{_piExcludedHosts = a})
      . _Default
      . _Coerce

-- | The port of the direct proxy.
piPort :: Lens' ProxyInfo (Maybe Int32)
piPort
  = lens _piPort (\ s a -> s{_piPort = a}) .
      mapping _Coerce

instance FromJSON ProxyInfo where
        parseJSON
          = withObject "ProxyInfo"
              (\ o ->
                 ProxyInfo' <$>
                   (o .:? "pacUri") <*> (o .:? "host") <*>
                     (o .:? "excludedHosts" .!= mempty)
                     <*> (o .:? "port"))

instance ToJSON ProxyInfo where
        toJSON ProxyInfo'{..}
          = object
              (catMaybes
                 [("pacUri" .=) <$> _piPacURI,
                  ("host" .=) <$> _piHost,
                  ("excludedHosts" .=) <$> _piExcludedHosts,
                  ("port" .=) <$> _piPort])

-- | A default activity for handling intents that match a particular intent
-- filter.
--
-- /See:/ 'persistentPreferredActivity' smart constructor.
data PersistentPreferredActivity =
  PersistentPreferredActivity'
    { _ppaActions          :: !(Maybe [Text])
    , _ppaCategories       :: !(Maybe [Text])
    , _ppaReceiverActivity :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PersistentPreferredActivity' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ppaActions'
--
-- * 'ppaCategories'
--
-- * 'ppaReceiverActivity'
persistentPreferredActivity
    :: PersistentPreferredActivity
persistentPreferredActivity =
  PersistentPreferredActivity'
    { _ppaActions = Nothing
    , _ppaCategories = Nothing
    , _ppaReceiverActivity = Nothing
    }


-- | The intent actions to match in the filter. If any actions are included
-- in the filter, then an intent\'s action must be one of those values for
-- it to match. If no actions are included, the intent action is ignored.
ppaActions :: Lens' PersistentPreferredActivity [Text]
ppaActions
  = lens _ppaActions (\ s a -> s{_ppaActions = a}) .
      _Default
      . _Coerce

-- | The intent categories to match in the filter. An intent includes the
-- categories that it requires, all of which must be included in the filter
-- in order to match. In other words, adding a category to the filter has
-- no impact on matching unless that category is specified in the intent.
ppaCategories :: Lens' PersistentPreferredActivity [Text]
ppaCategories
  = lens _ppaCategories
      (\ s a -> s{_ppaCategories = a})
      . _Default
      . _Coerce

-- | The activity that should be the default intent handler. This should be
-- an Android component name, e.g.
-- com.android.enterprise.app\/.MainActivity. Alternatively, the value may
-- be the package name of an app, which causes Android Device Policy to
-- choose an appropriate activity from the app to handle the intent.
ppaReceiverActivity :: Lens' PersistentPreferredActivity (Maybe Text)
ppaReceiverActivity
  = lens _ppaReceiverActivity
      (\ s a -> s{_ppaReceiverActivity = a})

instance FromJSON PersistentPreferredActivity where
        parseJSON
          = withObject "PersistentPreferredActivity"
              (\ o ->
                 PersistentPreferredActivity' <$>
                   (o .:? "actions" .!= mempty) <*>
                     (o .:? "categories" .!= mempty)
                     <*> (o .:? "receiverActivity"))

instance ToJSON PersistentPreferredActivity where
        toJSON PersistentPreferredActivity'{..}
          = object
              (catMaybes
                 [("actions" .=) <$> _ppaActions,
                  ("categories" .=) <$> _ppaCategories,
                  ("receiverActivity" .=) <$> _ppaReceiverActivity])

-- | This resource represents a long-running operation that is the result of
-- a network API call.
--
-- /See:/ 'operation' smart constructor.
data Operation =
  Operation'
    { _oDone     :: !(Maybe Bool)
    , _oError    :: !(Maybe Status)
    , _oResponse :: !(Maybe OperationResponse)
    , _oName     :: !(Maybe Text)
    , _oMetadata :: !(Maybe OperationMetadata)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Operation' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'oDone'
--
-- * 'oError'
--
-- * 'oResponse'
--
-- * 'oName'
--
-- * 'oMetadata'
operation
    :: Operation
operation =
  Operation'
    { _oDone = Nothing
    , _oError = Nothing
    , _oResponse = Nothing
    , _oName = Nothing
    , _oMetadata = Nothing
    }


-- | If the value is false, it means the operation is still in progress. If
-- true, the operation is completed, and either error or response is
-- available.
oDone :: Lens' Operation (Maybe Bool)
oDone = lens _oDone (\ s a -> s{_oDone = a})

-- | The error result of the operation in case of failure or cancellation.
oError :: Lens' Operation (Maybe Status)
oError = lens _oError (\ s a -> s{_oError = a})

-- | The normal response of the operation in case of success. If the original
-- method returns no data on success, such as Delete, the response is
-- google.protobuf.Empty. If the original method is standard
-- Get\/Create\/Update, the response should be the resource. For other
-- methods, the response should have the type XxxResponse, where Xxx is the
-- original method name. For example, if the original method name is
-- TakeSnapshot(), the inferred response type is TakeSnapshotResponse.
oResponse :: Lens' Operation (Maybe OperationResponse)
oResponse
  = lens _oResponse (\ s a -> s{_oResponse = a})

-- | The server-assigned name, which is only unique within the same service
-- that originally returns it. If you use the default HTTP mapping, the
-- name should have the format of operations\/some\/unique\/name.
oName :: Lens' Operation (Maybe Text)
oName = lens _oName (\ s a -> s{_oName = a})

-- | Service-specific metadata associated with the operation. It typically
-- contains progress information and common metadata such as create time.
-- Some services might not provide such metadata. Any method that returns a
-- long-running operation should document the metadata type, if any.
oMetadata :: Lens' Operation (Maybe OperationMetadata)
oMetadata
  = lens _oMetadata (\ s a -> s{_oMetadata = a})

instance FromJSON Operation where
        parseJSON
          = withObject "Operation"
              (\ o ->
                 Operation' <$>
                   (o .:? "done") <*> (o .:? "error") <*>
                     (o .:? "response")
                     <*> (o .:? "name")
                     <*> (o .:? "metadata"))

instance ToJSON Operation where
        toJSON Operation'{..}
          = object
              (catMaybes
                 [("done" .=) <$> _oDone, ("error" .=) <$> _oError,
                  ("response" .=) <$> _oResponse,
                  ("name" .=) <$> _oName,
                  ("metadata" .=) <$> _oMetadata])

-- | A generic empty message that you can re-use to avoid defining duplicated
-- empty messages in your APIs. A typical example is to use it as the
-- request or the response type of an API method. For instance: service Foo
-- { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The
-- JSON representation for Empty is empty JSON object {}.
--
-- /See:/ 'empty' smart constructor.
data Empty =
  Empty'
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Empty' with the minimum fields required to make a request.
--
empty
    :: Empty
empty = Empty'


instance FromJSON Empty where
        parseJSON = withObject "Empty" (\ o -> pure Empty')

instance ToJSON Empty where
        toJSON = const emptyObject

-- | Data hosted at an external location. The data is to be downloaded by
-- Android Device Policy and verified against the hash.
--
-- /See:/ 'externalData' smart constructor.
data ExternalData =
  ExternalData'
    { _edURL        :: !(Maybe Text)
    , _edSha256Hash :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ExternalData' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'edURL'
--
-- * 'edSha256Hash'
externalData
    :: ExternalData
externalData = ExternalData' {_edURL = Nothing, _edSha256Hash = Nothing}


-- | The absolute URL to the data, which must use either the http or https
-- scheme. Android Device Policy doesn\'t provide any credentials in the
-- GET request, so the URL must be publicly accessible. Including a long,
-- random component in the URL may be used to prevent attackers from
-- discovering the URL.
edURL :: Lens' ExternalData (Maybe Text)
edURL = lens _edURL (\ s a -> s{_edURL = a})

-- | The base-64 encoded SHA-256 hash of the content hosted at url. If the
-- content doesn\'t match this hash, Android Device Policy won\'t use the
-- data.
edSha256Hash :: Lens' ExternalData (Maybe Text)
edSha256Hash
  = lens _edSha256Hash (\ s a -> s{_edSha256Hash = a})

instance FromJSON ExternalData where
        parseJSON
          = withObject "ExternalData"
              (\ o ->
                 ExternalData' <$>
                   (o .:? "url") <*> (o .:? "sha256Hash"))

instance ToJSON ExternalData where
        toJSON ExternalData'{..}
          = object
              (catMaybes
                 [("url" .=) <$> _edURL,
                  ("sha256Hash" .=) <$> _edSha256Hash])

-- | A compliance rule condition which is satisfied if the Android Framework
-- API level on the device doesn\'t meet a minimum requirement. There can
-- only be one rule with this type of condition per policy.
--
-- /See:/ 'apiLevelCondition' smart constructor.
newtype APILevelCondition =
  APILevelCondition'
    { _alcMinAPILevel :: Maybe (Textual Int32)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'APILevelCondition' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'alcMinAPILevel'
apiLevelCondition
    :: APILevelCondition
apiLevelCondition = APILevelCondition' {_alcMinAPILevel = Nothing}


-- | The minimum desired Android Framework API level. If the device doesn\'t
-- meet the minimum requirement, this condition is satisfied. Must be
-- greater than zero.
alcMinAPILevel :: Lens' APILevelCondition (Maybe Int32)
alcMinAPILevel
  = lens _alcMinAPILevel
      (\ s a -> s{_alcMinAPILevel = a})
      . mapping _Coerce

instance FromJSON APILevelCondition where
        parseJSON
          = withObject "APILevelCondition"
              (\ o -> APILevelCondition' <$> (o .:? "minApiLevel"))

instance ToJSON APILevelCondition where
        toJSON APILevelCondition'{..}
          = object
              (catMaybes [("minApiLevel" .=) <$> _alcMinAPILevel])

-- | Information about security related device settings on device.
--
-- /See:/ 'deviceSettings' smart constructor.
data DeviceSettings =
  DeviceSettings'
    { _dsIsEncrypted                :: !(Maybe Bool)
    , _dsAdbEnabled                 :: !(Maybe Bool)
    , _dsIsDeviceSecure             :: !(Maybe Bool)
    , _dsVerifyAppsEnabled          :: !(Maybe Bool)
    , _dsDevelopmentSettingsEnabled :: !(Maybe Bool)
    , _dsEncryptionStatus           :: !(Maybe DeviceSettingsEncryptionStatus)
    , _dsUnknownSourcesEnabled      :: !(Maybe Bool)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DeviceSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsIsEncrypted'
--
-- * 'dsAdbEnabled'
--
-- * 'dsIsDeviceSecure'
--
-- * 'dsVerifyAppsEnabled'
--
-- * 'dsDevelopmentSettingsEnabled'
--
-- * 'dsEncryptionStatus'
--
-- * 'dsUnknownSourcesEnabled'
deviceSettings
    :: DeviceSettings
deviceSettings =
  DeviceSettings'
    { _dsIsEncrypted = Nothing
    , _dsAdbEnabled = Nothing
    , _dsIsDeviceSecure = Nothing
    , _dsVerifyAppsEnabled = Nothing
    , _dsDevelopmentSettingsEnabled = Nothing
    , _dsEncryptionStatus = Nothing
    , _dsUnknownSourcesEnabled = Nothing
    }


-- | Whether the storage encryption is enabled.
dsIsEncrypted :: Lens' DeviceSettings (Maybe Bool)
dsIsEncrypted
  = lens _dsIsEncrypted
      (\ s a -> s{_dsIsEncrypted = a})

-- | Whether ADB
-- (https:\/\/developer.android.com\/studio\/command-line\/adb.html) is
-- enabled on the device.
dsAdbEnabled :: Lens' DeviceSettings (Maybe Bool)
dsAdbEnabled
  = lens _dsAdbEnabled (\ s a -> s{_dsAdbEnabled = a})

-- | Whether the device is secured with PIN\/password.
dsIsDeviceSecure :: Lens' DeviceSettings (Maybe Bool)
dsIsDeviceSecure
  = lens _dsIsDeviceSecure
      (\ s a -> s{_dsIsDeviceSecure = a})

-- | Whether Verify Apps (Google Play Protect
-- (https:\/\/support.google.com\/googleplay\/answer\/2812853)) is enabled
-- on the device.
dsVerifyAppsEnabled :: Lens' DeviceSettings (Maybe Bool)
dsVerifyAppsEnabled
  = lens _dsVerifyAppsEnabled
      (\ s a -> s{_dsVerifyAppsEnabled = a})

-- | Whether developer mode is enabled on the device.
dsDevelopmentSettingsEnabled :: Lens' DeviceSettings (Maybe Bool)
dsDevelopmentSettingsEnabled
  = lens _dsDevelopmentSettingsEnabled
      (\ s a -> s{_dsDevelopmentSettingsEnabled = a})

-- | Encryption status from DevicePolicyManager.
dsEncryptionStatus :: Lens' DeviceSettings (Maybe DeviceSettingsEncryptionStatus)
dsEncryptionStatus
  = lens _dsEncryptionStatus
      (\ s a -> s{_dsEncryptionStatus = a})

-- | Whether installing apps from unknown sources is enabled.
dsUnknownSourcesEnabled :: Lens' DeviceSettings (Maybe Bool)
dsUnknownSourcesEnabled
  = lens _dsUnknownSourcesEnabled
      (\ s a -> s{_dsUnknownSourcesEnabled = a})

instance FromJSON DeviceSettings where
        parseJSON
          = withObject "DeviceSettings"
              (\ o ->
                 DeviceSettings' <$>
                   (o .:? "isEncrypted") <*> (o .:? "adbEnabled") <*>
                     (o .:? "isDeviceSecure")
                     <*> (o .:? "verifyAppsEnabled")
                     <*> (o .:? "developmentSettingsEnabled")
                     <*> (o .:? "encryptionStatus")
                     <*> (o .:? "unknownSourcesEnabled"))

instance ToJSON DeviceSettings where
        toJSON DeviceSettings'{..}
          = object
              (catMaybes
                 [("isEncrypted" .=) <$> _dsIsEncrypted,
                  ("adbEnabled" .=) <$> _dsAdbEnabled,
                  ("isDeviceSecure" .=) <$> _dsIsDeviceSecure,
                  ("verifyAppsEnabled" .=) <$> _dsVerifyAppsEnabled,
                  ("developmentSettingsEnabled" .=) <$>
                    _dsDevelopmentSettingsEnabled,
                  ("encryptionStatus" .=) <$> _dsEncryptionStatus,
                  ("unknownSourcesEnabled" .=) <$>
                    _dsUnknownSourcesEnabled])

-- | Optional, a map containing configuration variables defined for the
-- configuration.
--
-- /See:/ 'managedConfigurationTemplateConfigurationVariables' smart constructor.
newtype ManagedConfigurationTemplateConfigurationVariables =
  ManagedConfigurationTemplateConfigurationVariables'
    { _mctcvAddtional :: HashMap Text Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ManagedConfigurationTemplateConfigurationVariables' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mctcvAddtional'
managedConfigurationTemplateConfigurationVariables
    :: HashMap Text Text -- ^ 'mctcvAddtional'
    -> ManagedConfigurationTemplateConfigurationVariables
managedConfigurationTemplateConfigurationVariables pMctcvAddtional_ =
  ManagedConfigurationTemplateConfigurationVariables'
    {_mctcvAddtional = _Coerce # pMctcvAddtional_}


mctcvAddtional :: Lens' ManagedConfigurationTemplateConfigurationVariables (HashMap Text Text)
mctcvAddtional
  = lens _mctcvAddtional
      (\ s a -> s{_mctcvAddtional = a})
      . _Coerce

instance FromJSON
           ManagedConfigurationTemplateConfigurationVariables
         where
        parseJSON
          = withObject
              "ManagedConfigurationTemplateConfigurationVariables"
              (\ o ->
                 ManagedConfigurationTemplateConfigurationVariables'
                   <$> (parseJSONObject o))

instance ToJSON
           ManagedConfigurationTemplateConfigurationVariables
         where
        toJSON = toJSON . _mctcvAddtional

-- | Information about device hardware. The fields related to temperature
-- thresholds are only available if hardwareStatusEnabled is true in the
-- device\'s policy.
--
-- /See:/ 'hardwareInfo' smart constructor.
data HardwareInfo =
  HardwareInfo'
    { _hiCPUThrottlingTemperatures     :: !(Maybe [Textual Double])
    , _hiManufacturer                  :: !(Maybe Text)
    , _hiBrand                         :: !(Maybe Text)
    , _hiCPUShutdownTemperatures       :: !(Maybe [Textual Double])
    , _hiBatteryThrottlingTemperatures :: !(Maybe [Textual Double])
    , _hiModel                         :: !(Maybe Text)
    , _hiBatteryShutdownTemperatures   :: !(Maybe [Textual Double])
    , _hiSkinThrottlingTemperatures    :: !(Maybe [Textual Double])
    , _hiGpuShutdownTemperatures       :: !(Maybe [Textual Double])
    , _hiGpuThrottlingTemperatures     :: !(Maybe [Textual Double])
    , _hiSkinShutdownTemperatures      :: !(Maybe [Textual Double])
    , _hiSerialNumber                  :: !(Maybe Text)
    , _hiDeviceBasebandVersion         :: !(Maybe Text)
    , _hiHardware                      :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'HardwareInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'hiCPUThrottlingTemperatures'
--
-- * 'hiManufacturer'
--
-- * 'hiBrand'
--
-- * 'hiCPUShutdownTemperatures'
--
-- * 'hiBatteryThrottlingTemperatures'
--
-- * 'hiModel'
--
-- * 'hiBatteryShutdownTemperatures'
--
-- * 'hiSkinThrottlingTemperatures'
--
-- * 'hiGpuShutdownTemperatures'
--
-- * 'hiGpuThrottlingTemperatures'
--
-- * 'hiSkinShutdownTemperatures'
--
-- * 'hiSerialNumber'
--
-- * 'hiDeviceBasebandVersion'
--
-- * 'hiHardware'
hardwareInfo
    :: HardwareInfo
hardwareInfo =
  HardwareInfo'
    { _hiCPUThrottlingTemperatures = Nothing
    , _hiManufacturer = Nothing
    , _hiBrand = Nothing
    , _hiCPUShutdownTemperatures = Nothing
    , _hiBatteryThrottlingTemperatures = Nothing
    , _hiModel = Nothing
    , _hiBatteryShutdownTemperatures = Nothing
    , _hiSkinThrottlingTemperatures = Nothing
    , _hiGpuShutdownTemperatures = Nothing
    , _hiGpuThrottlingTemperatures = Nothing
    , _hiSkinShutdownTemperatures = Nothing
    , _hiSerialNumber = Nothing
    , _hiDeviceBasebandVersion = Nothing
    , _hiHardware = Nothing
    }


-- | CPU throttling temperature thresholds in Celsius for each CPU on the
-- device.
hiCPUThrottlingTemperatures :: Lens' HardwareInfo [Double]
hiCPUThrottlingTemperatures
  = lens _hiCPUThrottlingTemperatures
      (\ s a -> s{_hiCPUThrottlingTemperatures = a})
      . _Default
      . _Coerce

-- | Manufacturer. For example, Motorola.
hiManufacturer :: Lens' HardwareInfo (Maybe Text)
hiManufacturer
  = lens _hiManufacturer
      (\ s a -> s{_hiManufacturer = a})

-- | Brand of the device. For example, Google.
hiBrand :: Lens' HardwareInfo (Maybe Text)
hiBrand = lens _hiBrand (\ s a -> s{_hiBrand = a})

-- | CPU shutdown temperature thresholds in Celsius for each CPU on the
-- device.
hiCPUShutdownTemperatures :: Lens' HardwareInfo [Double]
hiCPUShutdownTemperatures
  = lens _hiCPUShutdownTemperatures
      (\ s a -> s{_hiCPUShutdownTemperatures = a})
      . _Default
      . _Coerce

-- | Battery throttling temperature thresholds in Celsius for each battery on
-- the device.
hiBatteryThrottlingTemperatures :: Lens' HardwareInfo [Double]
hiBatteryThrottlingTemperatures
  = lens _hiBatteryThrottlingTemperatures
      (\ s a -> s{_hiBatteryThrottlingTemperatures = a})
      . _Default
      . _Coerce

-- | The model of the device. For example, Asus Nexus 7.
hiModel :: Lens' HardwareInfo (Maybe Text)
hiModel = lens _hiModel (\ s a -> s{_hiModel = a})

-- | Battery shutdown temperature thresholds in Celsius for each battery on
-- the device.
hiBatteryShutdownTemperatures :: Lens' HardwareInfo [Double]
hiBatteryShutdownTemperatures
  = lens _hiBatteryShutdownTemperatures
      (\ s a -> s{_hiBatteryShutdownTemperatures = a})
      . _Default
      . _Coerce

-- | Device skin throttling temperature thresholds in Celsius.
hiSkinThrottlingTemperatures :: Lens' HardwareInfo [Double]
hiSkinThrottlingTemperatures
  = lens _hiSkinThrottlingTemperatures
      (\ s a -> s{_hiSkinThrottlingTemperatures = a})
      . _Default
      . _Coerce

-- | GPU shutdown temperature thresholds in Celsius for each GPU on the
-- device.
hiGpuShutdownTemperatures :: Lens' HardwareInfo [Double]
hiGpuShutdownTemperatures
  = lens _hiGpuShutdownTemperatures
      (\ s a -> s{_hiGpuShutdownTemperatures = a})
      . _Default
      . _Coerce

-- | GPU throttling temperature thresholds in Celsius for each GPU on the
-- device.
hiGpuThrottlingTemperatures :: Lens' HardwareInfo [Double]
hiGpuThrottlingTemperatures
  = lens _hiGpuThrottlingTemperatures
      (\ s a -> s{_hiGpuThrottlingTemperatures = a})
      . _Default
      . _Coerce

-- | Device skin shutdown temperature thresholds in Celsius.
hiSkinShutdownTemperatures :: Lens' HardwareInfo [Double]
hiSkinShutdownTemperatures
  = lens _hiSkinShutdownTemperatures
      (\ s a -> s{_hiSkinShutdownTemperatures = a})
      . _Default
      . _Coerce

-- | The device serial number.
hiSerialNumber :: Lens' HardwareInfo (Maybe Text)
hiSerialNumber
  = lens _hiSerialNumber
      (\ s a -> s{_hiSerialNumber = a})

-- | Baseband version. For example, MDM9625_104662.22.05.34p.
hiDeviceBasebandVersion :: Lens' HardwareInfo (Maybe Text)
hiDeviceBasebandVersion
  = lens _hiDeviceBasebandVersion
      (\ s a -> s{_hiDeviceBasebandVersion = a})

-- | Name of the hardware. For example, Angler.
hiHardware :: Lens' HardwareInfo (Maybe Text)
hiHardware
  = lens _hiHardware (\ s a -> s{_hiHardware = a})

instance FromJSON HardwareInfo where
        parseJSON
          = withObject "HardwareInfo"
              (\ o ->
                 HardwareInfo' <$>
                   (o .:? "cpuThrottlingTemperatures" .!= mempty) <*>
                     (o .:? "manufacturer")
                     <*> (o .:? "brand")
                     <*> (o .:? "cpuShutdownTemperatures" .!= mempty)
                     <*>
                     (o .:? "batteryThrottlingTemperatures" .!= mempty)
                     <*> (o .:? "model")
                     <*> (o .:? "batteryShutdownTemperatures" .!= mempty)
                     <*> (o .:? "skinThrottlingTemperatures" .!= mempty)
                     <*> (o .:? "gpuShutdownTemperatures" .!= mempty)
                     <*> (o .:? "gpuThrottlingTemperatures" .!= mempty)
                     <*> (o .:? "skinShutdownTemperatures" .!= mempty)
                     <*> (o .:? "serialNumber")
                     <*> (o .:? "deviceBasebandVersion")
                     <*> (o .:? "hardware"))

instance ToJSON HardwareInfo where
        toJSON HardwareInfo'{..}
          = object
              (catMaybes
                 [("cpuThrottlingTemperatures" .=) <$>
                    _hiCPUThrottlingTemperatures,
                  ("manufacturer" .=) <$> _hiManufacturer,
                  ("brand" .=) <$> _hiBrand,
                  ("cpuShutdownTemperatures" .=) <$>
                    _hiCPUShutdownTemperatures,
                  ("batteryThrottlingTemperatures" .=) <$>
                    _hiBatteryThrottlingTemperatures,
                  ("model" .=) <$> _hiModel,
                  ("batteryShutdownTemperatures" .=) <$>
                    _hiBatteryShutdownTemperatures,
                  ("skinThrottlingTemperatures" .=) <$>
                    _hiSkinThrottlingTemperatures,
                  ("gpuShutdownTemperatures" .=) <$>
                    _hiGpuShutdownTemperatures,
                  ("gpuThrottlingTemperatures" .=) <$>
                    _hiGpuThrottlingTemperatures,
                  ("skinShutdownTemperatures" .=) <$>
                    _hiSkinShutdownTemperatures,
                  ("serialNumber" .=) <$> _hiSerialNumber,
                  ("deviceBasebandVersion" .=) <$>
                    _hiDeviceBasebandVersion,
                  ("hardware" .=) <$> _hiHardware])

-- | A device owned by an enterprise. Unless otherwise noted, all fields are
-- read-only and can\'t be modified by enterprises.devices.patch.
--
-- /See:/ 'device' smart constructor.
data Device =
  Device'
    { _devMemoryInfo                     :: !(Maybe MemoryInfo)
    , _devPolicyCompliant                :: !(Maybe Bool)
    , _devApplicationReports             :: !(Maybe [ApplicationReport])
    , _devPolicyName                     :: !(Maybe Text)
    , _devState                          :: !(Maybe DeviceState)
    , _devAppliedPolicyName              :: !(Maybe Text)
    , _devLastStatusReportTime           :: !(Maybe DateTime')
    , _devDeviceSettings                 :: !(Maybe DeviceSettings)
    , _devEnrollmentTokenName            :: !(Maybe Text)
    , _devManagementMode                 :: !(Maybe DeviceManagementMode)
    , _devHardwareInfo                   :: !(Maybe HardwareInfo)
    , _devPowerManagementEvents          :: !(Maybe [PowerManagementEvent])
    , _devUserName                       :: !(Maybe Text)
    , _devMemoryEvents                   :: !(Maybe [MemoryEvent])
    , _devAPILevel                       :: !(Maybe (Textual Int32))
    , _devUser                           :: !(Maybe User)
    , _devDisabledReason                 :: !(Maybe UserFacingMessage)
    , _devLastPolicyComplianceReportTime :: !(Maybe DateTime')
    , _devEnrollmentTokenData            :: !(Maybe Text)
    , _devName                           :: !(Maybe Text)
    , _devAppliedPolicyVersion           :: !(Maybe (Textual Int64))
    , _devHardwareStatusSamples          :: !(Maybe [HardwareStatus])
    , _devAppliedState                   :: !(Maybe DeviceAppliedState)
    , _devPreviousDeviceNames            :: !(Maybe [Text])
    , _devLastPolicySyncTime             :: !(Maybe DateTime')
    , _devNetworkInfo                    :: !(Maybe NetworkInfo)
    , _devNonComplianceDetails           :: !(Maybe [NonComplianceDetail])
    , _devSoftwareInfo                   :: !(Maybe SoftwareInfo)
    , _devEnrollmentTime                 :: !(Maybe DateTime')
    , _devDisplays                       :: !(Maybe [Display])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Device' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'devMemoryInfo'
--
-- * 'devPolicyCompliant'
--
-- * 'devApplicationReports'
--
-- * 'devPolicyName'
--
-- * 'devState'
--
-- * 'devAppliedPolicyName'
--
-- * 'devLastStatusReportTime'
--
-- * 'devDeviceSettings'
--
-- * 'devEnrollmentTokenName'
--
-- * 'devManagementMode'
--
-- * 'devHardwareInfo'
--
-- * 'devPowerManagementEvents'
--
-- * 'devUserName'
--
-- * 'devMemoryEvents'
--
-- * 'devAPILevel'
--
-- * 'devUser'
--
-- * 'devDisabledReason'
--
-- * 'devLastPolicyComplianceReportTime'
--
-- * 'devEnrollmentTokenData'
--
-- * 'devName'
--
-- * 'devAppliedPolicyVersion'
--
-- * 'devHardwareStatusSamples'
--
-- * 'devAppliedState'
--
-- * 'devPreviousDeviceNames'
--
-- * 'devLastPolicySyncTime'
--
-- * 'devNetworkInfo'
--
-- * 'devNonComplianceDetails'
--
-- * 'devSoftwareInfo'
--
-- * 'devEnrollmentTime'
--
-- * 'devDisplays'
device
    :: Device
device =
  Device'
    { _devMemoryInfo = Nothing
    , _devPolicyCompliant = Nothing
    , _devApplicationReports = Nothing
    , _devPolicyName = Nothing
    , _devState = Nothing
    , _devAppliedPolicyName = Nothing
    , _devLastStatusReportTime = Nothing
    , _devDeviceSettings = Nothing
    , _devEnrollmentTokenName = Nothing
    , _devManagementMode = Nothing
    , _devHardwareInfo = Nothing
    , _devPowerManagementEvents = Nothing
    , _devUserName = Nothing
    , _devMemoryEvents = Nothing
    , _devAPILevel = Nothing
    , _devUser = Nothing
    , _devDisabledReason = Nothing
    , _devLastPolicyComplianceReportTime = Nothing
    , _devEnrollmentTokenData = Nothing
    , _devName = Nothing
    , _devAppliedPolicyVersion = Nothing
    , _devHardwareStatusSamples = Nothing
    , _devAppliedState = Nothing
    , _devPreviousDeviceNames = Nothing
    , _devLastPolicySyncTime = Nothing
    , _devNetworkInfo = Nothing
    , _devNonComplianceDetails = Nothing
    , _devSoftwareInfo = Nothing
    , _devEnrollmentTime = Nothing
    , _devDisplays = Nothing
    }


-- | Memory information. This information is only available if
-- memoryInfoEnabled is true in the device\'s policy.
devMemoryInfo :: Lens' Device (Maybe MemoryInfo)
devMemoryInfo
  = lens _devMemoryInfo
      (\ s a -> s{_devMemoryInfo = a})

-- | Whether the device is compliant with its policy.
devPolicyCompliant :: Lens' Device (Maybe Bool)
devPolicyCompliant
  = lens _devPolicyCompliant
      (\ s a -> s{_devPolicyCompliant = a})

-- | Reports for apps installed on the device. This information is only
-- available when application_reports_enabled is true in the device\'s
-- policy.
devApplicationReports :: Lens' Device [ApplicationReport]
devApplicationReports
  = lens _devApplicationReports
      (\ s a -> s{_devApplicationReports = a})
      . _Default
      . _Coerce

-- | The name of the policy applied to the device, in the form
-- enterprises\/{enterpriseId}\/policies\/{policyId}. If not specified, the
-- policy_name for the device\'s user is applied. This field can be
-- modified by a patch request. You can specify only the policyId when
-- calling enterprises.devices.patch, as long as the policyId doesn’t
-- contain any slashes. The rest of the policy name is inferred.
devPolicyName :: Lens' Device (Maybe Text)
devPolicyName
  = lens _devPolicyName
      (\ s a -> s{_devPolicyName = a})

-- | The state to be applied to the device. This field can be modified by a
-- patch request. Note that when calling enterprises.devices.patch, ACTIVE
-- and DISABLED are the only allowable values. To enter the device into a
-- DELETED state, call enterprises.devices.delete.
devState :: Lens' Device (Maybe DeviceState)
devState = lens _devState (\ s a -> s{_devState = a})

-- | The name of the policy currently applied to the device.
devAppliedPolicyName :: Lens' Device (Maybe Text)
devAppliedPolicyName
  = lens _devAppliedPolicyName
      (\ s a -> s{_devAppliedPolicyName = a})

-- | The last time the device sent a status report.
devLastStatusReportTime :: Lens' Device (Maybe UTCTime)
devLastStatusReportTime
  = lens _devLastStatusReportTime
      (\ s a -> s{_devLastStatusReportTime = a})
      . mapping _DateTime

-- | Device settings information. This information is only available if
-- deviceSettingsEnabled is true in the device\'s policy.
devDeviceSettings :: Lens' Device (Maybe DeviceSettings)
devDeviceSettings
  = lens _devDeviceSettings
      (\ s a -> s{_devDeviceSettings = a})

-- | If the device was enrolled with an enrollment token, this field contains
-- the name of the token.
devEnrollmentTokenName :: Lens' Device (Maybe Text)
devEnrollmentTokenName
  = lens _devEnrollmentTokenName
      (\ s a -> s{_devEnrollmentTokenName = a})

-- | The type of management mode Android Device Policy takes on the device.
-- This influences which policy settings are supported.
devManagementMode :: Lens' Device (Maybe DeviceManagementMode)
devManagementMode
  = lens _devManagementMode
      (\ s a -> s{_devManagementMode = a})

-- | Detailed information about the device hardware.
devHardwareInfo :: Lens' Device (Maybe HardwareInfo)
devHardwareInfo
  = lens _devHardwareInfo
      (\ s a -> s{_devHardwareInfo = a})

-- | Power management events on the device in chronological order. This
-- information is only available if powerManagementEventsEnabled is true in
-- the device\'s policy.
devPowerManagementEvents :: Lens' Device [PowerManagementEvent]
devPowerManagementEvents
  = lens _devPowerManagementEvents
      (\ s a -> s{_devPowerManagementEvents = a})
      . _Default
      . _Coerce

-- | The resource name of the user that owns this device in the form
-- enterprises\/{enterpriseId}\/users\/{userId}.
devUserName :: Lens' Device (Maybe Text)
devUserName
  = lens _devUserName (\ s a -> s{_devUserName = a})

-- | Events related to memory and storage measurements in chronological
-- order. This information is only available if memoryInfoEnabled is true
-- in the device\'s policy.
devMemoryEvents :: Lens' Device [MemoryEvent]
devMemoryEvents
  = lens _devMemoryEvents
      (\ s a -> s{_devMemoryEvents = a})
      . _Default
      . _Coerce

-- | The API level of the Android platform version running on the device.
devAPILevel :: Lens' Device (Maybe Int32)
devAPILevel
  = lens _devAPILevel (\ s a -> s{_devAPILevel = a}) .
      mapping _Coerce

-- | The user who owns the device.
devUser :: Lens' Device (Maybe User)
devUser = lens _devUser (\ s a -> s{_devUser = a})

-- | If the device state is DISABLED, an optional message that is displayed
-- on the device indicating the reason the device is disabled. This field
-- can be modified by a patch request.
devDisabledReason :: Lens' Device (Maybe UserFacingMessage)
devDisabledReason
  = lens _devDisabledReason
      (\ s a -> s{_devDisabledReason = a})

-- | Deprecated.
devLastPolicyComplianceReportTime :: Lens' Device (Maybe UTCTime)
devLastPolicyComplianceReportTime
  = lens _devLastPolicyComplianceReportTime
      (\ s a -> s{_devLastPolicyComplianceReportTime = a})
      . mapping _DateTime

-- | If the device was enrolled with an enrollment token with additional data
-- provided, this field contains that data.
devEnrollmentTokenData :: Lens' Device (Maybe Text)
devEnrollmentTokenData
  = lens _devEnrollmentTokenData
      (\ s a -> s{_devEnrollmentTokenData = a})

-- | The name of the device in the form
-- enterprises\/{enterpriseId}\/devices\/{deviceId}.
devName :: Lens' Device (Maybe Text)
devName = lens _devName (\ s a -> s{_devName = a})

-- | The version of the policy currently applied to the device.
devAppliedPolicyVersion :: Lens' Device (Maybe Int64)
devAppliedPolicyVersion
  = lens _devAppliedPolicyVersion
      (\ s a -> s{_devAppliedPolicyVersion = a})
      . mapping _Coerce

-- | Hardware status samples in chronological order. This information is only
-- available if hardwareStatusEnabled is true in the device\'s policy.
devHardwareStatusSamples :: Lens' Device [HardwareStatus]
devHardwareStatusSamples
  = lens _devHardwareStatusSamples
      (\ s a -> s{_devHardwareStatusSamples = a})
      . _Default
      . _Coerce

-- | The state currently applied to the device.
devAppliedState :: Lens' Device (Maybe DeviceAppliedState)
devAppliedState
  = lens _devAppliedState
      (\ s a -> s{_devAppliedState = a})

-- | If the same physical device has been enrolled multiple times, this field
-- contains its previous device names. The serial number is used as the
-- unique identifier to determine if the same physical device has enrolled
-- previously. The names are in chronological order.
devPreviousDeviceNames :: Lens' Device [Text]
devPreviousDeviceNames
  = lens _devPreviousDeviceNames
      (\ s a -> s{_devPreviousDeviceNames = a})
      . _Default
      . _Coerce

-- | The last time the device fetched its policy.
devLastPolicySyncTime :: Lens' Device (Maybe UTCTime)
devLastPolicySyncTime
  = lens _devLastPolicySyncTime
      (\ s a -> s{_devLastPolicySyncTime = a})
      . mapping _DateTime

-- | Device network information. This information is only available if
-- networkInfoEnabled is true in the device\'s policy.
devNetworkInfo :: Lens' Device (Maybe NetworkInfo)
devNetworkInfo
  = lens _devNetworkInfo
      (\ s a -> s{_devNetworkInfo = a})

-- | Details about policy settings that the device is not compliant with.
devNonComplianceDetails :: Lens' Device [NonComplianceDetail]
devNonComplianceDetails
  = lens _devNonComplianceDetails
      (\ s a -> s{_devNonComplianceDetails = a})
      . _Default
      . _Coerce

-- | Detailed information about the device software. This information is only
-- available if softwareInfoEnabled is true in the device\'s policy.
devSoftwareInfo :: Lens' Device (Maybe SoftwareInfo)
devSoftwareInfo
  = lens _devSoftwareInfo
      (\ s a -> s{_devSoftwareInfo = a})

-- | The time of device enrollment.
devEnrollmentTime :: Lens' Device (Maybe UTCTime)
devEnrollmentTime
  = lens _devEnrollmentTime
      (\ s a -> s{_devEnrollmentTime = a})
      . mapping _DateTime

-- | Detailed information about displays on the device. This information is
-- only available if displayInfoEnabled is true in the device\'s policy.
devDisplays :: Lens' Device [Display]
devDisplays
  = lens _devDisplays (\ s a -> s{_devDisplays = a}) .
      _Default
      . _Coerce

instance FromJSON Device where
        parseJSON
          = withObject "Device"
              (\ o ->
                 Device' <$>
                   (o .:? "memoryInfo") <*> (o .:? "policyCompliant")
                     <*> (o .:? "applicationReports" .!= mempty)
                     <*> (o .:? "policyName")
                     <*> (o .:? "state")
                     <*> (o .:? "appliedPolicyName")
                     <*> (o .:? "lastStatusReportTime")
                     <*> (o .:? "deviceSettings")
                     <*> (o .:? "enrollmentTokenName")
                     <*> (o .:? "managementMode")
                     <*> (o .:? "hardwareInfo")
                     <*> (o .:? "powerManagementEvents" .!= mempty)
                     <*> (o .:? "userName")
                     <*> (o .:? "memoryEvents" .!= mempty)
                     <*> (o .:? "apiLevel")
                     <*> (o .:? "user")
                     <*> (o .:? "disabledReason")
                     <*> (o .:? "lastPolicyComplianceReportTime")
                     <*> (o .:? "enrollmentTokenData")
                     <*> (o .:? "name")
                     <*> (o .:? "appliedPolicyVersion")
                     <*> (o .:? "hardwareStatusSamples" .!= mempty)
                     <*> (o .:? "appliedState")
                     <*> (o .:? "previousDeviceNames" .!= mempty)
                     <*> (o .:? "lastPolicySyncTime")
                     <*> (o .:? "networkInfo")
                     <*> (o .:? "nonComplianceDetails" .!= mempty)
                     <*> (o .:? "softwareInfo")
                     <*> (o .:? "enrollmentTime")
                     <*> (o .:? "displays" .!= mempty))

instance ToJSON Device where
        toJSON Device'{..}
          = object
              (catMaybes
                 [("memoryInfo" .=) <$> _devMemoryInfo,
                  ("policyCompliant" .=) <$> _devPolicyCompliant,
                  ("applicationReports" .=) <$> _devApplicationReports,
                  ("policyName" .=) <$> _devPolicyName,
                  ("state" .=) <$> _devState,
                  ("appliedPolicyName" .=) <$> _devAppliedPolicyName,
                  ("lastStatusReportTime" .=) <$>
                    _devLastStatusReportTime,
                  ("deviceSettings" .=) <$> _devDeviceSettings,
                  ("enrollmentTokenName" .=) <$>
                    _devEnrollmentTokenName,
                  ("managementMode" .=) <$> _devManagementMode,
                  ("hardwareInfo" .=) <$> _devHardwareInfo,
                  ("powerManagementEvents" .=) <$>
                    _devPowerManagementEvents,
                  ("userName" .=) <$> _devUserName,
                  ("memoryEvents" .=) <$> _devMemoryEvents,
                  ("apiLevel" .=) <$> _devAPILevel,
                  ("user" .=) <$> _devUser,
                  ("disabledReason" .=) <$> _devDisabledReason,
                  ("lastPolicyComplianceReportTime" .=) <$>
                    _devLastPolicyComplianceReportTime,
                  ("enrollmentTokenData" .=) <$>
                    _devEnrollmentTokenData,
                  ("name" .=) <$> _devName,
                  ("appliedPolicyVersion" .=) <$>
                    _devAppliedPolicyVersion,
                  ("hardwareStatusSamples" .=) <$>
                    _devHardwareStatusSamples,
                  ("appliedState" .=) <$> _devAppliedState,
                  ("previousDeviceNames" .=) <$>
                    _devPreviousDeviceNames,
                  ("lastPolicySyncTime" .=) <$> _devLastPolicySyncTime,
                  ("networkInfo" .=) <$> _devNetworkInfo,
                  ("nonComplianceDetails" .=) <$>
                    _devNonComplianceDetails,
                  ("softwareInfo" .=) <$> _devSoftwareInfo,
                  ("enrollmentTime" .=) <$> _devEnrollmentTime,
                  ("displays" .=) <$> _devDisplays])

--
-- /See:/ 'statusDetailsItem' smart constructor.
newtype StatusDetailsItem =
  StatusDetailsItem'
    { _sdiAddtional :: HashMap Text JSONValue
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'StatusDetailsItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sdiAddtional'
statusDetailsItem
    :: HashMap Text JSONValue -- ^ 'sdiAddtional'
    -> StatusDetailsItem
statusDetailsItem pSdiAddtional_ =
  StatusDetailsItem' {_sdiAddtional = _Coerce # pSdiAddtional_}


-- | Properties of the object. Contains field \'type with type URL.
sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
sdiAddtional
  = lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
      . _Coerce

instance FromJSON StatusDetailsItem where
        parseJSON
          = withObject "StatusDetailsItem"
              (\ o -> StatusDetailsItem' <$> (parseJSONObject o))

instance ToJSON StatusDetailsItem where
        toJSON = toJSON . _sdiAddtional

-- | An entry of a managed property.
--
-- /See:/ 'managedPropertyEntry' smart constructor.
data ManagedPropertyEntry =
  ManagedPropertyEntry'
    { _mpeValue :: !(Maybe Text)
    , _mpeName  :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ManagedPropertyEntry' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mpeValue'
--
-- * 'mpeName'
managedPropertyEntry
    :: ManagedPropertyEntry
managedPropertyEntry =
  ManagedPropertyEntry' {_mpeValue = Nothing, _mpeName = Nothing}


-- | The machine-readable value of the entry, which should be used in the
-- configuration. Not localized.
mpeValue :: Lens' ManagedPropertyEntry (Maybe Text)
mpeValue = lens _mpeValue (\ s a -> s{_mpeValue = a})

-- | The human-readable name of the value. Localized.
mpeName :: Lens' ManagedPropertyEntry (Maybe Text)
mpeName = lens _mpeName (\ s a -> s{_mpeName = a})

instance FromJSON ManagedPropertyEntry where
        parseJSON
          = withObject "ManagedPropertyEntry"
              (\ o ->
                 ManagedPropertyEntry' <$>
                   (o .:? "value") <*> (o .:? "name"))

instance ToJSON ManagedPropertyEntry where
        toJSON ManagedPropertyEntry'{..}
          = object
              (catMaybes
                 [("value" .=) <$> _mpeValue,
                  ("name" .=) <$> _mpeName])

-- | A rule for automatically choosing a private key and certificate to
-- authenticate the device to a server.
--
-- /See:/ 'choosePrivateKeyRule' smart constructor.
data ChoosePrivateKeyRule =
  ChoosePrivateKeyRule'
    { _cpkrPrivateKeyAlias :: !(Maybe Text)
    , _cpkrURLPattern      :: !(Maybe Text)
    , _cpkrPackageNames    :: !(Maybe [Text])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChoosePrivateKeyRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cpkrPrivateKeyAlias'
--
-- * 'cpkrURLPattern'
--
-- * 'cpkrPackageNames'
choosePrivateKeyRule
    :: ChoosePrivateKeyRule
choosePrivateKeyRule =
  ChoosePrivateKeyRule'
    { _cpkrPrivateKeyAlias = Nothing
    , _cpkrURLPattern = Nothing
    , _cpkrPackageNames = Nothing
    }


-- | The alias of the private key to be used.
cpkrPrivateKeyAlias :: Lens' ChoosePrivateKeyRule (Maybe Text)
cpkrPrivateKeyAlias
  = lens _cpkrPrivateKeyAlias
      (\ s a -> s{_cpkrPrivateKeyAlias = a})

-- | The URL pattern to match against the URL of the outgoing request. The
-- pattern may contain asterisk (*) wildcards. Any URL is matched if
-- unspecified.
cpkrURLPattern :: Lens' ChoosePrivateKeyRule (Maybe Text)
cpkrURLPattern
  = lens _cpkrURLPattern
      (\ s a -> s{_cpkrURLPattern = a})

-- | The package names for which outgoing requests are subject to this rule.
-- If no package names are specified, then the rule applies to all
-- packages. For each package name listed, the rule applies to that package
-- and all other packages that shared the same Android UID. The SHA256 hash
-- of the signing key signatures of each package_name will be verified
-- against those provided by Play
cpkrPackageNames :: Lens' ChoosePrivateKeyRule [Text]
cpkrPackageNames
  = lens _cpkrPackageNames
      (\ s a -> s{_cpkrPackageNames = a})
      . _Default
      . _Coerce

instance FromJSON ChoosePrivateKeyRule where
        parseJSON
          = withObject "ChoosePrivateKeyRule"
              (\ o ->
                 ChoosePrivateKeyRule' <$>
                   (o .:? "privateKeyAlias") <*> (o .:? "urlPattern")
                     <*> (o .:? "packageNames" .!= mempty))

instance ToJSON ChoosePrivateKeyRule where
        toJSON ChoosePrivateKeyRule'{..}
          = object
              (catMaybes
                 [("privateKeyAlias" .=) <$> _cpkrPrivateKeyAlias,
                  ("urlPattern" .=) <$> _cpkrURLPattern,
                  ("packageNames" .=) <$> _cpkrPackageNames])

-- | A map containing pairs, where locale is a well-formed BCP 47 language
-- (https:\/\/www.w3.org\/International\/articles\/language-tags\/) code,
-- such as en-US, es-ES, or fr.
--
-- /See:/ 'userFacingMessageLocalizedMessages' smart constructor.
newtype UserFacingMessageLocalizedMessages =
  UserFacingMessageLocalizedMessages'
    { _ufmlmAddtional :: HashMap Text Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'UserFacingMessageLocalizedMessages' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ufmlmAddtional'
userFacingMessageLocalizedMessages
    :: HashMap Text Text -- ^ 'ufmlmAddtional'
    -> UserFacingMessageLocalizedMessages
userFacingMessageLocalizedMessages pUfmlmAddtional_ =
  UserFacingMessageLocalizedMessages'
    {_ufmlmAddtional = _Coerce # pUfmlmAddtional_}


ufmlmAddtional :: Lens' UserFacingMessageLocalizedMessages (HashMap Text Text)
ufmlmAddtional
  = lens _ufmlmAddtional
      (\ s a -> s{_ufmlmAddtional = a})
      . _Coerce

instance FromJSON UserFacingMessageLocalizedMessages
         where
        parseJSON
          = withObject "UserFacingMessageLocalizedMessages"
              (\ o ->
                 UserFacingMessageLocalizedMessages' <$>
                   (parseJSONObject o))

instance ToJSON UserFacingMessageLocalizedMessages
         where
        toJSON = toJSON . _ufmlmAddtional

-- | A user belonging to an enterprise.
--
-- /See:/ 'user' smart constructor.
newtype User =
  User'
    { _uAccountIdentifier :: Maybe Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'User' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'uAccountIdentifier'
user
    :: User
user = User' {_uAccountIdentifier = Nothing}


-- | A unique identifier you create for this user, such as user342 or
-- asset#44418. This field must be set when the user is created and can\'t
-- be updated. This field must not contain personally identifiable
-- information (PII). This identifier must be 1024 characters or less;
-- otherwise, the update policy request will fail.
uAccountIdentifier :: Lens' User (Maybe Text)
uAccountIdentifier
  = lens _uAccountIdentifier
      (\ s a -> s{_uAccountIdentifier = a})

instance FromJSON User where
        parseJSON
          = withObject "User"
              (\ o -> User' <$> (o .:? "accountIdentifier"))

instance ToJSON User where
        toJSON User'{..}
          = object
              (catMaybes
                 [("accountIdentifier" .=) <$> _uAccountIdentifier])

-- | Configuration for managing system updates
--
-- /See:/ 'systemUpdate' smart constructor.
data SystemUpdate =
  SystemUpdate'
    { _suEndMinutes   :: !(Maybe (Textual Int32))
    , _suStartMinutes :: !(Maybe (Textual Int32))
    , _suType         :: !(Maybe SystemUpdateType)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SystemUpdate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'suEndMinutes'
--
-- * 'suStartMinutes'
--
-- * 'suType'
systemUpdate
    :: SystemUpdate
systemUpdate =
  SystemUpdate'
    {_suEndMinutes = Nothing, _suStartMinutes = Nothing, _suType = Nothing}


-- | If the type is WINDOWED, the end of the maintenance window, measured as
-- the number of minutes after midnight in device\'s local time. This value
-- must be between 0 and 1439, inclusive. If this value is less than
-- start_minutes, then the maintenance window spans midnight. If the
-- maintenance window specified is smaller than 30 minutes, the actual
-- window is extended to 30 minutes beyond the start time.
suEndMinutes :: Lens' SystemUpdate (Maybe Int32)
suEndMinutes
  = lens _suEndMinutes (\ s a -> s{_suEndMinutes = a})
      . mapping _Coerce

-- | If the type is WINDOWED, the start of the maintenance window, measured
-- as the number of minutes after midnight in the device\'s local time.
-- This value must be between 0 and 1439, inclusive.
suStartMinutes :: Lens' SystemUpdate (Maybe Int32)
suStartMinutes
  = lens _suStartMinutes
      (\ s a -> s{_suStartMinutes = a})
      . mapping _Coerce

-- | The type of system update to configure.
suType :: Lens' SystemUpdate (Maybe SystemUpdateType)
suType = lens _suType (\ s a -> s{_suType = a})

instance FromJSON SystemUpdate where
        parseJSON
          = withObject "SystemUpdate"
              (\ o ->
                 SystemUpdate' <$>
                   (o .:? "endMinutes") <*> (o .:? "startMinutes") <*>
                     (o .:? "type"))

instance ToJSON SystemUpdate where
        toJSON SystemUpdate'{..}
          = object
              (catMaybes
                 [("endMinutes" .=) <$> _suEndMinutes,
                  ("startMinutes" .=) <$> _suStartMinutes,
                  ("type" .=) <$> _suType])

-- | Information reported about an installed app.
--
-- /See:/ 'applicationReport' smart constructor.
data ApplicationReport =
  ApplicationReport'
    { _arVersionCode                :: !(Maybe (Textual Int32))
    , _arSigningKeyCertFingerprints :: !(Maybe [Text])
    , _arState                      :: !(Maybe ApplicationReportState)
    , _arVersionName                :: !(Maybe Text)
    , _arPackageName                :: !(Maybe Text)
    , _arPackageSha256Hash          :: !(Maybe Text)
    , _arKeyedAppStates             :: !(Maybe [KeyedAppState])
    , _arApplicationSource          :: !(Maybe ApplicationReportApplicationSource)
    , _arEvents                     :: !(Maybe [ApplicationEvent])
    , _arDisplayName                :: !(Maybe Text)
    , _arInstallerPackageName       :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ApplicationReport' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'arVersionCode'
--
-- * 'arSigningKeyCertFingerprints'
--
-- * 'arState'
--
-- * 'arVersionName'
--
-- * 'arPackageName'
--
-- * 'arPackageSha256Hash'
--
-- * 'arKeyedAppStates'
--
-- * 'arApplicationSource'
--
-- * 'arEvents'
--
-- * 'arDisplayName'
--
-- * 'arInstallerPackageName'
applicationReport
    :: ApplicationReport
applicationReport =
  ApplicationReport'
    { _arVersionCode = Nothing
    , _arSigningKeyCertFingerprints = Nothing
    , _arState = Nothing
    , _arVersionName = Nothing
    , _arPackageName = Nothing
    , _arPackageSha256Hash = Nothing
    , _arKeyedAppStates = Nothing
    , _arApplicationSource = Nothing
    , _arEvents = Nothing
    , _arDisplayName = Nothing
    , _arInstallerPackageName = Nothing
    }


-- | The app version code, which can be used to determine whether one version
-- is more recent than another.
arVersionCode :: Lens' ApplicationReport (Maybe Int32)
arVersionCode
  = lens _arVersionCode
      (\ s a -> s{_arVersionCode = a})
      . mapping _Coerce

-- | The SHA-1 hash of each android.content.pm.Signature
-- (https:\/\/developer.android.com\/reference\/android\/content\/pm\/Signature.html)
-- associated with the app package. Each byte of each hash value is
-- represented as a two-digit hexadecimal number.
arSigningKeyCertFingerprints :: Lens' ApplicationReport [Text]
arSigningKeyCertFingerprints
  = lens _arSigningKeyCertFingerprints
      (\ s a -> s{_arSigningKeyCertFingerprints = a})
      . _Default
      . _Coerce

-- | Application state.
arState :: Lens' ApplicationReport (Maybe ApplicationReportState)
arState = lens _arState (\ s a -> s{_arState = a})

-- | The app version as displayed to the user.
arVersionName :: Lens' ApplicationReport (Maybe Text)
arVersionName
  = lens _arVersionName
      (\ s a -> s{_arVersionName = a})

-- | Package name of the app.
arPackageName :: Lens' ApplicationReport (Maybe Text)
arPackageName
  = lens _arPackageName
      (\ s a -> s{_arPackageName = a})

-- | The SHA-256 hash of the app\'s APK file, which can be used to verify the
-- app hasn\'t been modified. Each byte of the hash value is represented as
-- a two-digit hexadecimal number.
arPackageSha256Hash :: Lens' ApplicationReport (Maybe Text)
arPackageSha256Hash
  = lens _arPackageSha256Hash
      (\ s a -> s{_arPackageSha256Hash = a})

-- | List of keyed app states reported by the app.
arKeyedAppStates :: Lens' ApplicationReport [KeyedAppState]
arKeyedAppStates
  = lens _arKeyedAppStates
      (\ s a -> s{_arKeyedAppStates = a})
      . _Default
      . _Coerce

-- | The source of the package.
arApplicationSource :: Lens' ApplicationReport (Maybe ApplicationReportApplicationSource)
arApplicationSource
  = lens _arApplicationSource
      (\ s a -> s{_arApplicationSource = a})

-- | List of app events. The most recent 20 events are stored in the list.
arEvents :: Lens' ApplicationReport [ApplicationEvent]
arEvents
  = lens _arEvents (\ s a -> s{_arEvents = a}) .
      _Default
      . _Coerce

-- | The display name of the app.
arDisplayName :: Lens' ApplicationReport (Maybe Text)
arDisplayName
  = lens _arDisplayName
      (\ s a -> s{_arDisplayName = a})

-- | The package name of the app that installed this app.
arInstallerPackageName :: Lens' ApplicationReport (Maybe Text)
arInstallerPackageName
  = lens _arInstallerPackageName
      (\ s a -> s{_arInstallerPackageName = a})

instance FromJSON ApplicationReport where
        parseJSON
          = withObject "ApplicationReport"
              (\ o ->
                 ApplicationReport' <$>
                   (o .:? "versionCode") <*>
                     (o .:? "signingKeyCertFingerprints" .!= mempty)
                     <*> (o .:? "state")
                     <*> (o .:? "versionName")
                     <*> (o .:? "packageName")
                     <*> (o .:? "packageSha256Hash")
                     <*> (o .:? "keyedAppStates" .!= mempty)
                     <*> (o .:? "applicationSource")
                     <*> (o .:? "events" .!= mempty)
                     <*> (o .:? "displayName")
                     <*> (o .:? "installerPackageName"))

instance ToJSON ApplicationReport where
        toJSON ApplicationReport'{..}
          = object
              (catMaybes
                 [("versionCode" .=) <$> _arVersionCode,
                  ("signingKeyCertFingerprints" .=) <$>
                    _arSigningKeyCertFingerprints,
                  ("state" .=) <$> _arState,
                  ("versionName" .=) <$> _arVersionName,
                  ("packageName" .=) <$> _arPackageName,
                  ("packageSha256Hash" .=) <$> _arPackageSha256Hash,
                  ("keyedAppStates" .=) <$> _arKeyedAppStates,
                  ("applicationSource" .=) <$> _arApplicationSource,
                  ("events" .=) <$> _arEvents,
                  ("displayName" .=) <$> _arDisplayName,
                  ("installerPackageName" .=) <$>
                    _arInstallerPackageName])

-- | An enrollment token.
--
-- /See:/ 'enrollmentToken' smart constructor.
data EnrollmentToken =
  EnrollmentToken'
    { _etPolicyName          :: !(Maybe Text)
    , _etValue               :: !(Maybe Text)
    , _etQrCode              :: !(Maybe Text)
    , _etAdditionalData      :: !(Maybe Text)
    , _etUser                :: !(Maybe User)
    , _etName                :: !(Maybe Text)
    , _etOneTimeOnly         :: !(Maybe Bool)
    , _etExpirationTimestamp :: !(Maybe DateTime')
    , _etDuration            :: !(Maybe GDuration)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'EnrollmentToken' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'etPolicyName'
--
-- * 'etValue'
--
-- * 'etQrCode'
--
-- * 'etAdditionalData'
--
-- * 'etUser'
--
-- * 'etName'
--
-- * 'etOneTimeOnly'
--
-- * 'etExpirationTimestamp'
--
-- * 'etDuration'
enrollmentToken
    :: EnrollmentToken
enrollmentToken =
  EnrollmentToken'
    { _etPolicyName = Nothing
    , _etValue = Nothing
    , _etQrCode = Nothing
    , _etAdditionalData = Nothing
    , _etUser = Nothing
    , _etName = Nothing
    , _etOneTimeOnly = Nothing
    , _etExpirationTimestamp = Nothing
    , _etDuration = Nothing
    }


-- | The name of the policy initially applied to the enrolled device, in the
-- form enterprises\/{enterpriseId}\/policies\/{policyId}. If not
-- specified, the policy_name for the device’s user is applied. If
-- user_name is also not specified,
-- enterprises\/{enterpriseId}\/policies\/default is applied by default.
-- When updating this field, you can specify only the policyId as long as
-- the policyId doesn’t contain any slashes. The rest of the policy name
-- will be inferred.
etPolicyName :: Lens' EnrollmentToken (Maybe Text)
etPolicyName
  = lens _etPolicyName (\ s a -> s{_etPolicyName = a})

-- | The token value that\'s passed to the device and authorizes the device
-- to enroll. This is a read-only field generated by the server.
etValue :: Lens' EnrollmentToken (Maybe Text)
etValue = lens _etValue (\ s a -> s{_etValue = a})

-- | A JSON string whose UTF-8 representation can be used to generate a QR
-- code to enroll a device with this enrollment token. To enroll a device
-- using NFC, the NFC record must contain a serialized java.util.Properties
-- representation of the properties in the JSON.
etQrCode :: Lens' EnrollmentToken (Maybe Text)
etQrCode = lens _etQrCode (\ s a -> s{_etQrCode = a})

-- | Optional, arbitrary data associated with the enrollment token. This
-- could contain, for example, the ID of an org unit the device is assigned
-- to after enrollment. After a device enrolls with the token, this data
-- will be exposed in the enrollment_token_data field of the Device
-- resource. The data must be 1024 characters or less; otherwise, the
-- creation request will fail.
etAdditionalData :: Lens' EnrollmentToken (Maybe Text)
etAdditionalData
  = lens _etAdditionalData
      (\ s a -> s{_etAdditionalData = a})

-- | The user associated with this enrollment token. If it\'s specified when
-- the enrollment token is created and the user does not exist, the user
-- will be created. This field must not contain personally identifiable
-- information. Only the account_identifier field needs to be set.
etUser :: Lens' EnrollmentToken (Maybe User)
etUser = lens _etUser (\ s a -> s{_etUser = a})

-- | The name of the enrollment token, which is generated by the server
-- during creation, in the form
-- enterprises\/{enterpriseId}\/enrollmentTokens\/{enrollmentTokenId}.
etName :: Lens' EnrollmentToken (Maybe Text)
etName = lens _etName (\ s a -> s{_etName = a})

-- | Whether the enrollment token is for one time use only. If the flag is
-- set to true, only one device can use it for registration.
etOneTimeOnly :: Lens' EnrollmentToken (Maybe Bool)
etOneTimeOnly
  = lens _etOneTimeOnly
      (\ s a -> s{_etOneTimeOnly = a})

-- | The expiration time of the token. This is a read-only field generated by
-- the server.
etExpirationTimestamp :: Lens' EnrollmentToken (Maybe UTCTime)
etExpirationTimestamp
  = lens _etExpirationTimestamp
      (\ s a -> s{_etExpirationTimestamp = a})
      . mapping _DateTime

-- | The length of time the enrollment token is valid, ranging from 1 minute
-- to 30 days. If not specified, the default duration is 1 hour.
etDuration :: Lens' EnrollmentToken (Maybe Scientific)
etDuration
  = lens _etDuration (\ s a -> s{_etDuration = a}) .
      mapping _GDuration

instance FromJSON EnrollmentToken where
        parseJSON
          = withObject "EnrollmentToken"
              (\ o ->
                 EnrollmentToken' <$>
                   (o .:? "policyName") <*> (o .:? "value") <*>
                     (o .:? "qrCode")
                     <*> (o .:? "additionalData")
                     <*> (o .:? "user")
                     <*> (o .:? "name")
                     <*> (o .:? "oneTimeOnly")
                     <*> (o .:? "expirationTimestamp")
                     <*> (o .:? "duration"))

instance ToJSON EnrollmentToken where
        toJSON EnrollmentToken'{..}
          = object
              (catMaybes
                 [("policyName" .=) <$> _etPolicyName,
                  ("value" .=) <$> _etValue,
                  ("qrCode" .=) <$> _etQrCode,
                  ("additionalData" .=) <$> _etAdditionalData,
                  ("user" .=) <$> _etUser, ("name" .=) <$> _etName,
                  ("oneTimeOnly" .=) <$> _etOneTimeOnly,
                  ("expirationTimestamp" .=) <$>
                    _etExpirationTimestamp,
                  ("duration" .=) <$> _etDuration])

-- | Managed configuration applied to the app. The format for the
-- configuration is dictated by the ManagedProperty values supported by the
-- app. Each field name in the managed configuration must match the key
-- field of the ManagedProperty. The field value must be compatible with
-- the type of the ManagedProperty:
-- > +--------------+------------------+
-- > | /type/       | /JSON value/     |
-- > +--------------+------------------+
-- > | BOOL         | true or false    |
-- > +--------------+------------------+
-- > | STRING       | string           |
-- > +--------------+------------------+
-- > | INTEGER      | number           |
-- > +--------------+------------------+
-- > | CHOICE       | string           |
-- > +--------------+------------------+
-- > | MULTISELECT  | array of strings |
-- > +--------------+------------------+
-- > | HIDDEN       | string           |
-- > +--------------+------------------+
-- > | BUNDLE_ARRAY | array of objects |
-- > +--------------+------------------+
--
-- /See:/ 'applicationPolicyManagedConfiguration' smart constructor.
newtype ApplicationPolicyManagedConfiguration =
  ApplicationPolicyManagedConfiguration'
    { _apmcAddtional :: HashMap Text JSONValue
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ApplicationPolicyManagedConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apmcAddtional'
applicationPolicyManagedConfiguration
    :: HashMap Text JSONValue -- ^ 'apmcAddtional'
    -> ApplicationPolicyManagedConfiguration
applicationPolicyManagedConfiguration pApmcAddtional_ =
  ApplicationPolicyManagedConfiguration'
    {_apmcAddtional = _Coerce # pApmcAddtional_}


-- | Properties of the object.
apmcAddtional :: Lens' ApplicationPolicyManagedConfiguration (HashMap Text JSONValue)
apmcAddtional
  = lens _apmcAddtional
      (\ s a -> s{_apmcAddtional = a})
      . _Coerce

instance FromJSON
           ApplicationPolicyManagedConfiguration
         where
        parseJSON
          = withObject "ApplicationPolicyManagedConfiguration"
              (\ o ->
                 ApplicationPolicyManagedConfiguration' <$>
                   (parseJSONObject o))

instance ToJSON ApplicationPolicyManagedConfiguration
         where
        toJSON = toJSON . _apmcAddtional

-- | Settings controlling the behavior of status reports.
--
-- /See:/ 'statusReportingSettings' smart constructor.
data StatusReportingSettings =
  StatusReportingSettings'
    { _srsSoftwareInfoEnabled          :: !(Maybe Bool)
    , _srsHardwareStatusEnabled        :: !(Maybe Bool)
    , _srsPowerManagementEventsEnabled :: !(Maybe Bool)
    , _srsDisplayInfoEnabled           :: !(Maybe Bool)
    , _srsApplicationReportsEnabled    :: !(Maybe Bool)
    , _srsMemoryInfoEnabled            :: !(Maybe Bool)
    , _srsNetworkInfoEnabled           :: !(Maybe Bool)
    , _srsDeviceSettingsEnabled        :: !(Maybe Bool)
    , _srsApplicationReportingSettings :: !(Maybe ApplicationReportingSettings)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'StatusReportingSettings' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'srsSoftwareInfoEnabled'
--
-- * 'srsHardwareStatusEnabled'
--
-- * 'srsPowerManagementEventsEnabled'
--
-- * 'srsDisplayInfoEnabled'
--
-- * 'srsApplicationReportsEnabled'
--
-- * 'srsMemoryInfoEnabled'
--
-- * 'srsNetworkInfoEnabled'
--
-- * 'srsDeviceSettingsEnabled'
--
-- * 'srsApplicationReportingSettings'
statusReportingSettings
    :: StatusReportingSettings
statusReportingSettings =
  StatusReportingSettings'
    { _srsSoftwareInfoEnabled = Nothing
    , _srsHardwareStatusEnabled = Nothing
    , _srsPowerManagementEventsEnabled = Nothing
    , _srsDisplayInfoEnabled = Nothing
    , _srsApplicationReportsEnabled = Nothing
    , _srsMemoryInfoEnabled = Nothing
    , _srsNetworkInfoEnabled = Nothing
    , _srsDeviceSettingsEnabled = Nothing
    , _srsApplicationReportingSettings = Nothing
    }


-- | Whether software info reporting is enabled.
srsSoftwareInfoEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsSoftwareInfoEnabled
  = lens _srsSoftwareInfoEnabled
      (\ s a -> s{_srsSoftwareInfoEnabled = a})

-- | Whether hardware status reporting is enabled.
srsHardwareStatusEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsHardwareStatusEnabled
  = lens _srsHardwareStatusEnabled
      (\ s a -> s{_srsHardwareStatusEnabled = a})

-- | Whether power management event reporting is enabled.
srsPowerManagementEventsEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsPowerManagementEventsEnabled
  = lens _srsPowerManagementEventsEnabled
      (\ s a -> s{_srsPowerManagementEventsEnabled = a})

-- | Whether displays reporting is enabled.
srsDisplayInfoEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsDisplayInfoEnabled
  = lens _srsDisplayInfoEnabled
      (\ s a -> s{_srsDisplayInfoEnabled = a})

-- | Whether app reports are enabled.
srsApplicationReportsEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsApplicationReportsEnabled
  = lens _srsApplicationReportsEnabled
      (\ s a -> s{_srsApplicationReportsEnabled = a})

-- | Whether memory reporting is enabled.
srsMemoryInfoEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsMemoryInfoEnabled
  = lens _srsMemoryInfoEnabled
      (\ s a -> s{_srsMemoryInfoEnabled = a})

-- | Whether network info reporting is enabled.
srsNetworkInfoEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsNetworkInfoEnabled
  = lens _srsNetworkInfoEnabled
      (\ s a -> s{_srsNetworkInfoEnabled = a})

-- | Whether device settings reporting is enabled.
srsDeviceSettingsEnabled :: Lens' StatusReportingSettings (Maybe Bool)
srsDeviceSettingsEnabled
  = lens _srsDeviceSettingsEnabled
      (\ s a -> s{_srsDeviceSettingsEnabled = a})

-- | Application reporting settings. Only applicable if
-- application_reports_enabled is true.
srsApplicationReportingSettings :: Lens' StatusReportingSettings (Maybe ApplicationReportingSettings)
srsApplicationReportingSettings
  = lens _srsApplicationReportingSettings
      (\ s a -> s{_srsApplicationReportingSettings = a})

instance FromJSON StatusReportingSettings where
        parseJSON
          = withObject "StatusReportingSettings"
              (\ o ->
                 StatusReportingSettings' <$>
                   (o .:? "softwareInfoEnabled") <*>
                     (o .:? "hardwareStatusEnabled")
                     <*> (o .:? "powerManagementEventsEnabled")
                     <*> (o .:? "displayInfoEnabled")
                     <*> (o .:? "applicationReportsEnabled")
                     <*> (o .:? "memoryInfoEnabled")
                     <*> (o .:? "networkInfoEnabled")
                     <*> (o .:? "deviceSettingsEnabled")
                     <*> (o .:? "applicationReportingSettings"))

instance ToJSON StatusReportingSettings where
        toJSON StatusReportingSettings'{..}
          = object
              (catMaybes
                 [("softwareInfoEnabled" .=) <$>
                    _srsSoftwareInfoEnabled,
                  ("hardwareStatusEnabled" .=) <$>
                    _srsHardwareStatusEnabled,
                  ("powerManagementEventsEnabled" .=) <$>
                    _srsPowerManagementEventsEnabled,
                  ("displayInfoEnabled" .=) <$> _srsDisplayInfoEnabled,
                  ("applicationReportsEnabled" .=) <$>
                    _srsApplicationReportsEnabled,
                  ("memoryInfoEnabled" .=) <$> _srsMemoryInfoEnabled,
                  ("networkInfoEnabled" .=) <$> _srsNetworkInfoEnabled,
                  ("deviceSettingsEnabled" .=) <$>
                    _srsDeviceSettingsEnabled,
                  ("applicationReportingSettings" .=) <$>
                    _srsApplicationReportingSettings])

-- | An icon for a web app. Supported formats are: png, jpg and webp.
--
-- /See:/ 'webAppIcon' smart constructor.
newtype WebAppIcon =
  WebAppIcon'
    { _waiImageData :: Maybe Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'WebAppIcon' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'waiImageData'
webAppIcon
    :: WebAppIcon
webAppIcon = WebAppIcon' {_waiImageData = Nothing}


-- | The actual bytes of the image in a base64url encoded string (c.f.
-- RFC4648, section 5 \"Base 64 Encoding with URL and Filename Safe
-- Alphabet\").
--
-- -   The image type can be png or jpg.
-- -   The image should ideally be square.
-- -   The image should ideally have a size of 512x512.
waiImageData :: Lens' WebAppIcon (Maybe Text)
waiImageData
  = lens _waiImageData (\ s a -> s{_waiImageData = a})

instance FromJSON WebAppIcon where
        parseJSON
          = withObject "WebAppIcon"
              (\ o -> WebAppIcon' <$> (o .:? "imageData"))

instance ToJSON WebAppIcon where
        toJSON WebAppIcon'{..}
          = object
              (catMaybes [("imageData" .=) <$> _waiImageData])

-- | Policy for an individual app.
--
-- /See:/ 'applicationPolicy' smart constructor.
data ApplicationPolicy =
  ApplicationPolicy'
    { _apDelegatedScopes              :: !(Maybe [Text])
    , _apPackageName                  :: !(Maybe Text)
    , _apManagedConfiguration         :: !(Maybe ApplicationPolicyManagedConfiguration)
    , _apDefaultPermissionPolicy      :: !(Maybe ApplicationPolicyDefaultPermissionPolicy)
    , _apDisabled                     :: !(Maybe Bool)
    , _apLockTaskAllowed              :: !(Maybe Bool)
    , _apPermissionGrants             :: !(Maybe [PermissionGrant])
    , _apManagedConfigurationTemplate :: !(Maybe ManagedConfigurationTemplate)
    , _apMinimumVersionCode           :: !(Maybe (Textual Int32))
    , _apInstallType                  :: !(Maybe ApplicationPolicyInstallType)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ApplicationPolicy' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apDelegatedScopes'
--
-- * 'apPackageName'
--
-- * 'apManagedConfiguration'
--
-- * 'apDefaultPermissionPolicy'
--
-- * 'apDisabled'
--
-- * 'apLockTaskAllowed'
--
-- * 'apPermissionGrants'
--
-- * 'apManagedConfigurationTemplate'
--
-- * 'apMinimumVersionCode'
--
-- * 'apInstallType'
applicationPolicy
    :: ApplicationPolicy
applicationPolicy =
  ApplicationPolicy'
    { _apDelegatedScopes = Nothing
    , _apPackageName = Nothing
    , _apManagedConfiguration = Nothing
    , _apDefaultPermissionPolicy = Nothing
    , _apDisabled = Nothing
    , _apLockTaskAllowed = Nothing
    , _apPermissionGrants = Nothing
    , _apManagedConfigurationTemplate = Nothing
    , _apMinimumVersionCode = Nothing
    , _apInstallType = Nothing
    }


-- | The scopes delegated to the app from Android Device Policy.
apDelegatedScopes :: Lens' ApplicationPolicy [Text]
apDelegatedScopes
  = lens _apDelegatedScopes
      (\ s a -> s{_apDelegatedScopes = a})
      . _Default
      . _Coerce

-- | The package name of the app. For example, com.google.android.youtube for
-- the YouTube app.
apPackageName :: Lens' ApplicationPolicy (Maybe Text)
apPackageName
  = lens _apPackageName
      (\ s a -> s{_apPackageName = a})

-- | Managed configuration applied to the app. The format for the
-- configuration is dictated by the ManagedProperty values supported by the
-- app. Each field name in the managed configuration must match the key
-- field of the ManagedProperty. The field value must be compatible with
-- the type of the ManagedProperty:
-- > +--------------+------------------+
-- > | /type/       | /JSON value/     |
-- > +--------------+------------------+
-- > | BOOL         | true or false    |
-- > +--------------+------------------+
-- > | STRING       | string           |
-- > +--------------+------------------+
-- > | INTEGER      | number           |
-- > +--------------+------------------+
-- > | CHOICE       | string           |
-- > +--------------+------------------+
-- > | MULTISELECT  | array of strings |
-- > +--------------+------------------+
-- > | HIDDEN       | string           |
-- > +--------------+------------------+
-- > | BUNDLE_ARRAY | array of objects |
-- > +--------------+------------------+
apManagedConfiguration :: Lens' ApplicationPolicy (Maybe ApplicationPolicyManagedConfiguration)
apManagedConfiguration
  = lens _apManagedConfiguration
      (\ s a -> s{_apManagedConfiguration = a})

-- | The default policy for all permissions requested by the app. If
-- specified, this overrides the policy-level default_permission_policy
-- which applies to all apps. It does not override the permission_grants
-- which applies to all apps.
apDefaultPermissionPolicy :: Lens' ApplicationPolicy (Maybe ApplicationPolicyDefaultPermissionPolicy)
apDefaultPermissionPolicy
  = lens _apDefaultPermissionPolicy
      (\ s a -> s{_apDefaultPermissionPolicy = a})

-- | Whether the app is disabled. When disabled, the app data is still
-- preserved.
apDisabled :: Lens' ApplicationPolicy (Maybe Bool)
apDisabled
  = lens _apDisabled (\ s a -> s{_apDisabled = a})

-- | Whether the app is allowed to lock itself in full-screen mode.
apLockTaskAllowed :: Lens' ApplicationPolicy (Maybe Bool)
apLockTaskAllowed
  = lens _apLockTaskAllowed
      (\ s a -> s{_apLockTaskAllowed = a})

-- | Explicit permission grants or denials for the app. These values override
-- the default_permission_policy and permission_grants which apply to all
-- apps.
apPermissionGrants :: Lens' ApplicationPolicy [PermissionGrant]
apPermissionGrants
  = lens _apPermissionGrants
      (\ s a -> s{_apPermissionGrants = a})
      . _Default
      . _Coerce

-- | The managed configurations template for the app, saved from the managed
-- configurations iframe. This field is ignored if managed_configuration is
-- set.
apManagedConfigurationTemplate :: Lens' ApplicationPolicy (Maybe ManagedConfigurationTemplate)
apManagedConfigurationTemplate
  = lens _apManagedConfigurationTemplate
      (\ s a -> s{_apManagedConfigurationTemplate = a})

-- | The minimum version of the app that runs on the device. If set, the
-- device attempts to update the app to at least this version code. If the
-- app is not up-to-date, the device will contain a NonComplianceDetail
-- with non_compliance_reason set to APP_NOT_UPDATED. The app must already
-- be published to Google Play with a version code greater than or equal to
-- this value. At most 20 apps may specify a minimum version code per
-- policy.
apMinimumVersionCode :: Lens' ApplicationPolicy (Maybe Int32)
apMinimumVersionCode
  = lens _apMinimumVersionCode
      (\ s a -> s{_apMinimumVersionCode = a})
      . mapping _Coerce

-- | The type of installation to perform.
apInstallType :: Lens' ApplicationPolicy (Maybe ApplicationPolicyInstallType)
apInstallType
  = lens _apInstallType
      (\ s a -> s{_apInstallType = a})

instance FromJSON ApplicationPolicy where
        parseJSON
          = withObject "ApplicationPolicy"
              (\ o ->
                 ApplicationPolicy' <$>
                   (o .:? "delegatedScopes" .!= mempty) <*>
                     (o .:? "packageName")
                     <*> (o .:? "managedConfiguration")
                     <*> (o .:? "defaultPermissionPolicy")
                     <*> (o .:? "disabled")
                     <*> (o .:? "lockTaskAllowed")
                     <*> (o .:? "permissionGrants" .!= mempty)
                     <*> (o .:? "managedConfigurationTemplate")
                     <*> (o .:? "minimumVersionCode")
                     <*> (o .:? "installType"))

instance ToJSON ApplicationPolicy where
        toJSON ApplicationPolicy'{..}
          = object
              (catMaybes
                 [("delegatedScopes" .=) <$> _apDelegatedScopes,
                  ("packageName" .=) <$> _apPackageName,
                  ("managedConfiguration" .=) <$>
                    _apManagedConfiguration,
                  ("defaultPermissionPolicy" .=) <$>
                    _apDefaultPermissionPolicy,
                  ("disabled" .=) <$> _apDisabled,
                  ("lockTaskAllowed" .=) <$> _apLockTaskAllowed,
                  ("permissionGrants" .=) <$> _apPermissionGrants,
                  ("managedConfigurationTemplate" .=) <$>
                    _apManagedConfigurationTemplate,
                  ("minimumVersionCode" .=) <$> _apMinimumVersionCode,
                  ("installType" .=) <$> _apInstallType])

-- | Response to a request to list devices for a given enterprise.
--
-- /See:/ 'listDevicesResponse' smart constructor.
data ListDevicesResponse =
  ListDevicesResponse'
    { _ldrNextPageToken :: !(Maybe Text)
    , _ldrDevices       :: !(Maybe [Device])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ListDevicesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ldrNextPageToken'
--
-- * 'ldrDevices'
listDevicesResponse
    :: ListDevicesResponse
listDevicesResponse =
  ListDevicesResponse' {_ldrNextPageToken = Nothing, _ldrDevices = Nothing}


-- | If there are more results, a token to retrieve next page of results.
ldrNextPageToken :: Lens' ListDevicesResponse (Maybe Text)
ldrNextPageToken
  = lens _ldrNextPageToken
      (\ s a -> s{_ldrNextPageToken = a})

-- | The list of devices.
ldrDevices :: Lens' ListDevicesResponse [Device]
ldrDevices
  = lens _ldrDevices (\ s a -> s{_ldrDevices = a}) .
      _Default
      . _Coerce

instance FromJSON ListDevicesResponse where
        parseJSON
          = withObject "ListDevicesResponse"
              (\ o ->
                 ListDevicesResponse' <$>
                   (o .:? "nextPageToken") <*>
                     (o .:? "devices" .!= mempty))

instance ToJSON ListDevicesResponse where
        toJSON ListDevicesResponse'{..}
          = object
              (catMaybes
                 [("nextPageToken" .=) <$> _ldrNextPageToken,
                  ("devices" .=) <$> _ldrDevices])

-- | The managed configurations template for the app, saved from the managed
-- configurations iframe.
--
-- /See:/ 'managedConfigurationTemplate' smart constructor.
data ManagedConfigurationTemplate =
  ManagedConfigurationTemplate'
    { _mctTemplateId             :: !(Maybe Text)
    , _mctConfigurationVariables :: !(Maybe ManagedConfigurationTemplateConfigurationVariables)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ManagedConfigurationTemplate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mctTemplateId'
--
-- * 'mctConfigurationVariables'
managedConfigurationTemplate
    :: ManagedConfigurationTemplate
managedConfigurationTemplate =
  ManagedConfigurationTemplate'
    {_mctTemplateId = Nothing, _mctConfigurationVariables = Nothing}


-- | The ID of the managed configurations template.
mctTemplateId :: Lens' ManagedConfigurationTemplate (Maybe Text)
mctTemplateId
  = lens _mctTemplateId
      (\ s a -> s{_mctTemplateId = a})

-- | Optional, a map containing configuration variables defined for the
-- configuration.
mctConfigurationVariables :: Lens' ManagedConfigurationTemplate (Maybe ManagedConfigurationTemplateConfigurationVariables)
mctConfigurationVariables
  = lens _mctConfigurationVariables
      (\ s a -> s{_mctConfigurationVariables = a})

instance FromJSON ManagedConfigurationTemplate where
        parseJSON
          = withObject "ManagedConfigurationTemplate"
              (\ o ->
                 ManagedConfigurationTemplate' <$>
                   (o .:? "templateId") <*>
                     (o .:? "configurationVariables"))

instance ToJSON ManagedConfigurationTemplate where
        toJSON ManagedConfigurationTemplate'{..}
          = object
              (catMaybes
                 [("templateId" .=) <$> _mctTemplateId,
                  ("configurationVariables" .=) <$>
                    _mctConfigurationVariables])

-- | The configuration applied to an enterprise.
--
-- /See:/ 'enterprise' smart constructor.
data Enterprise =
  Enterprise'
    { _eAppAutoApprovalEnabled   :: !(Maybe Bool)
    , _eEnabledNotificationTypes :: !(Maybe [Text])
    , _eSigninDetails            :: !(Maybe [SigninDetail])
    , _eName                     :: !(Maybe Text)
    , _ePubsubTopic              :: !(Maybe Text)
    , _eEnterpriseDisplayName    :: !(Maybe Text)
    , _eLogo                     :: !(Maybe ExternalData)
    , _eTermsAndConditions       :: !(Maybe [TermsAndConditions])
    , _ePrimaryColor             :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Enterprise' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eAppAutoApprovalEnabled'
--
-- * 'eEnabledNotificationTypes'
--
-- * 'eSigninDetails'
--
-- * 'eName'
--
-- * 'ePubsubTopic'
--
-- * 'eEnterpriseDisplayName'
--
-- * 'eLogo'
--
-- * 'eTermsAndConditions'
--
-- * 'ePrimaryColor'
enterprise
    :: Enterprise
enterprise =
  Enterprise'
    { _eAppAutoApprovalEnabled = Nothing
    , _eEnabledNotificationTypes = Nothing
    , _eSigninDetails = Nothing
    , _eName = Nothing
    , _ePubsubTopic = Nothing
    , _eEnterpriseDisplayName = Nothing
    , _eLogo = Nothing
    , _eTermsAndConditions = Nothing
    , _ePrimaryColor = Nothing
    }


-- | Deprecated and unused.
eAppAutoApprovalEnabled :: Lens' Enterprise (Maybe Bool)
eAppAutoApprovalEnabled
  = lens _eAppAutoApprovalEnabled
      (\ s a -> s{_eAppAutoApprovalEnabled = a})

-- | The types of Google Pub\/Sub notifications enabled for the enterprise.
eEnabledNotificationTypes :: Lens' Enterprise [Text]
eEnabledNotificationTypes
  = lens _eEnabledNotificationTypes
      (\ s a -> s{_eEnabledNotificationTypes = a})
      . _Default
      . _Coerce

-- | Sign-in details of the enterprise. Maximum of 1 SigninDetail is
-- supported.
eSigninDetails :: Lens' Enterprise [SigninDetail]
eSigninDetails
  = lens _eSigninDetails
      (\ s a -> s{_eSigninDetails = a})
      . _Default
      . _Coerce

-- | The name of the enterprise which is generated by the server during
-- creation, in the form enterprises\/{enterpriseId}.
eName :: Lens' Enterprise (Maybe Text)
eName = lens _eName (\ s a -> s{_eName = a})

-- | The topic that Cloud Pub\/Sub notifications are published to, in the
-- form projects\/{project}\/topics\/{topic}. This field is only required
-- if Pub\/Sub notifications are enabled.
ePubsubTopic :: Lens' Enterprise (Maybe Text)
ePubsubTopic
  = lens _ePubsubTopic (\ s a -> s{_ePubsubTopic = a})

-- | The name of the enterprise displayed to users.
eEnterpriseDisplayName :: Lens' Enterprise (Maybe Text)
eEnterpriseDisplayName
  = lens _eEnterpriseDisplayName
      (\ s a -> s{_eEnterpriseDisplayName = a})

-- | An image displayed as a logo during device provisioning. Supported types
-- are: image\/bmp, image\/gif, image\/x-ico, image\/jpeg, image\/png,
-- image\/webp, image\/vnd.wap.wbmp, image\/x-adobe-dng.
eLogo :: Lens' Enterprise (Maybe ExternalData)
eLogo = lens _eLogo (\ s a -> s{_eLogo = a})

-- | Terms and conditions that must be accepted when provisioning a device
-- for this enterprise. A page of terms is generated for each value in this
-- list.
eTermsAndConditions :: Lens' Enterprise [TermsAndConditions]
eTermsAndConditions
  = lens _eTermsAndConditions
      (\ s a -> s{_eTermsAndConditions = a})
      . _Default
      . _Coerce

-- | A color in RGB format that indicates the predominant color to display in
-- the device management app UI. The color components are stored as
-- follows: (red \<\< 16) | (green \<\< 8) | blue, where the value of each
-- component is between 0 and 255, inclusive.
ePrimaryColor :: Lens' Enterprise (Maybe Int32)
ePrimaryColor
  = lens _ePrimaryColor
      (\ s a -> s{_ePrimaryColor = a})
      . mapping _Coerce

instance FromJSON Enterprise where
        parseJSON
          = withObject "Enterprise"
              (\ o ->
                 Enterprise' <$>
                   (o .:? "appAutoApprovalEnabled") <*>
                     (o .:? "enabledNotificationTypes" .!= mempty)
                     <*> (o .:? "signinDetails" .!= mempty)
                     <*> (o .:? "name")
                     <*> (o .:? "pubsubTopic")
                     <*> (o .:? "enterpriseDisplayName")
                     <*> (o .:? "logo")
                     <*> (o .:? "termsAndConditions" .!= mempty)
                     <*> (o .:? "primaryColor"))

instance ToJSON Enterprise where
        toJSON Enterprise'{..}
          = object
              (catMaybes
                 [("appAutoApprovalEnabled" .=) <$>
                    _eAppAutoApprovalEnabled,
                  ("enabledNotificationTypes" .=) <$>
                    _eEnabledNotificationTypes,
                  ("signinDetails" .=) <$> _eSigninDetails,
                  ("name" .=) <$> _eName,
                  ("pubsubTopic" .=) <$> _ePubsubTopic,
                  ("enterpriseDisplayName" .=) <$>
                    _eEnterpriseDisplayName,
                  ("logo" .=) <$> _eLogo,
                  ("termsAndConditions" .=) <$> _eTermsAndConditions,
                  ("primaryColor" .=) <$> _ePrimaryColor])

-- | An event related to memory and storage measurements.
--
-- /See:/ 'memoryEvent' smart constructor.
data MemoryEvent =
  MemoryEvent'
    { _meByteCount  :: !(Maybe (Textual Int64))
    , _meEventType  :: !(Maybe MemoryEventEventType)
    , _meCreateTime :: !(Maybe DateTime')
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'MemoryEvent' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'meByteCount'
--
-- * 'meEventType'
--
-- * 'meCreateTime'
memoryEvent
    :: MemoryEvent
memoryEvent =
  MemoryEvent'
    {_meByteCount = Nothing, _meEventType = Nothing, _meCreateTime = Nothing}


-- | The number of free bytes in the medium, or for
-- EXTERNAL_STORAGE_DETECTED, the total capacity in bytes of the storage
-- medium.
meByteCount :: Lens' MemoryEvent (Maybe Int64)
meByteCount
  = lens _meByteCount (\ s a -> s{_meByteCount = a}) .
      mapping _Coerce

-- | Event type.
meEventType :: Lens' MemoryEvent (Maybe MemoryEventEventType)
meEventType
  = lens _meEventType (\ s a -> s{_meEventType = a})

-- | The creation time of the event.
meCreateTime :: Lens' MemoryEvent (Maybe UTCTime)
meCreateTime
  = lens _meCreateTime (\ s a -> s{_meCreateTime = a})
      . mapping _DateTime

instance FromJSON MemoryEvent where
        parseJSON
          = withObject "MemoryEvent"
              (\ o ->
                 MemoryEvent' <$>
                   (o .:? "byteCount") <*> (o .:? "eventType") <*>
                     (o .:? "createTime"))

instance ToJSON MemoryEvent where
        toJSON MemoryEvent'{..}
          = object
              (catMaybes
                 [("byteCount" .=) <$> _meByteCount,
                  ("eventType" .=) <$> _meEventType,
                  ("createTime" .=) <$> _meCreateTime])

-- | Configuration for an Android permission and its grant state.
--
-- /See:/ 'permissionGrant' smart constructor.
data PermissionGrant =
  PermissionGrant'
    { _pgPolicy     :: !(Maybe PermissionGrantPolicy)
    , _pgPermission :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PermissionGrant' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pgPolicy'
--
-- * 'pgPermission'
permissionGrant
    :: PermissionGrant
permissionGrant =
  PermissionGrant' {_pgPolicy = Nothing, _pgPermission = Nothing}


-- | The policy for granting the permission.
pgPolicy :: Lens' PermissionGrant (Maybe PermissionGrantPolicy)
pgPolicy = lens _pgPolicy (\ s a -> s{_pgPolicy = a})

-- | The Android permission or group, e.g. android.permission.READ_CALENDAR
-- or android.permission_group.CALENDAR.
pgPermission :: Lens' PermissionGrant (Maybe Text)
pgPermission
  = lens _pgPermission (\ s a -> s{_pgPermission = a})

instance FromJSON PermissionGrant where
        parseJSON
          = withObject "PermissionGrant"
              (\ o ->
                 PermissionGrant' <$>
                   (o .:? "policy") <*> (o .:? "permission"))

instance ToJSON PermissionGrant where
        toJSON PermissionGrant'{..}
          = object
              (catMaybes
                 [("policy" .=) <$> _pgPolicy,
                  ("permission" .=) <$> _pgPermission])

-- | A resource containing sign in details for an enterprise.
--
-- /See:/ 'signinDetail' smart constructor.
data SigninDetail =
  SigninDetail'
    { _sdSigninURL             :: !(Maybe Text)
    , _sdQrCode                :: !(Maybe Text)
    , _sdSigninEnrollmentToken :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SigninDetail' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sdSigninURL'
--
-- * 'sdQrCode'
--
-- * 'sdSigninEnrollmentToken'
signinDetail
    :: SigninDetail
signinDetail =
  SigninDetail'
    { _sdSigninURL = Nothing
    , _sdQrCode = Nothing
    , _sdSigninEnrollmentToken = Nothing
    }


-- | Sign-in URL for authentication when device is provisioned with a sign-in
-- enrollment token. The sign-in endpoint should finish authentication flow
-- with a URL in the form of
-- https:\/\/enterprise.google.com\/android\/enroll?et= for a successful
-- login, or https:\/\/enterprise.google.com\/android\/enroll\/invalid for
-- a failed login.
sdSigninURL :: Lens' SigninDetail (Maybe Text)
sdSigninURL
  = lens _sdSigninURL (\ s a -> s{_sdSigninURL = a})

-- | A JSON string whose UTF-8 representation can be used to generate a QR
-- code to enroll a device with this enrollment token. To enroll a device
-- using NFC, the NFC record must contain a serialized java.util.Properties
-- representation of the properties in the JSON. This is a read-only field
-- generated by the server.
sdQrCode :: Lens' SigninDetail (Maybe Text)
sdQrCode = lens _sdQrCode (\ s a -> s{_sdQrCode = a})

-- | An enterprise wide enrollment token used to trigger custom sign-in flow.
-- This is a read-only field generated by the server.
sdSigninEnrollmentToken :: Lens' SigninDetail (Maybe Text)
sdSigninEnrollmentToken
  = lens _sdSigninEnrollmentToken
      (\ s a -> s{_sdSigninEnrollmentToken = a})

instance FromJSON SigninDetail where
        parseJSON
          = withObject "SigninDetail"
              (\ o ->
                 SigninDetail' <$>
                   (o .:? "signinUrl") <*> (o .:? "qrCode") <*>
                     (o .:? "signinEnrollmentToken"))

instance ToJSON SigninDetail where
        toJSON SigninDetail'{..}
          = object
              (catMaybes
                 [("signinUrl" .=) <$> _sdSigninURL,
                  ("qrCode" .=) <$> _sdQrCode,
                  ("signinEnrollmentToken" .=) <$>
                    _sdSigninEnrollmentToken])

-- | An enterprise signup URL.
--
-- /See:/ 'signupURL' smart constructor.
data SignupURL =
  SignupURL'
    { _suURL  :: !(Maybe Text)
    , _suName :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SignupURL' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'suURL'
--
-- * 'suName'
signupURL
    :: SignupURL
signupURL = SignupURL' {_suURL = Nothing, _suName = Nothing}


-- | A URL where an enterprise admin can register their enterprise. The page
-- can\'t be rendered in an iframe.
suURL :: Lens' SignupURL (Maybe Text)
suURL = lens _suURL (\ s a -> s{_suURL = a})

-- | The name of the resource. Use this value in the signupUrl field when
-- calling enterprises.create to complete the enterprise signup flow.
suName :: Lens' SignupURL (Maybe Text)
suName = lens _suName (\ s a -> s{_suName = a})

instance FromJSON SignupURL where
        parseJSON
          = withObject "SignupURL"
              (\ o ->
                 SignupURL' <$> (o .:? "url") <*> (o .:? "name"))

instance ToJSON SignupURL where
        toJSON SignupURL'{..}
          = object
              (catMaybes
                 [("url" .=) <$> _suURL, ("name" .=) <$> _suName])

-- | Device network info.
--
-- /See:/ 'networkInfo' smart constructor.
data NetworkInfo =
  NetworkInfo'
    { _niNetworkOperatorName :: !(Maybe Text)
    , _niMeid                :: !(Maybe Text)
    , _niImei                :: !(Maybe Text)
    , _niWifiMACAddress      :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'NetworkInfo' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'niNetworkOperatorName'
--
-- * 'niMeid'
--
-- * 'niImei'
--
-- * 'niWifiMACAddress'
networkInfo
    :: NetworkInfo
networkInfo =
  NetworkInfo'
    { _niNetworkOperatorName = Nothing
    , _niMeid = Nothing
    , _niImei = Nothing
    , _niWifiMACAddress = Nothing
    }


-- | Alphabetic name of current registered operator. For example, Vodafone.
niNetworkOperatorName :: Lens' NetworkInfo (Maybe Text)
niNetworkOperatorName
  = lens _niNetworkOperatorName
      (\ s a -> s{_niNetworkOperatorName = a})

-- | MEID number of the CDMA device. For example, A00000292788E1.
niMeid :: Lens' NetworkInfo (Maybe Text)
niMeid = lens _niMeid (\ s a -> s{_niMeid = a})

-- | IMEI number of the GSM device. For example, A1000031212.
niImei :: Lens' NetworkInfo (Maybe Text)
niImei = lens _niImei (\ s a -> s{_niImei = a})

-- | Wi-Fi MAC address of the device. For example, 7c:11:11:11:11:11.
niWifiMACAddress :: Lens' NetworkInfo (Maybe Text)
niWifiMACAddress
  = lens _niWifiMACAddress
      (\ s a -> s{_niWifiMACAddress = a})

instance FromJSON NetworkInfo where
        parseJSON
          = withObject "NetworkInfo"
              (\ o ->
                 NetworkInfo' <$>
                   (o .:? "networkOperatorName") <*> (o .:? "meid") <*>
                     (o .:? "imei")
                     <*> (o .:? "wifiMacAddress"))

instance ToJSON NetworkInfo where
        toJSON NetworkInfo'{..}
          = object
              (catMaybes
                 [("networkOperatorName" .=) <$>
                    _niNetworkOperatorName,
                  ("meid" .=) <$> _niMeid, ("imei" .=) <$> _niImei,
                  ("wifiMacAddress" .=) <$> _niWifiMACAddress])

-- | A power management event.
--
-- /See:/ 'powerManagementEvent' smart constructor.
data PowerManagementEvent =
  PowerManagementEvent'
    { _pmeBatteryLevel :: !(Maybe (Textual Double))
    , _pmeEventType    :: !(Maybe PowerManagementEventEventType)
    , _pmeCreateTime   :: !(Maybe DateTime')
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PowerManagementEvent' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pmeBatteryLevel'
--
-- * 'pmeEventType'
--
-- * 'pmeCreateTime'
powerManagementEvent
    :: PowerManagementEvent
powerManagementEvent =
  PowerManagementEvent'
    { _pmeBatteryLevel = Nothing
    , _pmeEventType = Nothing
    , _pmeCreateTime = Nothing
    }


-- | For BATTERY_LEVEL_COLLECTED events, the battery level as a percentage.
pmeBatteryLevel :: Lens' PowerManagementEvent (Maybe Double)
pmeBatteryLevel
  = lens _pmeBatteryLevel
      (\ s a -> s{_pmeBatteryLevel = a})
      . mapping _Coerce

-- | Event type.
pmeEventType :: Lens' PowerManagementEvent (Maybe PowerManagementEventEventType)
pmeEventType
  = lens _pmeEventType (\ s a -> s{_pmeEventType = a})

-- | The creation time of the event.
pmeCreateTime :: Lens' PowerManagementEvent (Maybe UTCTime)
pmeCreateTime
  = lens _pmeCreateTime
      (\ s a -> s{_pmeCreateTime = a})
      . mapping _DateTime

instance FromJSON PowerManagementEvent where
        parseJSON
          = withObject "PowerManagementEvent"
              (\ o ->
                 PowerManagementEvent' <$>
                   (o .:? "batteryLevel") <*> (o .:? "eventType") <*>
                     (o .:? "createTime"))

instance ToJSON PowerManagementEvent where
        toJSON PowerManagementEvent'{..}
          = object
              (catMaybes
                 [("batteryLevel" .=) <$> _pmeBatteryLevel,
                  ("eventType" .=) <$> _pmeEventType,
                  ("createTime" .=) <$> _pmeCreateTime])

-- | A policy resources represents a group settings that govern the behavior
-- of a managed device and the apps installed on it.
--
-- /See:/ 'policy' smart constructor.
data Policy =
  Policy'
    { _pBluetoothConfigDisabled            :: !(Maybe Bool)
    , _pUnmuteMicrophoneDisabled           :: !(Maybe Bool)
    , _pMountPhysicalMediaDisabled         :: !(Maybe Bool)
    , _pFrpAdminEmails                     :: !(Maybe [Text])
    , _pAppAutoUpdatePolicy                :: !(Maybe PolicyAppAutoUpdatePolicy)
    , _pEncryptionPolicy                   :: !(Maybe PolicyEncryptionPolicy)
    , _pAndroidDevicePolicyTracks          :: !(Maybe [Text])
    , _pSafeBootDisabled                   :: !(Maybe Bool)
    , _pAlwaysOnVPNPackage                 :: !(Maybe AlwaysOnVPNPackage)
    , _pChoosePrivateKeyRules              :: !(Maybe [ChoosePrivateKeyRule])
    , _pCredentialsConfigDisabled          :: !(Maybe Bool)
    , _pRecommendedGlobalProxy             :: !(Maybe ProxyInfo)
    , _pKeyguardDisabled                   :: !(Maybe Bool)
    , _pSkipFirstUseHintsEnabled           :: !(Maybe Bool)
    , _pAdjustVolumeDisabled               :: !(Maybe Bool)
    , _pDefaultPermissionPolicy            :: !(Maybe PolicyDefaultPermissionPo