{-# 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.BigQuery.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.BigQuery.Types.Product where

import           Network.Google.BigQuery.Types.Sum
import           Network.Google.Prelude

--
-- /See:/ 'jobReference' smart constructor.
data JobReference = JobReference'
    { _jrJobId     :: !(Maybe Text)
    , _jrLocation  :: !(Maybe Text)
    , _jrProjectId :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobReference' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jrJobId'
--
-- * 'jrLocation'
--
-- * 'jrProjectId'
jobReference
    :: JobReference
jobReference =
    JobReference'
    { _jrJobId = Nothing
    , _jrLocation = Nothing
    , _jrProjectId = Nothing
    }

-- | [Required] The ID of the job. The ID must contain only letters (a-z,
-- A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length
-- is 1,024 characters.
jrJobId :: Lens' JobReference (Maybe Text)
jrJobId = lens _jrJobId (\ s a -> s{_jrJobId = a})

-- | The geographic location of the job. See details at
-- https:\/\/cloud.google.com\/bigquery\/docs\/locations#specifying_your_location.
jrLocation :: Lens' JobReference (Maybe Text)
jrLocation
  = lens _jrLocation (\ s a -> s{_jrLocation = a})

-- | [Required] The ID of the project containing this job.
jrProjectId :: Lens' JobReference (Maybe Text)
jrProjectId
  = lens _jrProjectId (\ s a -> s{_jrProjectId = a})

instance FromJSON JobReference where
        parseJSON
          = withObject "JobReference"
              (\ o ->
                 JobReference' <$>
                   (o .:? "jobId") <*> (o .:? "location") <*>
                     (o .:? "projectId"))

instance ToJSON JobReference where
        toJSON JobReference'{..}
          = object
              (catMaybes
                 [("jobId" .=) <$> _jrJobId,
                  ("location" .=) <$> _jrLocation,
                  ("projectId" .=) <$> _jrProjectId])

--
-- /See:/ 'tableList' smart constructor.
data TableList = TableList'
    { _tlTotalItems    :: !(Maybe (Textual Int32))
    , _tlEtag          :: !(Maybe Text)
    , _tlNextPageToken :: !(Maybe Text)
    , _tlKind          :: !Text
    , _tlTables        :: !(Maybe [TableListTablesItem])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TableList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tlTotalItems'
--
-- * 'tlEtag'
--
-- * 'tlNextPageToken'
--
-- * 'tlKind'
--
-- * 'tlTables'
tableList
    :: TableList
tableList =
    TableList'
    { _tlTotalItems = Nothing
    , _tlEtag = Nothing
    , _tlNextPageToken = Nothing
    , _tlKind = "bigquery#tableList"
    , _tlTables = Nothing
    }

-- | The total number of tables in the dataset.
tlTotalItems :: Lens' TableList (Maybe Int32)
tlTotalItems
  = lens _tlTotalItems (\ s a -> s{_tlTotalItems = a})
      . mapping _Coerce

-- | A hash of this page of results.
tlEtag :: Lens' TableList (Maybe Text)
tlEtag = lens _tlEtag (\ s a -> s{_tlEtag = a})

-- | A token to request the next page of results.
tlNextPageToken :: Lens' TableList (Maybe Text)
tlNextPageToken
  = lens _tlNextPageToken
      (\ s a -> s{_tlNextPageToken = a})

-- | The type of list.
tlKind :: Lens' TableList Text
tlKind = lens _tlKind (\ s a -> s{_tlKind = a})

-- | Tables in the requested dataset.
tlTables :: Lens' TableList [TableListTablesItem]
tlTables
  = lens _tlTables (\ s a -> s{_tlTables = a}) .
      _Default
      . _Coerce

instance FromJSON TableList where
        parseJSON
          = withObject "TableList"
              (\ o ->
                 TableList' <$>
                   (o .:? "totalItems") <*> (o .:? "etag") <*>
                     (o .:? "nextPageToken")
                     <*> (o .:? "kind" .!= "bigquery#tableList")
                     <*> (o .:? "tables" .!= mempty))

instance ToJSON TableList where
        toJSON TableList'{..}
          = object
              (catMaybes
                 [("totalItems" .=) <$> _tlTotalItems,
                  ("etag" .=) <$> _tlEtag,
                  ("nextPageToken" .=) <$> _tlNextPageToken,
                  Just ("kind" .= _tlKind),
                  ("tables" .=) <$> _tlTables])

--
-- /See:/ 'dataSetListDataSetsItem' smart constructor.
data DataSetListDataSetsItem = DataSetListDataSetsItem'
    { _dsldsiLocation         :: !(Maybe Text)
    , _dsldsiFriendlyName     :: !(Maybe Text)
    , _dsldsiKind             :: !Text
    , _dsldsiDataSetReference :: !(Maybe DataSetReference)
    , _dsldsiId               :: !(Maybe Text)
    , _dsldsiLabels           :: !(Maybe DataSetListDataSetsItemLabels)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'DataSetListDataSetsItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsldsiLocation'
--
-- * 'dsldsiFriendlyName'
--
-- * 'dsldsiKind'
--
-- * 'dsldsiDataSetReference'
--
-- * 'dsldsiId'
--
-- * 'dsldsiLabels'
dataSetListDataSetsItem
    :: DataSetListDataSetsItem
dataSetListDataSetsItem =
    DataSetListDataSetsItem'
    { _dsldsiLocation = Nothing
    , _dsldsiFriendlyName = Nothing
    , _dsldsiKind = "bigquery#dataset"
    , _dsldsiDataSetReference = Nothing
    , _dsldsiId = Nothing
    , _dsldsiLabels = Nothing
    }

-- | The geographic location where the data resides.
dsldsiLocation :: Lens' DataSetListDataSetsItem (Maybe Text)
dsldsiLocation
  = lens _dsldsiLocation
      (\ s a -> s{_dsldsiLocation = a})

-- | A descriptive name for the dataset, if one exists.
dsldsiFriendlyName :: Lens' DataSetListDataSetsItem (Maybe Text)
dsldsiFriendlyName
  = lens _dsldsiFriendlyName
      (\ s a -> s{_dsldsiFriendlyName = a})

-- | The resource type. This property always returns the value
-- \"bigquery#dataset\".
dsldsiKind :: Lens' DataSetListDataSetsItem Text
dsldsiKind
  = lens _dsldsiKind (\ s a -> s{_dsldsiKind = a})

-- | The dataset reference. Use this property to access specific parts of the
-- dataset\'s ID, such as project ID or dataset ID.
dsldsiDataSetReference :: Lens' DataSetListDataSetsItem (Maybe DataSetReference)
dsldsiDataSetReference
  = lens _dsldsiDataSetReference
      (\ s a -> s{_dsldsiDataSetReference = a})

-- | The fully-qualified, unique, opaque ID of the dataset.
dsldsiId :: Lens' DataSetListDataSetsItem (Maybe Text)
dsldsiId = lens _dsldsiId (\ s a -> s{_dsldsiId = a})

-- | The labels associated with this dataset. You can use these to organize
-- and group your datasets.
dsldsiLabels :: Lens' DataSetListDataSetsItem (Maybe DataSetListDataSetsItemLabels)
dsldsiLabels
  = lens _dsldsiLabels (\ s a -> s{_dsldsiLabels = a})

instance FromJSON DataSetListDataSetsItem where
        parseJSON
          = withObject "DataSetListDataSetsItem"
              (\ o ->
                 DataSetListDataSetsItem' <$>
                   (o .:? "location") <*> (o .:? "friendlyName") <*>
                     (o .:? "kind" .!= "bigquery#dataset")
                     <*> (o .:? "datasetReference")
                     <*> (o .:? "id")
                     <*> (o .:? "labels"))

instance ToJSON DataSetListDataSetsItem where
        toJSON DataSetListDataSetsItem'{..}
          = object
              (catMaybes
                 [("location" .=) <$> _dsldsiLocation,
                  ("friendlyName" .=) <$> _dsldsiFriendlyName,
                  Just ("kind" .= _dsldsiKind),
                  ("datasetReference" .=) <$> _dsldsiDataSetReference,
                  ("id" .=) <$> _dsldsiId,
                  ("labels" .=) <$> _dsldsiLabels])

--
-- /See:/ 'tableDataList' smart constructor.
data TableDataList = TableDataList'
    { _tdlEtag      :: !(Maybe Text)
    , _tdlKind      :: !Text
    , _tdlRows      :: !(Maybe [TableRow])
    , _tdlPageToken :: !(Maybe Text)
    , _tdlTotalRows :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TableDataList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tdlEtag'
--
-- * 'tdlKind'
--
-- * 'tdlRows'
--
-- * 'tdlPageToken'
--
-- * 'tdlTotalRows'
tableDataList
    :: TableDataList
tableDataList =
    TableDataList'
    { _tdlEtag = Nothing
    , _tdlKind = "bigquery#tableDataList"
    , _tdlRows = Nothing
    , _tdlPageToken = Nothing
    , _tdlTotalRows = Nothing
    }

-- | A hash of this page of results.
tdlEtag :: Lens' TableDataList (Maybe Text)
tdlEtag = lens _tdlEtag (\ s a -> s{_tdlEtag = a})

-- | The resource type of the response.
tdlKind :: Lens' TableDataList Text
tdlKind = lens _tdlKind (\ s a -> s{_tdlKind = a})

-- | Rows of results.
tdlRows :: Lens' TableDataList [TableRow]
tdlRows
  = lens _tdlRows (\ s a -> s{_tdlRows = a}) . _Default
      . _Coerce

-- | A token used for paging results. Providing this token instead of the
-- startIndex parameter can help you retrieve stable results when an
-- underlying table is changing.
tdlPageToken :: Lens' TableDataList (Maybe Text)
tdlPageToken
  = lens _tdlPageToken (\ s a -> s{_tdlPageToken = a})

-- | The total number of rows in the complete table.
tdlTotalRows :: Lens' TableDataList (Maybe Int64)
tdlTotalRows
  = lens _tdlTotalRows (\ s a -> s{_tdlTotalRows = a})
      . mapping _Coerce

instance FromJSON TableDataList where
        parseJSON
          = withObject "TableDataList"
              (\ o ->
                 TableDataList' <$>
                   (o .:? "etag") <*>
                     (o .:? "kind" .!= "bigquery#tableDataList")
                     <*> (o .:? "rows" .!= mempty)
                     <*> (o .:? "pageToken")
                     <*> (o .:? "totalRows"))

instance ToJSON TableDataList where
        toJSON TableDataList'{..}
          = object
              (catMaybes
                 [("etag" .=) <$> _tdlEtag, Just ("kind" .= _tdlKind),
                  ("rows" .=) <$> _tdlRows,
                  ("pageToken" .=) <$> _tdlPageToken,
                  ("totalRows" .=) <$> _tdlTotalRows])

--
-- /See:/ 'jobConfigurationTableCopy' smart constructor.
data JobConfigurationTableCopy = JobConfigurationTableCopy'
    { _jctcDestinationTable                   :: !(Maybe TableReference)
    , _jctcWriteDisPosition                   :: !(Maybe Text)
    , _jctcSourceTables                       :: !(Maybe [TableReference])
    , _jctcCreateDisPosition                  :: !(Maybe Text)
    , _jctcSourceTable                        :: !(Maybe TableReference)
    , _jctcDestinationEncryptionConfiguration :: !(Maybe EncryptionConfiguration)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobConfigurationTableCopy' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jctcDestinationTable'
--
-- * 'jctcWriteDisPosition'
--
-- * 'jctcSourceTables'
--
-- * 'jctcCreateDisPosition'
--
-- * 'jctcSourceTable'
--
-- * 'jctcDestinationEncryptionConfiguration'
jobConfigurationTableCopy
    :: JobConfigurationTableCopy
jobConfigurationTableCopy =
    JobConfigurationTableCopy'
    { _jctcDestinationTable = Nothing
    , _jctcWriteDisPosition = Nothing
    , _jctcSourceTables = Nothing
    , _jctcCreateDisPosition = Nothing
    , _jctcSourceTable = Nothing
    , _jctcDestinationEncryptionConfiguration = Nothing
    }

-- | [Required] The destination table
jctcDestinationTable :: Lens' JobConfigurationTableCopy (Maybe TableReference)
jctcDestinationTable
  = lens _jctcDestinationTable
      (\ s a -> s{_jctcDestinationTable = a})

-- | [Optional] Specifies the action that occurs if the destination table
-- already exists. The following values are supported: WRITE_TRUNCATE: If
-- the table already exists, BigQuery overwrites the table data.
-- WRITE_APPEND: If the table already exists, BigQuery appends the data to
-- the table. WRITE_EMPTY: If the table already exists and contains data, a
-- \'duplicate\' error is returned in the job result. The default value is
-- WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able
-- to complete the job successfully. Creation, truncation and append
-- actions occur as one atomic update upon job completion.
jctcWriteDisPosition :: Lens' JobConfigurationTableCopy (Maybe Text)
jctcWriteDisPosition
  = lens _jctcWriteDisPosition
      (\ s a -> s{_jctcWriteDisPosition = a})

-- | [Pick one] Source tables to copy.
jctcSourceTables :: Lens' JobConfigurationTableCopy [TableReference]
jctcSourceTables
  = lens _jctcSourceTables
      (\ s a -> s{_jctcSourceTables = a})
      . _Default
      . _Coerce

-- | [Optional] Specifies whether the job is allowed to create new tables.
-- The following values are supported: CREATE_IF_NEEDED: If the table does
-- not exist, BigQuery creates the table. CREATE_NEVER: The table must
-- already exist. If it does not, a \'notFound\' error is returned in the
-- job result. The default value is CREATE_IF_NEEDED. Creation, truncation
-- and append actions occur as one atomic update upon job completion.
jctcCreateDisPosition :: Lens' JobConfigurationTableCopy (Maybe Text)
jctcCreateDisPosition
  = lens _jctcCreateDisPosition
      (\ s a -> s{_jctcCreateDisPosition = a})

-- | [Pick one] Source table to copy.
jctcSourceTable :: Lens' JobConfigurationTableCopy (Maybe TableReference)
jctcSourceTable
  = lens _jctcSourceTable
      (\ s a -> s{_jctcSourceTable = a})

-- | Custom encryption configuration (e.g., Cloud KMS keys).
jctcDestinationEncryptionConfiguration :: Lens' JobConfigurationTableCopy (Maybe EncryptionConfiguration)
jctcDestinationEncryptionConfiguration
  = lens _jctcDestinationEncryptionConfiguration
      (\ s a ->
         s{_jctcDestinationEncryptionConfiguration = a})

instance FromJSON JobConfigurationTableCopy where
        parseJSON
          = withObject "JobConfigurationTableCopy"
              (\ o ->
                 JobConfigurationTableCopy' <$>
                   (o .:? "destinationTable") <*>
                     (o .:? "writeDisposition")
                     <*> (o .:? "sourceTables" .!= mempty)
                     <*> (o .:? "createDisposition")
                     <*> (o .:? "sourceTable")
                     <*> (o .:? "destinationEncryptionConfiguration"))

instance ToJSON JobConfigurationTableCopy where
        toJSON JobConfigurationTableCopy'{..}
          = object
              (catMaybes
                 [("destinationTable" .=) <$> _jctcDestinationTable,
                  ("writeDisposition" .=) <$> _jctcWriteDisPosition,
                  ("sourceTables" .=) <$> _jctcSourceTables,
                  ("createDisposition" .=) <$> _jctcCreateDisPosition,
                  ("sourceTable" .=) <$> _jctcSourceTable,
                  ("destinationEncryptionConfiguration" .=) <$>
                    _jctcDestinationEncryptionConfiguration])

--
-- /See:/ 'tableListTablesItem' smart constructor.
data TableListTablesItem = TableListTablesItem'
    { _tltiCreationTime     :: !(Maybe (Textual Int64))
    , _tltiClustering       :: !(Maybe Clustering)
    , _tltiTableReference   :: !(Maybe TableReference)
    , _tltiFriendlyName     :: !(Maybe Text)
    , _tltiKind             :: !Text
    , _tltiTimePartitioning :: !(Maybe TimePartitioning)
    , _tltiView             :: !(Maybe TableListTablesItemView)
    , _tltiId               :: !(Maybe Text)
    , _tltiLabels           :: !(Maybe TableListTablesItemLabels)
    , _tltiType             :: !(Maybe Text)
    , _tltiExpirationTime   :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TableListTablesItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tltiCreationTime'
--
-- * 'tltiClustering'
--
-- * 'tltiTableReference'
--
-- * 'tltiFriendlyName'
--
-- * 'tltiKind'
--
-- * 'tltiTimePartitioning'
--
-- * 'tltiView'
--
-- * 'tltiId'
--
-- * 'tltiLabels'
--
-- * 'tltiType'
--
-- * 'tltiExpirationTime'
tableListTablesItem
    :: TableListTablesItem
tableListTablesItem =
    TableListTablesItem'
    { _tltiCreationTime = Nothing
    , _tltiClustering = Nothing
    , _tltiTableReference = Nothing
    , _tltiFriendlyName = Nothing
    , _tltiKind = "bigquery#table"
    , _tltiTimePartitioning = Nothing
    , _tltiView = Nothing
    , _tltiId = Nothing
    , _tltiLabels = Nothing
    , _tltiType = Nothing
    , _tltiExpirationTime = Nothing
    }

-- | The time when this table was created, in milliseconds since the epoch.
tltiCreationTime :: Lens' TableListTablesItem (Maybe Int64)
tltiCreationTime
  = lens _tltiCreationTime
      (\ s a -> s{_tltiCreationTime = a})
      . mapping _Coerce

-- | [Beta] Clustering specification for this table, if configured.
tltiClustering :: Lens' TableListTablesItem (Maybe Clustering)
tltiClustering
  = lens _tltiClustering
      (\ s a -> s{_tltiClustering = a})

-- | A reference uniquely identifying the table.
tltiTableReference :: Lens' TableListTablesItem (Maybe TableReference)
tltiTableReference
  = lens _tltiTableReference
      (\ s a -> s{_tltiTableReference = a})

-- | The user-friendly name for this table.
tltiFriendlyName :: Lens' TableListTablesItem (Maybe Text)
tltiFriendlyName
  = lens _tltiFriendlyName
      (\ s a -> s{_tltiFriendlyName = a})

-- | The resource type.
tltiKind :: Lens' TableListTablesItem Text
tltiKind = lens _tltiKind (\ s a -> s{_tltiKind = a})

-- | The time-based partitioning specification for this table, if configured.
tltiTimePartitioning :: Lens' TableListTablesItem (Maybe TimePartitioning)
tltiTimePartitioning
  = lens _tltiTimePartitioning
      (\ s a -> s{_tltiTimePartitioning = a})

-- | Additional details for a view.
tltiView :: Lens' TableListTablesItem (Maybe TableListTablesItemView)
tltiView = lens _tltiView (\ s a -> s{_tltiView = a})

-- | An opaque ID of the table
tltiId :: Lens' TableListTablesItem (Maybe Text)
tltiId = lens _tltiId (\ s a -> s{_tltiId = a})

-- | The labels associated with this table. You can use these to organize and
-- group your tables.
tltiLabels :: Lens' TableListTablesItem (Maybe TableListTablesItemLabels)
tltiLabels
  = lens _tltiLabels (\ s a -> s{_tltiLabels = a})

-- | The type of table. Possible values are: TABLE, VIEW.
tltiType :: Lens' TableListTablesItem (Maybe Text)
tltiType = lens _tltiType (\ s a -> s{_tltiType = a})

-- | [Optional] The time when this table expires, in milliseconds since the
-- epoch. If not present, the table will persist indefinitely. Expired
-- tables will be deleted and their storage reclaimed.
tltiExpirationTime :: Lens' TableListTablesItem (Maybe Int64)
tltiExpirationTime
  = lens _tltiExpirationTime
      (\ s a -> s{_tltiExpirationTime = a})
      . mapping _Coerce

instance FromJSON TableListTablesItem where
        parseJSON
          = withObject "TableListTablesItem"
              (\ o ->
                 TableListTablesItem' <$>
                   (o .:? "creationTime") <*> (o .:? "clustering") <*>
                     (o .:? "tableReference")
                     <*> (o .:? "friendlyName")
                     <*> (o .:? "kind" .!= "bigquery#table")
                     <*> (o .:? "timePartitioning")
                     <*> (o .:? "view")
                     <*> (o .:? "id")
                     <*> (o .:? "labels")
                     <*> (o .:? "type")
                     <*> (o .:? "expirationTime"))

instance ToJSON TableListTablesItem where
        toJSON TableListTablesItem'{..}
          = object
              (catMaybes
                 [("creationTime" .=) <$> _tltiCreationTime,
                  ("clustering" .=) <$> _tltiClustering,
                  ("tableReference" .=) <$> _tltiTableReference,
                  ("friendlyName" .=) <$> _tltiFriendlyName,
                  Just ("kind" .= _tltiKind),
                  ("timePartitioning" .=) <$> _tltiTimePartitioning,
                  ("view" .=) <$> _tltiView, ("id" .=) <$> _tltiId,
                  ("labels" .=) <$> _tltiLabels,
                  ("type" .=) <$> _tltiType,
                  ("expirationTime" .=) <$> _tltiExpirationTime])

--
-- /See:/ 'tableSchema' smart constructor.
newtype TableSchema = TableSchema'
    { _tsFields :: Maybe [TableFieldSchema]
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TableSchema' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tsFields'
tableSchema
    :: TableSchema
tableSchema =
    TableSchema'
    { _tsFields = Nothing
    }

-- | Describes the fields in a table.
tsFields :: Lens' TableSchema [TableFieldSchema]
tsFields
  = lens _tsFields (\ s a -> s{_tsFields = a}) .
      _Default
      . _Coerce

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

instance ToJSON TableSchema where
        toJSON TableSchema'{..}
          = object (catMaybes [("fields" .=) <$> _tsFields])

--
-- /See:/ 'projectList' smart constructor.
data ProjectList = ProjectList'
    { _plTotalItems    :: !(Maybe (Textual Int32))
    , _plEtag          :: !(Maybe Text)
    , _plNextPageToken :: !(Maybe Text)
    , _plKind          :: !Text
    , _plProjects      :: !(Maybe [ProjectListProjectsItem])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ProjectList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plTotalItems'
--
-- * 'plEtag'
--
-- * 'plNextPageToken'
--
-- * 'plKind'
--
-- * 'plProjects'
projectList
    :: ProjectList
projectList =
    ProjectList'
    { _plTotalItems = Nothing
    , _plEtag = Nothing
    , _plNextPageToken = Nothing
    , _plKind = "bigquery#projectList"
    , _plProjects = Nothing
    }

-- | The total number of projects in the list.
plTotalItems :: Lens' ProjectList (Maybe Int32)
plTotalItems
  = lens _plTotalItems (\ s a -> s{_plTotalItems = a})
      . mapping _Coerce

-- | A hash of the page of results
plEtag :: Lens' ProjectList (Maybe Text)
plEtag = lens _plEtag (\ s a -> s{_plEtag = a})

-- | A token to request the next page of results.
plNextPageToken :: Lens' ProjectList (Maybe Text)
plNextPageToken
  = lens _plNextPageToken
      (\ s a -> s{_plNextPageToken = a})

-- | The type of list.
plKind :: Lens' ProjectList Text
plKind = lens _plKind (\ s a -> s{_plKind = a})

-- | Projects to which you have at least READ access.
plProjects :: Lens' ProjectList [ProjectListProjectsItem]
plProjects
  = lens _plProjects (\ s a -> s{_plProjects = a}) .
      _Default
      . _Coerce

instance FromJSON ProjectList where
        parseJSON
          = withObject "ProjectList"
              (\ o ->
                 ProjectList' <$>
                   (o .:? "totalItems") <*> (o .:? "etag") <*>
                     (o .:? "nextPageToken")
                     <*> (o .:? "kind" .!= "bigquery#projectList")
                     <*> (o .:? "projects" .!= mempty))

instance ToJSON ProjectList where
        toJSON ProjectList'{..}
          = object
              (catMaybes
                 [("totalItems" .=) <$> _plTotalItems,
                  ("etag" .=) <$> _plEtag,
                  ("nextPageToken" .=) <$> _plNextPageToken,
                  Just ("kind" .= _plKind),
                  ("projects" .=) <$> _plProjects])

--
-- /See:/ 'explainQueryStep' smart constructor.
data ExplainQueryStep = ExplainQueryStep'
    { _eqsSubsteps :: !(Maybe [Text])
    , _eqsKind     :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ExplainQueryStep' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eqsSubsteps'
--
-- * 'eqsKind'
explainQueryStep
    :: ExplainQueryStep
explainQueryStep =
    ExplainQueryStep'
    { _eqsSubsteps = Nothing
    , _eqsKind = Nothing
    }

-- | Human-readable stage descriptions.
eqsSubsteps :: Lens' ExplainQueryStep [Text]
eqsSubsteps
  = lens _eqsSubsteps (\ s a -> s{_eqsSubsteps = a}) .
      _Default
      . _Coerce

-- | Machine-readable operation type.
eqsKind :: Lens' ExplainQueryStep (Maybe Text)
eqsKind = lens _eqsKind (\ s a -> s{_eqsKind = a})

instance FromJSON ExplainQueryStep where
        parseJSON
          = withObject "ExplainQueryStep"
              (\ o ->
                 ExplainQueryStep' <$>
                   (o .:? "substeps" .!= mempty) <*> (o .:? "kind"))

instance ToJSON ExplainQueryStep where
        toJSON ExplainQueryStep'{..}
          = object
              (catMaybes
                 [("substeps" .=) <$> _eqsSubsteps,
                  ("kind" .=) <$> _eqsKind])

--
-- /See:/ 'queryTimelineSample' smart constructor.
data QueryTimelineSample = QueryTimelineSample'
    { _qtsPendingUnits   :: !(Maybe (Textual Int64))
    , _qtsTotalSlotMs    :: !(Maybe (Textual Int64))
    , _qtsActiveUnits    :: !(Maybe (Textual Int64))
    , _qtsElapsedMs      :: !(Maybe (Textual Int64))
    , _qtsCompletedUnits :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QueryTimelineSample' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qtsPendingUnits'
--
-- * 'qtsTotalSlotMs'
--
-- * 'qtsActiveUnits'
--
-- * 'qtsElapsedMs'
--
-- * 'qtsCompletedUnits'
queryTimelineSample
    :: QueryTimelineSample
queryTimelineSample =
    QueryTimelineSample'
    { _qtsPendingUnits = Nothing
    , _qtsTotalSlotMs = Nothing
    , _qtsActiveUnits = Nothing
    , _qtsElapsedMs = Nothing
    , _qtsCompletedUnits = Nothing
    }

-- | Total parallel units of work remaining for the active stages.
qtsPendingUnits :: Lens' QueryTimelineSample (Maybe Int64)
qtsPendingUnits
  = lens _qtsPendingUnits
      (\ s a -> s{_qtsPendingUnits = a})
      . mapping _Coerce

-- | Cumulative slot-ms consumed by the query.
qtsTotalSlotMs :: Lens' QueryTimelineSample (Maybe Int64)
qtsTotalSlotMs
  = lens _qtsTotalSlotMs
      (\ s a -> s{_qtsTotalSlotMs = a})
      . mapping _Coerce

-- | Total number of units currently being processed by workers. This does
-- not correspond directly to slot usage. This is the largest value
-- observed since the last sample.
qtsActiveUnits :: Lens' QueryTimelineSample (Maybe Int64)
qtsActiveUnits
  = lens _qtsActiveUnits
      (\ s a -> s{_qtsActiveUnits = a})
      . mapping _Coerce

-- | Milliseconds elapsed since the start of query execution.
qtsElapsedMs :: Lens' QueryTimelineSample (Maybe Int64)
qtsElapsedMs
  = lens _qtsElapsedMs (\ s a -> s{_qtsElapsedMs = a})
      . mapping _Coerce

-- | Total parallel units of work completed by this query.
qtsCompletedUnits :: Lens' QueryTimelineSample (Maybe Int64)
qtsCompletedUnits
  = lens _qtsCompletedUnits
      (\ s a -> s{_qtsCompletedUnits = a})
      . mapping _Coerce

instance FromJSON QueryTimelineSample where
        parseJSON
          = withObject "QueryTimelineSample"
              (\ o ->
                 QueryTimelineSample' <$>
                   (o .:? "pendingUnits") <*> (o .:? "totalSlotMs") <*>
                     (o .:? "activeUnits")
                     <*> (o .:? "elapsedMs")
                     <*> (o .:? "completedUnits"))

instance ToJSON QueryTimelineSample where
        toJSON QueryTimelineSample'{..}
          = object
              (catMaybes
                 [("pendingUnits" .=) <$> _qtsPendingUnits,
                  ("totalSlotMs" .=) <$> _qtsTotalSlotMs,
                  ("activeUnits" .=) <$> _qtsActiveUnits,
                  ("elapsedMs" .=) <$> _qtsElapsedMs,
                  ("completedUnits" .=) <$> _qtsCompletedUnits])

--
-- /See:/ 'queryParameterTypeStructTypesItem' smart constructor.
data QueryParameterTypeStructTypesItem = QueryParameterTypeStructTypesItem'
    { _qptstiName        :: !(Maybe Text)
    , _qptstiType        :: !(Maybe QueryParameterType)
    , _qptstiDescription :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QueryParameterTypeStructTypesItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qptstiName'
--
-- * 'qptstiType'
--
-- * 'qptstiDescription'
queryParameterTypeStructTypesItem
    :: QueryParameterTypeStructTypesItem
queryParameterTypeStructTypesItem =
    QueryParameterTypeStructTypesItem'
    { _qptstiName = Nothing
    , _qptstiType = Nothing
    , _qptstiDescription = Nothing
    }

-- | [Optional] The name of this field.
qptstiName :: Lens' QueryParameterTypeStructTypesItem (Maybe Text)
qptstiName
  = lens _qptstiName (\ s a -> s{_qptstiName = a})

-- | [Required] The type of this field.
qptstiType :: Lens' QueryParameterTypeStructTypesItem (Maybe QueryParameterType)
qptstiType
  = lens _qptstiType (\ s a -> s{_qptstiType = a})

-- | [Optional] Human-oriented description of the field.
qptstiDescription :: Lens' QueryParameterTypeStructTypesItem (Maybe Text)
qptstiDescription
  = lens _qptstiDescription
      (\ s a -> s{_qptstiDescription = a})

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

instance ToJSON QueryParameterTypeStructTypesItem
         where
        toJSON QueryParameterTypeStructTypesItem'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _qptstiName,
                  ("type" .=) <$> _qptstiType,
                  ("description" .=) <$> _qptstiDescription])

--
-- /See:/ 'bigtableColumnFamily' smart constructor.
data BigtableColumnFamily = BigtableColumnFamily'
    { _bcfFamilyId       :: !(Maybe Text)
    , _bcfColumns        :: !(Maybe [BigtableColumn])
    , _bcfOnlyReadLatest :: !(Maybe Bool)
    , _bcfType           :: !(Maybe Text)
    , _bcfEncoding       :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BigtableColumnFamily' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bcfFamilyId'
--
-- * 'bcfColumns'
--
-- * 'bcfOnlyReadLatest'
--
-- * 'bcfType'
--
-- * 'bcfEncoding'
bigtableColumnFamily
    :: BigtableColumnFamily
bigtableColumnFamily =
    BigtableColumnFamily'
    { _bcfFamilyId = Nothing
    , _bcfColumns = Nothing
    , _bcfOnlyReadLatest = Nothing
    , _bcfType = Nothing
    , _bcfEncoding = Nothing
    }

-- | Identifier of the column family.
bcfFamilyId :: Lens' BigtableColumnFamily (Maybe Text)
bcfFamilyId
  = lens _bcfFamilyId (\ s a -> s{_bcfFamilyId = a})

-- | [Optional] Lists of columns that should be exposed as individual fields
-- as opposed to a list of (column name, value) pairs. All columns whose
-- qualifier matches a qualifier in this list can be accessed as .. Other
-- columns can be accessed as a list through .Column field.
bcfColumns :: Lens' BigtableColumnFamily [BigtableColumn]
bcfColumns
  = lens _bcfColumns (\ s a -> s{_bcfColumns = a}) .
      _Default
      . _Coerce

-- | [Optional] If this is set only the latest version of value are exposed
-- for all columns in this column family. This can be overridden for a
-- specific column by listing that column in \'columns\' and specifying a
-- different setting for that column.
bcfOnlyReadLatest :: Lens' BigtableColumnFamily (Maybe Bool)
bcfOnlyReadLatest
  = lens _bcfOnlyReadLatest
      (\ s a -> s{_bcfOnlyReadLatest = a})

-- | [Optional] The type to convert the value in cells of this column family.
-- The values are expected to be encoded using HBase Bytes.toBytes function
-- when using the BINARY encoding value. Following BigQuery types are
-- allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default
-- type is BYTES. This can be overridden for a specific column by listing
-- that column in \'columns\' and specifying a type for it.
bcfType :: Lens' BigtableColumnFamily (Maybe Text)
bcfType = lens _bcfType (\ s a -> s{_bcfType = a})

-- | [Optional] The encoding of the values when the type is not STRING.
-- Acceptable encoding values are: TEXT - indicates values are alphanumeric
-- text strings. BINARY - indicates values are encoded using HBase
-- Bytes.toBytes family of functions. This can be overridden for a specific
-- column by listing that column in \'columns\' and specifying an encoding
-- for it.
bcfEncoding :: Lens' BigtableColumnFamily (Maybe Text)
bcfEncoding
  = lens _bcfEncoding (\ s a -> s{_bcfEncoding = a})

instance FromJSON BigtableColumnFamily where
        parseJSON
          = withObject "BigtableColumnFamily"
              (\ o ->
                 BigtableColumnFamily' <$>
                   (o .:? "familyId") <*> (o .:? "columns" .!= mempty)
                     <*> (o .:? "onlyReadLatest")
                     <*> (o .:? "type")
                     <*> (o .:? "encoding"))

instance ToJSON BigtableColumnFamily where
        toJSON BigtableColumnFamily'{..}
          = object
              (catMaybes
                 [("familyId" .=) <$> _bcfFamilyId,
                  ("columns" .=) <$> _bcfColumns,
                  ("onlyReadLatest" .=) <$> _bcfOnlyReadLatest,
                  ("type" .=) <$> _bcfType,
                  ("encoding" .=) <$> _bcfEncoding])

--
-- /See:/ 'jobStatistics' smart constructor.
data JobStatistics = JobStatistics'
    { _jsCreationTime        :: !(Maybe (Textual Int64))
    , _jsStartTime           :: !(Maybe (Textual Int64))
    , _jsCompletionRatio     :: !(Maybe (Textual Double))
    , _jsTotalSlotMs         :: !(Maybe (Textual Int64))
    , _jsLoad                :: !(Maybe JobStatistics3)
    , _jsTotalBytesProcessed :: !(Maybe (Textual Int64))
    , _jsQuotaDeferments     :: !(Maybe [Text])
    , _jsEndTime             :: !(Maybe (Textual Int64))
    , _jsQuery               :: !(Maybe JobStatistics2)
    , _jsExtract             :: !(Maybe JobStatistics4)
    , _jsReservationUsage    :: !(Maybe [JobStatisticsReservationUsageItem])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobStatistics' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jsCreationTime'
--
-- * 'jsStartTime'
--
-- * 'jsCompletionRatio'
--
-- * 'jsTotalSlotMs'
--
-- * 'jsLoad'
--
-- * 'jsTotalBytesProcessed'
--
-- * 'jsQuotaDeferments'
--
-- * 'jsEndTime'
--
-- * 'jsQuery'
--
-- * 'jsExtract'
--
-- * 'jsReservationUsage'
jobStatistics
    :: JobStatistics
jobStatistics =
    JobStatistics'
    { _jsCreationTime = Nothing
    , _jsStartTime = Nothing
    , _jsCompletionRatio = Nothing
    , _jsTotalSlotMs = Nothing
    , _jsLoad = Nothing
    , _jsTotalBytesProcessed = Nothing
    , _jsQuotaDeferments = Nothing
    , _jsEndTime = Nothing
    , _jsQuery = Nothing
    , _jsExtract = Nothing
    , _jsReservationUsage = Nothing
    }

-- | [Output-only] Creation time of this job, in milliseconds since the
-- epoch. This field will be present on all jobs.
jsCreationTime :: Lens' JobStatistics (Maybe Int64)
jsCreationTime
  = lens _jsCreationTime
      (\ s a -> s{_jsCreationTime = a})
      . mapping _Coerce

-- | [Output-only] Start time of this job, in milliseconds since the epoch.
-- This field will be present when the job transitions from the PENDING
-- state to either RUNNING or DONE.
jsStartTime :: Lens' JobStatistics (Maybe Int64)
jsStartTime
  = lens _jsStartTime (\ s a -> s{_jsStartTime = a}) .
      mapping _Coerce

-- | [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and
-- EXTRACT jobs.
jsCompletionRatio :: Lens' JobStatistics (Maybe Double)
jsCompletionRatio
  = lens _jsCompletionRatio
      (\ s a -> s{_jsCompletionRatio = a})
      . mapping _Coerce

-- | [Output-only] Slot-milliseconds for the job.
jsTotalSlotMs :: Lens' JobStatistics (Maybe Int64)
jsTotalSlotMs
  = lens _jsTotalSlotMs
      (\ s a -> s{_jsTotalSlotMs = a})
      . mapping _Coerce

-- | [Output-only] Statistics for a load job.
jsLoad :: Lens' JobStatistics (Maybe JobStatistics3)
jsLoad = lens _jsLoad (\ s a -> s{_jsLoad = a})

-- | [Output-only] [Deprecated] Use the bytes processed in the query
-- statistics instead.
jsTotalBytesProcessed :: Lens' JobStatistics (Maybe Int64)
jsTotalBytesProcessed
  = lens _jsTotalBytesProcessed
      (\ s a -> s{_jsTotalBytesProcessed = a})
      . mapping _Coerce

-- | [Output-only] Quotas which delayed this job\'s start time.
jsQuotaDeferments :: Lens' JobStatistics [Text]
jsQuotaDeferments
  = lens _jsQuotaDeferments
      (\ s a -> s{_jsQuotaDeferments = a})
      . _Default
      . _Coerce

-- | [Output-only] End time of this job, in milliseconds since the epoch.
-- This field will be present whenever a job is in the DONE state.
jsEndTime :: Lens' JobStatistics (Maybe Int64)
jsEndTime
  = lens _jsEndTime (\ s a -> s{_jsEndTime = a}) .
      mapping _Coerce

-- | [Output-only] Statistics for a query job.
jsQuery :: Lens' JobStatistics (Maybe JobStatistics2)
jsQuery = lens _jsQuery (\ s a -> s{_jsQuery = a})

-- | [Output-only] Statistics for an extract job.
jsExtract :: Lens' JobStatistics (Maybe JobStatistics4)
jsExtract
  = lens _jsExtract (\ s a -> s{_jsExtract = a})

-- | [Output-only] Job resource usage breakdown by reservation.
jsReservationUsage :: Lens' JobStatistics [JobStatisticsReservationUsageItem]
jsReservationUsage
  = lens _jsReservationUsage
      (\ s a -> s{_jsReservationUsage = a})
      . _Default
      . _Coerce

instance FromJSON JobStatistics where
        parseJSON
          = withObject "JobStatistics"
              (\ o ->
                 JobStatistics' <$>
                   (o .:? "creationTime") <*> (o .:? "startTime") <*>
                     (o .:? "completionRatio")
                     <*> (o .:? "totalSlotMs")
                     <*> (o .:? "load")
                     <*> (o .:? "totalBytesProcessed")
                     <*> (o .:? "quotaDeferments" .!= mempty)
                     <*> (o .:? "endTime")
                     <*> (o .:? "query")
                     <*> (o .:? "extract")
                     <*> (o .:? "reservationUsage" .!= mempty))

instance ToJSON JobStatistics where
        toJSON JobStatistics'{..}
          = object
              (catMaybes
                 [("creationTime" .=) <$> _jsCreationTime,
                  ("startTime" .=) <$> _jsStartTime,
                  ("completionRatio" .=) <$> _jsCompletionRatio,
                  ("totalSlotMs" .=) <$> _jsTotalSlotMs,
                  ("load" .=) <$> _jsLoad,
                  ("totalBytesProcessed" .=) <$>
                    _jsTotalBytesProcessed,
                  ("quotaDeferments" .=) <$> _jsQuotaDeferments,
                  ("endTime" .=) <$> _jsEndTime,
                  ("query" .=) <$> _jsQuery,
                  ("extract" .=) <$> _jsExtract,
                  ("reservationUsage" .=) <$> _jsReservationUsage])

-- | The labels associated with this job. You can use these to organize and
-- group your jobs. Label keys and values can be no longer than 63
-- characters, can only contain lowercase letters, numeric characters,
-- underscores and dashes. International characters are allowed. Label
-- values are optional. Label keys must start with a letter and each label
-- in the list must have a different key.
--
-- /See:/ 'jobConfigurationLabels' smart constructor.
newtype JobConfigurationLabels = JobConfigurationLabels'
    { _jclAddtional :: HashMap Text Text
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobConfigurationLabels' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jclAddtional'
jobConfigurationLabels
    :: HashMap Text Text -- ^ 'jclAddtional'
    -> JobConfigurationLabels
jobConfigurationLabels pJclAddtional_ =
    JobConfigurationLabels'
    { _jclAddtional = _Coerce # pJclAddtional_
    }

jclAddtional :: Lens' JobConfigurationLabels (HashMap Text Text)
jclAddtional
  = lens _jclAddtional (\ s a -> s{_jclAddtional = a})
      . _Coerce

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

instance ToJSON JobConfigurationLabels where
        toJSON = toJSON . _jclAddtional

--
-- /See:/ 'dataSet' smart constructor.
data DataSet = DataSet'
    { _dsCreationTime                 :: !(Maybe (Textual Int64))
    , _dsDefaultPartitionExpirationMs :: !(Maybe (Textual Int64))
    , _dsAccess                       :: !(Maybe [DataSetAccessItem])
    , _dsEtag                         :: !(Maybe Text)
    , _dsLocation                     :: !(Maybe Text)
    , _dsFriendlyName                 :: !(Maybe Text)
    , _dsKind                         :: !Text
    , _dsLastModifiedTime             :: !(Maybe (Textual Int64))
    , _dsDataSetReference             :: !(Maybe DataSetReference)
    , _dsSelfLink                     :: !(Maybe Text)
    , _dsId                           :: !(Maybe Text)
    , _dsLabels                       :: !(Maybe DataSetLabels)
    , _dsDefaultTableExpirationMs     :: !(Maybe (Textual Int64))
    , _dsDescription                  :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'DataSet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dsCreationTime'
--
-- * 'dsDefaultPartitionExpirationMs'
--
-- * 'dsAccess'
--
-- * 'dsEtag'
--
-- * 'dsLocation'
--
-- * 'dsFriendlyName'
--
-- * 'dsKind'
--
-- * 'dsLastModifiedTime'
--
-- * 'dsDataSetReference'
--
-- * 'dsSelfLink'
--
-- * 'dsId'
--
-- * 'dsLabels'
--
-- * 'dsDefaultTableExpirationMs'
--
-- * 'dsDescription'
dataSet
    :: DataSet
dataSet =
    DataSet'
    { _dsCreationTime = Nothing
    , _dsDefaultPartitionExpirationMs = Nothing
    , _dsAccess = Nothing
    , _dsEtag = Nothing
    , _dsLocation = Nothing
    , _dsFriendlyName = Nothing
    , _dsKind = "bigquery#dataset"
    , _dsLastModifiedTime = Nothing
    , _dsDataSetReference = Nothing
    , _dsSelfLink = Nothing
    , _dsId = Nothing
    , _dsLabels = Nothing
    , _dsDefaultTableExpirationMs = Nothing
    , _dsDescription = Nothing
    }

-- | [Output-only] The time when this dataset was created, in milliseconds
-- since the epoch.
dsCreationTime :: Lens' DataSet (Maybe Int64)
dsCreationTime
  = lens _dsCreationTime
      (\ s a -> s{_dsCreationTime = a})
      . mapping _Coerce

-- | [Optional] The default partition expiration for all partitioned tables
-- in the dataset, in milliseconds. Once this property is set, all
-- newly-created partitioned tables in the dataset will have an
-- expirationMs property in the timePartitioning settings set to this
-- value, and changing the value will only affect new tables, not existing
-- ones. The storage in a partition will have an expiration time of its
-- partition time plus this value. Setting this property overrides the use
-- of defaultTableExpirationMs for partitioned tables: only one of
-- defaultTableExpirationMs and defaultPartitionExpirationMs will be used
-- for any new partitioned table. If you provide an explicit
-- timePartitioning.expirationMs when creating or updating a partitioned
-- table, that value takes precedence over the default partition expiration
-- time indicated by this property.
dsDefaultPartitionExpirationMs :: Lens' DataSet (Maybe Int64)
dsDefaultPartitionExpirationMs
  = lens _dsDefaultPartitionExpirationMs
      (\ s a -> s{_dsDefaultPartitionExpirationMs = a})
      . mapping _Coerce

-- | [Optional] An array of objects that define dataset access for one or
-- more entities. You can set this property when inserting or updating a
-- dataset in order to control who is allowed to access the data. If
-- unspecified at dataset creation time, BigQuery adds default dataset
-- access for the following entities: access.specialGroup: projectReaders;
-- access.role: READER; access.specialGroup: projectWriters; access.role:
-- WRITER; access.specialGroup: projectOwners; access.role: OWNER;
-- access.userByEmail: [dataset creator email]; access.role: OWNER;
dsAccess :: Lens' DataSet [DataSetAccessItem]
dsAccess
  = lens _dsAccess (\ s a -> s{_dsAccess = a}) .
      _Default
      . _Coerce

-- | [Output-only] A hash of the resource.
dsEtag :: Lens' DataSet (Maybe Text)
dsEtag = lens _dsEtag (\ s a -> s{_dsEtag = a})

-- | The geographic location where the dataset should reside. The default
-- value is US. See details at
-- https:\/\/cloud.google.com\/bigquery\/docs\/locations.
dsLocation :: Lens' DataSet (Maybe Text)
dsLocation
  = lens _dsLocation (\ s a -> s{_dsLocation = a})

-- | [Optional] A descriptive name for the dataset.
dsFriendlyName :: Lens' DataSet (Maybe Text)
dsFriendlyName
  = lens _dsFriendlyName
      (\ s a -> s{_dsFriendlyName = a})

-- | [Output-only] The resource type.
dsKind :: Lens' DataSet Text
dsKind = lens _dsKind (\ s a -> s{_dsKind = a})

-- | [Output-only] The date when this dataset or any of its tables was last
-- modified, in milliseconds since the epoch.
dsLastModifiedTime :: Lens' DataSet (Maybe Int64)
dsLastModifiedTime
  = lens _dsLastModifiedTime
      (\ s a -> s{_dsLastModifiedTime = a})
      . mapping _Coerce

-- | [Required] A reference that identifies the dataset.
dsDataSetReference :: Lens' DataSet (Maybe DataSetReference)
dsDataSetReference
  = lens _dsDataSetReference
      (\ s a -> s{_dsDataSetReference = a})

-- | [Output-only] A URL that can be used to access the resource again. You
-- can use this URL in Get or Update requests to the resource.
dsSelfLink :: Lens' DataSet (Maybe Text)
dsSelfLink
  = lens _dsSelfLink (\ s a -> s{_dsSelfLink = a})

-- | [Output-only] The fully-qualified unique name of the dataset in the
-- format projectId:datasetId. The dataset name without the project name is
-- given in the datasetId field. When creating a new dataset, leave this
-- field blank, and instead specify the datasetId field.
dsId :: Lens' DataSet (Maybe Text)
dsId = lens _dsId (\ s a -> s{_dsId = a})

-- | The labels associated with this dataset. You can use these to organize
-- and group your datasets. You can set this property when inserting or
-- updating a dataset. See Creating and Updating Dataset Labels for more
-- information.
dsLabels :: Lens' DataSet (Maybe DataSetLabels)
dsLabels = lens _dsLabels (\ s a -> s{_dsLabels = a})

-- | [Optional] The default lifetime of all tables in the dataset, in
-- milliseconds. The minimum value is 3600000 milliseconds (one hour). Once
-- this property is set, all newly-created tables in the dataset will have
-- an expirationTime property set to the creation time plus the value in
-- this property, and changing the value will only affect new tables, not
-- existing ones. When the expirationTime for a given table is reached,
-- that table will be deleted automatically. If a table\'s expirationTime
-- is modified or removed before the table expires, or if you provide an
-- explicit expirationTime when creating a table, that value takes
-- precedence over the default expiration time indicated by this property.
dsDefaultTableExpirationMs :: Lens' DataSet (Maybe Int64)
dsDefaultTableExpirationMs
  = lens _dsDefaultTableExpirationMs
      (\ s a -> s{_dsDefaultTableExpirationMs = a})
      . mapping _Coerce

-- | [Optional] A user-friendly description of the dataset.
dsDescription :: Lens' DataSet (Maybe Text)
dsDescription
  = lens _dsDescription
      (\ s a -> s{_dsDescription = a})

instance FromJSON DataSet where
        parseJSON
          = withObject "DataSet"
              (\ o ->
                 DataSet' <$>
                   (o .:? "creationTime") <*>
                     (o .:? "defaultPartitionExpirationMs")
                     <*> (o .:? "access" .!= mempty)
                     <*> (o .:? "etag")
                     <*> (o .:? "location")
                     <*> (o .:? "friendlyName")
                     <*> (o .:? "kind" .!= "bigquery#dataset")
                     <*> (o .:? "lastModifiedTime")
                     <*> (o .:? "datasetReference")
                     <*> (o .:? "selfLink")
                     <*> (o .:? "id")
                     <*> (o .:? "labels")
                     <*> (o .:? "defaultTableExpirationMs")
                     <*> (o .:? "description"))

instance ToJSON DataSet where
        toJSON DataSet'{..}
          = object
              (catMaybes
                 [("creationTime" .=) <$> _dsCreationTime,
                  ("defaultPartitionExpirationMs" .=) <$>
                    _dsDefaultPartitionExpirationMs,
                  ("access" .=) <$> _dsAccess, ("etag" .=) <$> _dsEtag,
                  ("location" .=) <$> _dsLocation,
                  ("friendlyName" .=) <$> _dsFriendlyName,
                  Just ("kind" .= _dsKind),
                  ("lastModifiedTime" .=) <$> _dsLastModifiedTime,
                  ("datasetReference" .=) <$> _dsDataSetReference,
                  ("selfLink" .=) <$> _dsSelfLink, ("id" .=) <$> _dsId,
                  ("labels" .=) <$> _dsLabels,
                  ("defaultTableExpirationMs" .=) <$>
                    _dsDefaultTableExpirationMs,
                  ("description" .=) <$> _dsDescription])

-- | [TrustedTester] [Required] Defines the ranges for range partitioning.
--
-- /See:/ 'rangePartitioningRange' smart constructor.
data RangePartitioningRange = RangePartitioningRange'
    { _rprStart    :: !(Maybe (Textual Int64))
    , _rprInterval :: !(Maybe (Textual Int64))
    , _rprEnd      :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RangePartitioningRange' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rprStart'
--
-- * 'rprInterval'
--
-- * 'rprEnd'
rangePartitioningRange
    :: RangePartitioningRange
rangePartitioningRange =
    RangePartitioningRange'
    { _rprStart = Nothing
    , _rprInterval = Nothing
    , _rprEnd = Nothing
    }

-- | [TrustedTester] [Required] The start of range partitioning, inclusive.
rprStart :: Lens' RangePartitioningRange (Maybe Int64)
rprStart
  = lens _rprStart (\ s a -> s{_rprStart = a}) .
      mapping _Coerce

-- | [TrustedTester] [Required] The width of each interval.
rprInterval :: Lens' RangePartitioningRange (Maybe Int64)
rprInterval
  = lens _rprInterval (\ s a -> s{_rprInterval = a}) .
      mapping _Coerce

-- | [TrustedTester] [Required] The end of range partitioning, exclusive.
rprEnd :: Lens' RangePartitioningRange (Maybe Int64)
rprEnd
  = lens _rprEnd (\ s a -> s{_rprEnd = a}) .
      mapping _Coerce

instance FromJSON RangePartitioningRange where
        parseJSON
          = withObject "RangePartitioningRange"
              (\ o ->
                 RangePartitioningRange' <$>
                   (o .:? "start") <*> (o .:? "interval") <*>
                     (o .:? "end"))

instance ToJSON RangePartitioningRange where
        toJSON RangePartitioningRange'{..}
          = object
              (catMaybes
                 [("start" .=) <$> _rprStart,
                  ("interval" .=) <$> _rprInterval,
                  ("end" .=) <$> _rprEnd])

--
-- /See:/ 'jobStatisticsReservationUsageItem' smart constructor.
data JobStatisticsReservationUsageItem = JobStatisticsReservationUsageItem'
    { _jsruiName   :: !(Maybe Text)
    , _jsruiSlotMs :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobStatisticsReservationUsageItem' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jsruiName'
--
-- * 'jsruiSlotMs'
jobStatisticsReservationUsageItem
    :: JobStatisticsReservationUsageItem
jobStatisticsReservationUsageItem =
    JobStatisticsReservationUsageItem'
    { _jsruiName = Nothing
    , _jsruiSlotMs = Nothing
    }

-- | [Output-only] Reservation name or \"unreserved\" for on-demand resources
-- usage.
jsruiName :: Lens' JobStatisticsReservationUsageItem (Maybe Text)
jsruiName
  = lens _jsruiName (\ s a -> s{_jsruiName = a})

-- | [Output-only] Slot-milliseconds the job spent in the given reservation.
jsruiSlotMs :: Lens' JobStatisticsReservationUsageItem (Maybe Int64)
jsruiSlotMs
  = lens _jsruiSlotMs (\ s a -> s{_jsruiSlotMs = a}) .
      mapping _Coerce

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

instance ToJSON JobStatisticsReservationUsageItem
         where
        toJSON JobStatisticsReservationUsageItem'{..}
          = object
              (catMaybes
                 [("name" .=) <$> _jsruiName,
                  ("slotMs" .=) <$> _jsruiSlotMs])

--
-- /See:/ 'bigtableOptions' smart constructor.
data BigtableOptions = BigtableOptions'
    { _boReadRowkeyAsString              :: !(Maybe Bool)
    , _boIgnoreUnspecifiedColumnFamilies :: !(Maybe Bool)
    , _boColumnFamilies                  :: !(Maybe [BigtableColumnFamily])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BigtableOptions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'boReadRowkeyAsString'
--
-- * 'boIgnoreUnspecifiedColumnFamilies'
--
-- * 'boColumnFamilies'
bigtableOptions
    :: BigtableOptions
bigtableOptions =
    BigtableOptions'
    { _boReadRowkeyAsString = Nothing
    , _boIgnoreUnspecifiedColumnFamilies = Nothing
    , _boColumnFamilies = Nothing
    }

-- | [Optional] If field is true, then the rowkey column families will be
-- read and converted to string. Otherwise they are read with BYTES type
-- values and users need to manually cast them with CAST if necessary. The
-- default value is false.
boReadRowkeyAsString :: Lens' BigtableOptions (Maybe Bool)
boReadRowkeyAsString
  = lens _boReadRowkeyAsString
      (\ s a -> s{_boReadRowkeyAsString = a})

-- | [Optional] If field is true, then the column families that are not
-- specified in columnFamilies list are not exposed in the table schema.
-- Otherwise, they are read with BYTES type values. The default value is
-- false.
boIgnoreUnspecifiedColumnFamilies :: Lens' BigtableOptions (Maybe Bool)
boIgnoreUnspecifiedColumnFamilies
  = lens _boIgnoreUnspecifiedColumnFamilies
      (\ s a -> s{_boIgnoreUnspecifiedColumnFamilies = a})

-- | [Optional] List of column families to expose in the table schema along
-- with their types. This list restricts the column families that can be
-- referenced in queries and specifies their value types. You can use this
-- list to do type conversions - see the \'type\' field for more details.
-- If you leave this list empty, all column families are present in the
-- table schema and their values are read as BYTES. During a query only the
-- column families referenced in that query are read from Bigtable.
boColumnFamilies :: Lens' BigtableOptions [BigtableColumnFamily]
boColumnFamilies
  = lens _boColumnFamilies
      (\ s a -> s{_boColumnFamilies = a})
      . _Default
      . _Coerce

instance FromJSON BigtableOptions where
        parseJSON
          = withObject "BigtableOptions"
              (\ o ->
                 BigtableOptions' <$>
                   (o .:? "readRowkeyAsString") <*>
                     (o .:? "ignoreUnspecifiedColumnFamilies")
                     <*> (o .:? "columnFamilies" .!= mempty))

instance ToJSON BigtableOptions where
        toJSON BigtableOptions'{..}
          = object
              (catMaybes
                 [("readRowkeyAsString" .=) <$> _boReadRowkeyAsString,
                  ("ignoreUnspecifiedColumnFamilies" .=) <$>
                    _boIgnoreUnspecifiedColumnFamilies,
                  ("columnFamilies" .=) <$> _boColumnFamilies])

--
-- /See:/ 'clustering' smart constructor.
newtype Clustering = Clustering'
    { _cFields :: Maybe [Text]
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'Clustering' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cFields'
clustering
    :: Clustering
clustering =
    Clustering'
    { _cFields = Nothing
    }

-- | [Repeated] One or more fields on which data should be clustered. Only
-- top-level, non-repeated, simple-type fields are supported. When you
-- cluster a table using multiple columns, the order of columns you specify
-- is important. The order of the specified columns determines the sort
-- order of the data.
cFields :: Lens' Clustering [Text]
cFields
  = lens _cFields (\ s a -> s{_cFields = a}) . _Default
      . _Coerce

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

instance ToJSON Clustering where
        toJSON Clustering'{..}
          = object (catMaybes [("fields" .=) <$> _cFields])

--
-- /See:/ 'externalDataConfiguration' smart constructor.
data ExternalDataConfiguration = ExternalDataConfiguration'
    { _edcBigtableOptions     :: !(Maybe BigtableOptions)
    , _edcIgnoreUnknownValues :: !(Maybe Bool)
    , _edcCompression         :: !(Maybe Text)
    , _edcSourceFormat        :: !(Maybe Text)
    , _edcSchema              :: !(Maybe TableSchema)
    , _edcMaxBadRecords       :: !(Maybe (Textual Int32))
    , _edcGoogleSheetsOptions :: !(Maybe GoogleSheetsOptions)
    , _edcAutodetect          :: !(Maybe Bool)
    , _edcSourceURIs          :: !(Maybe [Text])
    , _edcCSVOptions          :: !(Maybe CSVOptions)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ExternalDataConfiguration' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'edcBigtableOptions'
--
-- * 'edcIgnoreUnknownValues'
--
-- * 'edcCompression'
--
-- * 'edcSourceFormat'
--
-- * 'edcSchema'
--
-- * 'edcMaxBadRecords'
--
-- * 'edcGoogleSheetsOptions'
--
-- * 'edcAutodetect'
--
-- * 'edcSourceURIs'
--
-- * 'edcCSVOptions'
externalDataConfiguration
    :: ExternalDataConfiguration
externalDataConfiguration =
    ExternalDataConfiguration'
    { _edcBigtableOptions = Nothing
    , _edcIgnoreUnknownValues = Nothing
    , _edcCompression = Nothing
    , _edcSourceFormat = Nothing
    , _edcSchema = Nothing
    , _edcMaxBadRecords = Nothing
    , _edcGoogleSheetsOptions = Nothing
    , _edcAutodetect = Nothing
    , _edcSourceURIs = Nothing
    , _edcCSVOptions = Nothing
    }

-- | [Optional] Additional options if sourceFormat is set to BIGTABLE.
edcBigtableOptions :: Lens' ExternalDataConfiguration (Maybe BigtableOptions)
edcBigtableOptions
  = lens _edcBigtableOptions
      (\ s a -> s{_edcBigtableOptions = a})

-- | [Optional] Indicates if BigQuery should allow extra values that are not
-- represented in the table schema. If true, the extra values are ignored.
-- If false, records with extra columns are treated as bad records, and if
-- there are too many bad records, an invalid error is returned in the job
-- result. The default value is false. The sourceFormat property determines
-- what BigQuery treats as an extra value: CSV: Trailing columns JSON:
-- Named values that don\'t match any column names Google Cloud Bigtable:
-- This setting is ignored. Google Cloud Datastore backups: This setting is
-- ignored. Avro: This setting is ignored.
edcIgnoreUnknownValues :: Lens' ExternalDataConfiguration (Maybe Bool)
edcIgnoreUnknownValues
  = lens _edcIgnoreUnknownValues
      (\ s a -> s{_edcIgnoreUnknownValues = a})

-- | [Optional] The compression type of the data source. Possible values
-- include GZIP and NONE. The default value is NONE. This setting is
-- ignored for Google Cloud Bigtable, Google Cloud Datastore backups and
-- Avro formats.
edcCompression :: Lens' ExternalDataConfiguration (Maybe Text)
edcCompression
  = lens _edcCompression
      (\ s a -> s{_edcCompression = a})

-- | [Required] The data format. For CSV files, specify \"CSV\". For Google
-- sheets, specify \"GOOGLE_SHEETS\". For newline-delimited JSON, specify
-- \"NEWLINE_DELIMITED_JSON\". For Avro files, specify \"AVRO\". For Google
-- Cloud Datastore backups, specify \"DATASTORE_BACKUP\". [Beta] For Google
-- Cloud Bigtable, specify \"BIGTABLE\".
edcSourceFormat :: Lens' ExternalDataConfiguration (Maybe Text)
edcSourceFormat
  = lens _edcSourceFormat
      (\ s a -> s{_edcSourceFormat = a})

-- | [Optional] The schema for the data. Schema is required for CSV and JSON
-- formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore
-- backups, and Avro formats.
edcSchema :: Lens' ExternalDataConfiguration (Maybe TableSchema)
edcSchema
  = lens _edcSchema (\ s a -> s{_edcSchema = a})

-- | [Optional] The maximum number of bad records that BigQuery can ignore
-- when reading data. If the number of bad records exceeds this value, an
-- invalid error is returned in the job result. This is only valid for CSV,
-- JSON, and Google Sheets. The default value is 0, which requires that all
-- records are valid. This setting is ignored for Google Cloud Bigtable,
-- Google Cloud Datastore backups and Avro formats.
edcMaxBadRecords :: Lens' ExternalDataConfiguration (Maybe Int32)
edcMaxBadRecords
  = lens _edcMaxBadRecords
      (\ s a -> s{_edcMaxBadRecords = a})
      . mapping _Coerce

-- | [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
edcGoogleSheetsOptions :: Lens' ExternalDataConfiguration (Maybe GoogleSheetsOptions)
edcGoogleSheetsOptions
  = lens _edcGoogleSheetsOptions
      (\ s a -> s{_edcGoogleSheetsOptions = a})

-- | Try to detect schema and format options automatically. Any option
-- specified explicitly will be honored.
edcAutodetect :: Lens' ExternalDataConfiguration (Maybe Bool)
edcAutodetect
  = lens _edcAutodetect
      (\ s a -> s{_edcAutodetect = a})

-- | [Required] The fully-qualified URIs that point to your data in Google
-- Cloud. For Google Cloud Storage URIs: Each URI can contain one \'*\'
-- wildcard character and it must come after the \'bucket\' name. Size
-- limits related to load jobs apply to external data sources. For Google
-- Cloud Bigtable URIs: Exactly one URI can be specified and it has be a
-- fully specified and valid HTTPS URL for a Google Cloud Bigtable table.
-- For Google Cloud Datastore backups, exactly one URI can be specified.
-- Also, the \'*\' wildcard character is not allowed.
edcSourceURIs :: Lens' ExternalDataConfiguration [Text]
edcSourceURIs
  = lens _edcSourceURIs
      (\ s a -> s{_edcSourceURIs = a})
      . _Default
      . _Coerce

-- | Additional properties to set if sourceFormat is set to CSV.
edcCSVOptions :: Lens' ExternalDataConfiguration (Maybe CSVOptions)
edcCSVOptions
  = lens _edcCSVOptions
      (\ s a -> s{_edcCSVOptions = a})

instance FromJSON ExternalDataConfiguration where
        parseJSON
          = withObject "ExternalDataConfiguration"
              (\ o ->
                 ExternalDataConfiguration' <$>
                   (o .:? "bigtableOptions") <*>
                     (o .:? "ignoreUnknownValues")
                     <*> (o .:? "compression")
                     <*> (o .:? "sourceFormat")
                     <*> (o .:? "schema")
                     <*> (o .:? "maxBadRecords")
                     <*> (o .:? "googleSheetsOptions")
                     <*> (o .:? "autodetect")
                     <*> (o .:? "sourceUris" .!= mempty)
                     <*> (o .:? "csvOptions"))

instance ToJSON ExternalDataConfiguration where
        toJSON ExternalDataConfiguration'{..}
          = object
              (catMaybes
                 [("bigtableOptions" .=) <$> _edcBigtableOptions,
                  ("ignoreUnknownValues" .=) <$>
                    _edcIgnoreUnknownValues,
                  ("compression" .=) <$> _edcCompression,
                  ("sourceFormat" .=) <$> _edcSourceFormat,
                  ("schema" .=) <$> _edcSchema,
                  ("maxBadRecords" .=) <$> _edcMaxBadRecords,
                  ("googleSheetsOptions" .=) <$>
                    _edcGoogleSheetsOptions,
                  ("autodetect" .=) <$> _edcAutodetect,
                  ("sourceUris" .=) <$> _edcSourceURIs,
                  ("csvOptions" .=) <$> _edcCSVOptions])

--
-- /See:/ 'tableReference' smart constructor.
data TableReference = TableReference'
    { _trDataSetId :: !(Maybe Text)
    , _trProjectId :: !(Maybe Text)
    , _trTableId   :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TableReference' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'trDataSetId'
--
-- * 'trProjectId'
--
-- * 'trTableId'
tableReference
    :: TableReference
tableReference =
    TableReference'
    { _trDataSetId = Nothing
    , _trProjectId = Nothing
    , _trTableId = Nothing
    }

-- | [Required] The ID of the dataset containing this table.
trDataSetId :: Lens' TableReference (Maybe Text)
trDataSetId
  = lens _trDataSetId (\ s a -> s{_trDataSetId = a})

-- | [Required] The ID of the project containing this table.
trProjectId :: Lens' TableReference (Maybe Text)
trProjectId
  = lens _trProjectId (\ s a -> s{_trProjectId = a})

-- | [Required] The ID of the table. The ID must contain only letters (a-z,
-- A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024
-- characters.
trTableId :: Lens' TableReference (Maybe Text)
trTableId
  = lens _trTableId (\ s a -> s{_trTableId = a})

instance FromJSON TableReference where
        parseJSON
          = withObject "TableReference"
              (\ o ->
                 TableReference' <$>
                   (o .:? "datasetId") <*> (o .:? "projectId") <*>
                     (o .:? "tableId"))

instance ToJSON TableReference where
        toJSON TableReference'{..}
          = object
              (catMaybes
                 [("datasetId" .=) <$> _trDataSetId,
                  ("projectId" .=) <$> _trProjectId,
                  ("tableId" .=) <$> _trTableId])

-- | [Output-only, Beta] Model options used for the first training run. These
-- options are immutable for subsequent training runs. Default values are
-- used for any options not specified in the input query.
--
-- /See:/ 'modelDefinitionModelOptions' smart constructor.
data ModelDefinitionModelOptions = ModelDefinitionModelOptions'
    { _mdmoModelType :: !(Maybe Text)
    , _mdmoLabels    :: !(Maybe [Text])
    , _mdmoLossType  :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ModelDefinitionModelOptions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mdmoModelType'
--
-- * 'mdmoLabels'
--
-- * 'mdmoLossType'
modelDefinitionModelOptions
    :: ModelDefinitionModelOptions
modelDefinitionModelOptions =
    ModelDefinitionModelOptions'
    { _mdmoModelType = Nothing
    , _mdmoLabels = Nothing
    , _mdmoLossType = Nothing
    }

mdmoModelType :: Lens' ModelDefinitionModelOptions (Maybe Text)
mdmoModelType
  = lens _mdmoModelType
      (\ s a -> s{_mdmoModelType = a})

mdmoLabels :: Lens' ModelDefinitionModelOptions [Text]
mdmoLabels
  = lens _mdmoLabels (\ s a -> s{_mdmoLabels = a}) .
      _Default
      . _Coerce

mdmoLossType :: Lens' ModelDefinitionModelOptions (Maybe Text)
mdmoLossType
  = lens _mdmoLossType (\ s a -> s{_mdmoLossType = a})

instance FromJSON ModelDefinitionModelOptions where
        parseJSON
          = withObject "ModelDefinitionModelOptions"
              (\ o ->
                 ModelDefinitionModelOptions' <$>
                   (o .:? "modelType") <*> (o .:? "labels" .!= mempty)
                     <*> (o .:? "lossType"))

instance ToJSON ModelDefinitionModelOptions where
        toJSON ModelDefinitionModelOptions'{..}
          = object
              (catMaybes
                 [("modelType" .=) <$> _mdmoModelType,
                  ("labels" .=) <$> _mdmoLabels,
                  ("lossType" .=) <$> _mdmoLossType])

--
-- /See:/ 'rangePartitioning' smart constructor.
data RangePartitioning = RangePartitioning'
    { _rpField :: !(Maybe Text)
    , _rpRange :: !(Maybe RangePartitioningRange)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'RangePartitioning' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rpField'
--
-- * 'rpRange'
rangePartitioning
    :: RangePartitioning
rangePartitioning =
    RangePartitioning'
    { _rpField = Nothing
    , _rpRange = Nothing
    }

-- | [TrustedTester] [Required] The table is partitioned by this field. The
-- field must be a top-level NULLABLE\/REQUIRED field. The only supported
-- type is INTEGER\/INT64.
rpField :: Lens' RangePartitioning (Maybe Text)
rpField = lens _rpField (\ s a -> s{_rpField = a})

-- | [TrustedTester] [Required] Defines the ranges for range partitioning.
rpRange :: Lens' RangePartitioning (Maybe RangePartitioningRange)
rpRange = lens _rpRange (\ s a -> s{_rpRange = a})

instance FromJSON RangePartitioning where
        parseJSON
          = withObject "RangePartitioning"
              (\ o ->
                 RangePartitioning' <$>
                   (o .:? "field") <*> (o .:? "range"))

instance ToJSON RangePartitioning where
        toJSON RangePartitioning'{..}
          = object
              (catMaybes
                 [("field" .=) <$> _rpField,
                  ("range" .=) <$> _rpRange])

--
-- /See:/ 'tableFieldSchema' smart constructor.
data TableFieldSchema = TableFieldSchema'
    { _tfsMode        :: !(Maybe Text)
    , _tfsName        :: !(Maybe Text)
    , _tfsType        :: !(Maybe Text)
    , _tfsDescription :: !(Maybe Text)
    , _tfsFields      :: !(Maybe [TableFieldSchema])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TableFieldSchema' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tfsMode'
--
-- * 'tfsName'
--
-- * 'tfsType'
--
-- * 'tfsDescription'
--
-- * 'tfsFields'
tableFieldSchema
    :: TableFieldSchema
tableFieldSchema =
    TableFieldSchema'
    { _tfsMode = Nothing
    , _tfsName = Nothing
    , _tfsType = Nothing
    , _tfsDescription = Nothing
    , _tfsFields = Nothing
    }

-- | [Optional] The field mode. Possible values include NULLABLE, REQUIRED
-- and REPEATED. The default value is NULLABLE.
tfsMode :: Lens' TableFieldSchema (Maybe Text)
tfsMode = lens _tfsMode (\ s a -> s{_tfsMode = a})

-- | [Required] The field name. The name must contain only letters (a-z,
-- A-Z), numbers (0-9), or underscores (_), and must start with a letter or
-- underscore. The maximum length is 128 characters.
tfsName :: Lens' TableFieldSchema (Maybe Text)
tfsName = lens _tfsName (\ s a -> s{_tfsName = a})

-- | [Required] The field data type. Possible values include STRING, BYTES,
-- INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT),
-- BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD
-- (where RECORD indicates that the field contains a nested schema) or
-- STRUCT (same as RECORD).
tfsType :: Lens' TableFieldSchema (Maybe Text)
tfsType = lens _tfsType (\ s a -> s{_tfsType = a})

-- | [Optional] The field description. The maximum length is 1,024
-- characters.
tfsDescription :: Lens' TableFieldSchema (Maybe Text)
tfsDescription
  = lens _tfsDescription
      (\ s a -> s{_tfsDescription = a})

-- | [Optional] Describes the nested schema fields if the type property is
-- set to RECORD.
tfsFields :: Lens' TableFieldSchema [TableFieldSchema]
tfsFields
  = lens _tfsFields (\ s a -> s{_tfsFields = a}) .
      _Default
      . _Coerce

instance FromJSON TableFieldSchema where
        parseJSON
          = withObject "TableFieldSchema"
              (\ o ->
                 TableFieldSchema' <$>
                   (o .:? "mode") <*> (o .:? "name") <*> (o .:? "type")
                     <*> (o .:? "description")
                     <*> (o .:? "fields" .!= mempty))

instance ToJSON TableFieldSchema where
        toJSON TableFieldSchema'{..}
          = object
              (catMaybes
                 [("mode" .=) <$> _tfsMode, ("name" .=) <$> _tfsName,
                  ("type" .=) <$> _tfsType,
                  ("description" .=) <$> _tfsDescription,
                  ("fields" .=) <$> _tfsFields])

--
-- /See:/ 'getQueryResultsResponse' smart constructor.
data GetQueryResultsResponse = GetQueryResultsResponse'
    { _gqrrJobReference        :: !(Maybe JobReference)
    , _gqrrEtag                :: !(Maybe Text)
    , _gqrrKind                :: !Text
    , _gqrrSchema              :: !(Maybe TableSchema)
    , _gqrrTotalBytesProcessed :: !(Maybe (Textual Int64))
    , _gqrrRows                :: !(Maybe [TableRow])
    , _gqrrPageToken           :: !(Maybe Text)
    , _gqrrNumDmlAffectedRows  :: !(Maybe (Textual Int64))
    , _gqrrTotalRows           :: !(Maybe (Textual Word64))
    , _gqrrErrors              :: !(Maybe [ErrorProto])
    , _gqrrJobComplete         :: !(Maybe Bool)
    , _gqrrCacheHit            :: !(Maybe Bool)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'GetQueryResultsResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gqrrJobReference'
--
-- * 'gqrrEtag'
--
-- * 'gqrrKind'
--
-- * 'gqrrSchema'
--
-- * 'gqrrTotalBytesProcessed'
--
-- * 'gqrrRows'
--
-- * 'gqrrPageToken'
--
-- * 'gqrrNumDmlAffectedRows'
--
-- * 'gqrrTotalRows'
--
-- * 'gqrrErrors'
--
-- * 'gqrrJobComplete'
--
-- * 'gqrrCacheHit'
getQueryResultsResponse
    :: GetQueryResultsResponse
getQueryResultsResponse =
    GetQueryResultsResponse'
    { _gqrrJobReference = Nothing
    , _gqrrEtag = Nothing
    , _gqrrKind = "bigquery#getQueryResultsResponse"
    , _gqrrSchema = Nothing
    , _gqrrTotalBytesProcessed = Nothing
    , _gqrrRows = Nothing
    , _gqrrPageToken = Nothing
    , _gqrrNumDmlAffectedRows = Nothing
    , _gqrrTotalRows = Nothing
    , _gqrrErrors = Nothing
    , _gqrrJobComplete = Nothing
    , _gqrrCacheHit = Nothing
    }

-- | Reference to the BigQuery Job that was created to run the query. This
-- field will be present even if the original request timed out, in which
-- case GetQueryResults can be used to read the results once the query has
-- completed. Since this API only returns the first page of results,
-- subsequent pages can be fetched via the same mechanism
-- (GetQueryResults).
gqrrJobReference :: Lens' GetQueryResultsResponse (Maybe JobReference)
gqrrJobReference
  = lens _gqrrJobReference
      (\ s a -> s{_gqrrJobReference = a})

-- | A hash of this response.
gqrrEtag :: Lens' GetQueryResultsResponse (Maybe Text)
gqrrEtag = lens _gqrrEtag (\ s a -> s{_gqrrEtag = a})

-- | The resource type of the response.
gqrrKind :: Lens' GetQueryResultsResponse Text
gqrrKind = lens _gqrrKind (\ s a -> s{_gqrrKind = a})

-- | The schema of the results. Present only when the query completes
-- successfully.
gqrrSchema :: Lens' GetQueryResultsResponse (Maybe TableSchema)
gqrrSchema
  = lens _gqrrSchema (\ s a -> s{_gqrrSchema = a})

-- | The total number of bytes processed for this query.
gqrrTotalBytesProcessed :: Lens' GetQueryResultsResponse (Maybe Int64)
gqrrTotalBytesProcessed
  = lens _gqrrTotalBytesProcessed
      (\ s a -> s{_gqrrTotalBytesProcessed = a})
      . mapping _Coerce

-- | An object with as many results as can be contained within the maximum
-- permitted reply size. To get any additional rows, you can call
-- GetQueryResults and specify the jobReference returned above. Present
-- only when the query completes successfully.
gqrrRows :: Lens' GetQueryResultsResponse [TableRow]
gqrrRows
  = lens _gqrrRows (\ s a -> s{_gqrrRows = a}) .
      _Default
      . _Coerce

-- | A token used for paging results.
gqrrPageToken :: Lens' GetQueryResultsResponse (Maybe Text)
gqrrPageToken
  = lens _gqrrPageToken
      (\ s a -> s{_gqrrPageToken = a})

-- | [Output-only] The number of rows affected by a DML statement. Present
-- only for DML statements INSERT, UPDATE or DELETE.
gqrrNumDmlAffectedRows :: Lens' GetQueryResultsResponse (Maybe Int64)
gqrrNumDmlAffectedRows
  = lens _gqrrNumDmlAffectedRows
      (\ s a -> s{_gqrrNumDmlAffectedRows = a})
      . mapping _Coerce

-- | The total number of rows in the complete query result set, which can be
-- more than the number of rows in this single page of results. Present
-- only when the query completes successfully.
gqrrTotalRows :: Lens' GetQueryResultsResponse (Maybe Word64)
gqrrTotalRows
  = lens _gqrrTotalRows
      (\ s a -> s{_gqrrTotalRows = a})
      . mapping _Coerce

-- | [Output-only] The first errors or warnings encountered during the
-- running of the job. The final message includes the number of errors that
-- caused the process to stop. Errors here do not necessarily mean that the
-- job has completed or was unsuccessful.
gqrrErrors :: Lens' GetQueryResultsResponse [ErrorProto]
gqrrErrors
  = lens _gqrrErrors (\ s a -> s{_gqrrErrors = a}) .
      _Default
      . _Coerce

-- | Whether the query has completed or not. If rows or totalRows are
-- present, this will always be true. If this is false, totalRows will not
-- be available.
gqrrJobComplete :: Lens' GetQueryResultsResponse (Maybe Bool)
gqrrJobComplete
  = lens _gqrrJobComplete
      (\ s a -> s{_gqrrJobComplete = a})

-- | Whether the query result was fetched from the query cache.
gqrrCacheHit :: Lens' GetQueryResultsResponse (Maybe Bool)
gqrrCacheHit
  = lens _gqrrCacheHit (\ s a -> s{_gqrrCacheHit = a})

instance FromJSON GetQueryResultsResponse where
        parseJSON
          = withObject "GetQueryResultsResponse"
              (\ o ->
                 GetQueryResultsResponse' <$>
                   (o .:? "jobReference") <*> (o .:? "etag") <*>
                     (o .:? "kind" .!= "bigquery#getQueryResultsResponse")
                     <*> (o .:? "schema")
                     <*> (o .:? "totalBytesProcessed")
                     <*> (o .:? "rows" .!= mempty)
                     <*> (o .:? "pageToken")
                     <*> (o .:? "numDmlAffectedRows")
                     <*> (o .:? "totalRows")
                     <*> (o .:? "errors" .!= mempty)
                     <*> (o .:? "jobComplete")
                     <*> (o .:? "cacheHit"))

instance ToJSON GetQueryResultsResponse where
        toJSON GetQueryResultsResponse'{..}
          = object
              (catMaybes
                 [("jobReference" .=) <$> _gqrrJobReference,
                  ("etag" .=) <$> _gqrrEtag,
                  Just ("kind" .= _gqrrKind),
                  ("schema" .=) <$> _gqrrSchema,
                  ("totalBytesProcessed" .=) <$>
                    _gqrrTotalBytesProcessed,
                  ("rows" .=) <$> _gqrrRows,
                  ("pageToken" .=) <$> _gqrrPageToken,
                  ("numDmlAffectedRows" .=) <$>
                    _gqrrNumDmlAffectedRows,
                  ("totalRows" .=) <$> _gqrrTotalRows,
                  ("errors" .=) <$> _gqrrErrors,
                  ("jobComplete" .=) <$> _gqrrJobComplete,
                  ("cacheHit" .=) <$> _gqrrCacheHit])

--
-- /See:/ 'dataSetList' smart constructor.
data DataSetList = DataSetList'
    { _dslEtag          :: !(Maybe Text)
    , _dslNextPageToken :: !(Maybe Text)
    , _dslKind          :: !Text
    , _dslDataSets      :: !(Maybe [DataSetListDataSetsItem])
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'DataSetList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dslEtag'
--
-- * 'dslNextPageToken'
--
-- * 'dslKind'
--
-- * 'dslDataSets'
dataSetList
    :: DataSetList
dataSetList =
    DataSetList'
    { _dslEtag = Nothing
    , _dslNextPageToken = Nothing
    , _dslKind = "bigquery#datasetList"
    , _dslDataSets = Nothing
    }

-- | A hash value of the results page. You can use this property to determine
-- if the page has changed since the last request.
dslEtag :: Lens' DataSetList (Maybe Text)
dslEtag = lens _dslEtag (\ s a -> s{_dslEtag = a})

-- | A token that can be used to request the next results page. This property
-- is omitted on the final results page.
dslNextPageToken :: Lens' DataSetList (Maybe Text)
dslNextPageToken
  = lens _dslNextPageToken
      (\ s a -> s{_dslNextPageToken = a})

-- | The list type. This property always returns the value
-- \"bigquery#datasetList\".
dslKind :: Lens' DataSetList Text
dslKind = lens _dslKind (\ s a -> s{_dslKind = a})

-- | An array of the dataset resources in the project. Each resource contains
-- basic information. For full information about a particular dataset
-- resource, use the Datasets: get method. This property is omitted when
-- there are no datasets in the project.
dslDataSets :: Lens' DataSetList [DataSetListDataSetsItem]
dslDataSets
  = lens _dslDataSets (\ s a -> s{_dslDataSets = a}) .
      _Default
      . _Coerce

instance FromJSON DataSetList where
        parseJSON
          = withObject "DataSetList"
              (\ o ->
                 DataSetList' <$>
                   (o .:? "etag") <*> (o .:? "nextPageToken") <*>
                     (o .:? "kind" .!= "bigquery#datasetList")
                     <*> (o .:? "datasets" .!= mempty))

instance ToJSON DataSetList where
        toJSON DataSetList'{..}
          = object
              (catMaybes
                 [("etag" .=) <$> _dslEtag,
                  ("nextPageToken" .=) <$> _dslNextPageToken,
                  Just ("kind" .= _dslKind),
                  ("datasets" .=) <$> _dslDataSets])

--
-- /See:/ 'queryRequest' smart constructor.
data QueryRequest = QueryRequest'
    { _qrLocation        :: !(Maybe Text)
    , _qrUseQueryCache   :: !Bool
    , _qrPreserveNulls   :: !(Maybe Bool)
    , _qrKind            :: !Text
    , _qrQueryParameters :: !(Maybe [QueryParameter])
    , _qrQuery           :: !(Maybe Text)
    , _qrParameterMode   :: !(Maybe Text)
    , _qrTimeoutMs       :: !(Maybe (Textual Word32))
    , _qrUseLegacySQL    :: !Bool
    , _qrDryRun          :: !(Maybe Bool)
    , _qrMaxResults      :: !(Maybe (Textual Word32))
    , _qrDefaultDataSet  :: !(Maybe DataSetReference)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QueryRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qrLocation'
--
-- * 'qrUseQueryCache'
--
-- * 'qrPreserveNulls'
--
-- * 'qrKind'
--
-- * 'qrQueryParameters'
--
-- * 'qrQuery'
--
-- * 'qrParameterMode'
--
-- * 'qrTimeoutMs'
--
-- * 'qrUseLegacySQL'
--
-- * 'qrDryRun'
--
-- * 'qrMaxResults'
--
-- * 'qrDefaultDataSet'
queryRequest
    :: QueryRequest
queryRequest =
    QueryRequest'
    { _qrLocation = Nothing
    , _qrUseQueryCache = True
    , _qrPreserveNulls = Nothing
    , _qrKind = "bigquery#queryRequest"
    , _qrQueryParameters = Nothing
    , _qrQuery = Nothing
    , _qrParameterMode = Nothing
    , _qrTimeoutMs = Nothing
    , _qrUseLegacySQL = True
    , _qrDryRun = Nothing
    , _qrMaxResults = Nothing
    , _qrDefaultDataSet = Nothing
    }

-- | The geographic location where the job should run. See details at
-- https:\/\/cloud.google.com\/bigquery\/docs\/locations#specifying_your_location.
qrLocation :: Lens' QueryRequest (Maybe Text)
qrLocation
  = lens _qrLocation (\ s a -> s{_qrLocation = a})

-- | [Optional] Whether to look for the result in the query cache. The query
-- cache is a best-effort cache that will be flushed whenever tables in the
-- query are modified. The default value is true.
qrUseQueryCache :: Lens' QueryRequest Bool
qrUseQueryCache
  = lens _qrUseQueryCache
      (\ s a -> s{_qrUseQueryCache = a})

-- | [Deprecated] This property is deprecated.
qrPreserveNulls :: Lens' QueryRequest (Maybe Bool)
qrPreserveNulls
  = lens _qrPreserveNulls
      (\ s a -> s{_qrPreserveNulls = a})

-- | The resource type of the request.
qrKind :: Lens' QueryRequest Text
qrKind = lens _qrKind (\ s a -> s{_qrKind = a})

-- | Query parameters for Standard SQL queries.
qrQueryParameters :: Lens' QueryRequest [QueryParameter]
qrQueryParameters
  = lens _qrQueryParameters
      (\ s a -> s{_qrQueryParameters = a})
      . _Default
      . _Coerce

-- | [Required] A query string, following the BigQuery query syntax, of the
-- query to execute. Example: \"SELECT count(f1) FROM
-- [myProjectId:myDatasetId.myTableId]\".
qrQuery :: Lens' QueryRequest (Maybe Text)
qrQuery = lens _qrQuery (\ s a -> s{_qrQuery = a})

-- | Standard SQL only. Set to POSITIONAL to use positional (?) query
-- parameters or to NAMED to use named (\'myparam) query parameters in this
-- query.
qrParameterMode :: Lens' QueryRequest (Maybe Text)
qrParameterMode
  = lens _qrParameterMode
      (\ s a -> s{_qrParameterMode = a})

-- | [Optional] How long to wait for the query to complete, in milliseconds,
-- before the request times out and returns. Note that this is only a
-- timeout for the request, not the query. If the query takes longer to run
-- than the timeout value, the call returns without any results and with
-- the \'jobComplete\' flag set to false. You can call GetQueryResults() to
-- wait for the query to complete and read the results. The default value
-- is 10000 milliseconds (10 seconds).
qrTimeoutMs :: Lens' QueryRequest (Maybe Word32)
qrTimeoutMs
  = lens _qrTimeoutMs (\ s a -> s{_qrTimeoutMs = a}) .
      mapping _Coerce

-- | Specifies whether to use BigQuery\'s legacy SQL dialect for this query.
-- The default value is true. If set to false, the query will use
-- BigQuery\'s standard SQL:
-- https:\/\/cloud.google.com\/bigquery\/sql-reference\/ When useLegacySql
-- is set to false, the value of flattenResults is ignored; query will be
-- run as if flattenResults is false.
qrUseLegacySQL :: Lens' QueryRequest Bool
qrUseLegacySQL
  = lens _qrUseLegacySQL
      (\ s a -> s{_qrUseLegacySQL = a})

-- | [Optional] If set to true, BigQuery doesn\'t run the job. Instead, if
-- the query is valid, BigQuery returns statistics about the job such as
-- how many bytes would be processed. If the query is invalid, an error
-- returns. The default value is false.
qrDryRun :: Lens' QueryRequest (Maybe Bool)
qrDryRun = lens _qrDryRun (\ s a -> s{_qrDryRun = a})

-- | [Optional] The maximum number of rows of data to return per page of
-- results. Setting this flag to a small value such as 1000 and then paging
-- through results might improve reliability when the query result set is
-- large. In addition to this limit, responses are also limited to 10 MB.
-- By default, there is no maximum row count, and only the byte limit
-- applies.
qrMaxResults :: Lens' QueryRequest (Maybe Word32)
qrMaxResults
  = lens _qrMaxResults (\ s a -> s{_qrMaxResults = a})
      . mapping _Coerce

-- | [Optional] Specifies the default datasetId and projectId to assume for
-- any unqualified table names in the query. If not set, all table names in
-- the query string must be qualified in the format \'datasetId.tableId\'.
qrDefaultDataSet :: Lens' QueryRequest (Maybe DataSetReference)
qrDefaultDataSet
  = lens _qrDefaultDataSet
      (\ s a -> s{_qrDefaultDataSet = a})

instance FromJSON QueryRequest where
        parseJSON
          = withObject "QueryRequest"
              (\ o ->
                 QueryRequest' <$>
                   (o .:? "location") <*>
                     (o .:? "useQueryCache" .!= True)
                     <*> (o .:? "preserveNulls")
                     <*> (o .:? "kind" .!= "bigquery#queryRequest")
                     <*> (o .:? "queryParameters" .!= mempty)
                     <*> (o .:? "query")
                     <*> (o .:? "parameterMode")
                     <*> (o .:? "timeoutMs")
                     <*> (o .:? "useLegacySql" .!= True)
                     <*> (o .:? "dryRun")
                     <*> (o .:? "maxResults")
                     <*> (o .:? "defaultDataset"))

instance ToJSON QueryRequest where
        toJSON QueryRequest'{..}
          = object
              (catMaybes
                 [("location" .=) <$> _qrLocation,
                  Just ("useQueryCache" .= _qrUseQueryCache),
                  ("preserveNulls" .=) <$> _qrPreserveNulls,
                  Just ("kind" .= _qrKind),
                  ("queryParameters" .=) <$> _qrQueryParameters,
                  ("query" .=) <$> _qrQuery,
                  ("parameterMode" .=) <$> _qrParameterMode,
                  ("timeoutMs" .=) <$> _qrTimeoutMs,
                  Just ("useLegacySql" .= _qrUseLegacySQL),
                  ("dryRun" .=) <$> _qrDryRun,
                  ("maxResults" .=) <$> _qrMaxResults,
                  ("defaultDataset" .=) <$> _qrDefaultDataSet])

--
-- /See:/ 'queryParameter' smart constructor.
data QueryParameter = QueryParameter'
    { _qpParameterValue :: !(Maybe QueryParameterValue)
    , _qpParameterType  :: !(Maybe QueryParameterType)
    , _qpName           :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'QueryParameter' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'qpParameterValue'
--
-- * 'qpParameterType'
--
-- * 'qpName'
queryParameter
    :: QueryParameter
queryParameter =
    QueryParameter'
    { _qpParameterValue = Nothing
    , _qpParameterType = Nothing
    , _qpName = Nothing
    }

-- | [Required] The value of this parameter.
qpParameterValue :: Lens' QueryParameter (Maybe QueryParameterValue)
qpParameterValue
  = lens _qpParameterValue
      (\ s a -> s{_qpParameterValue = a})

-- | [Required] The type of this parameter.
qpParameterType :: Lens' QueryParameter (Maybe QueryParameterType)
qpParameterType
  = lens _qpParameterType
      (\ s a -> s{_qpParameterType = a})

-- | [Optional] If unset, this is a positional parameter. Otherwise, should
-- be unique within a query.
qpName :: Lens' QueryParameter (Maybe Text)
qpName = lens _qpName (\ s a -> s{_qpName = a})

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

instance ToJSON QueryParameter where
        toJSON QueryParameter'{..}
          = object
              (catMaybes
                 [("parameterValue" .=) <$> _qpParameterValue,
                  ("parameterType" .=) <$> _qpParameterType,
                  ("name" .=) <$> _qpName])

--
-- /See:/ 'iterationResult' smart constructor.
data IterationResult = IterationResult'
    { _irDurationMs   :: !(Maybe (Textual Int64))
    , _irLearnRate    :: !(Maybe (Textual Double))
    , _irEvalLoss     :: !(Maybe (Textual Double))
    , _irTrainingLoss :: !(Maybe (Textual Double))
    , _irIndex        :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'IterationResult' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'irDurationMs'
--
-- * 'irLearnRate'
--
-- * 'irEvalLoss'
--
-- * 'irTrainingLoss'
--
-- * 'irIndex'
iterationResult
    :: IterationResult
iterationResult =
    IterationResult'
    { _irDurationMs = Nothing
    , _irLearnRate = Nothing
    , _irEvalLoss = Nothing
    , _irTrainingLoss = Nothing
    , _irIndex = Nothing
    }

-- | [Output-only, Beta] Time taken to run the training iteration in
-- milliseconds.
irDurationMs :: Lens' IterationResult (Maybe Int64)
irDurationMs
  = lens _irDurationMs (\ s a -> s{_irDurationMs = a})
      . mapping _Coerce

-- | [Output-only, Beta] Learning rate used for this iteration, it varies for
-- different training iterations if learn_rate_strategy option is not
-- constant.
irLearnRate :: Lens' IterationResult (Maybe Double)
irLearnRate
  = lens _irLearnRate (\ s a -> s{_irLearnRate = a}) .
      mapping _Coerce

-- | [Output-only, Beta] Eval loss computed on the eval data at the end of
-- the iteration. The eval loss is used for early stopping to avoid
-- overfitting. No eval loss if eval_split_method option is specified as
-- no_split or auto_split with input data size less than 500 rows.
irEvalLoss :: Lens' IterationResult (Maybe Double)
irEvalLoss
  = lens _irEvalLoss (\ s a -> s{_irEvalLoss = a}) .
      mapping _Coerce

-- | [Output-only, Beta] Training loss computed on the training data at the
-- end of the iteration. The training loss function is defined by model
-- type.
irTrainingLoss :: Lens' IterationResult (Maybe Double)
irTrainingLoss
  = lens _irTrainingLoss
      (\ s a -> s{_irTrainingLoss = a})
      . mapping _Coerce

-- | [Output-only, Beta] Index of the ML training iteration, starting from
-- zero for each training run.
irIndex :: Lens' IterationResult (Maybe Int32)
irIndex
  = lens _irIndex (\ s a -> s{_irIndex = a}) .
      mapping _Coerce

instance FromJSON IterationResult where
        parseJSON
          = withObject "IterationResult"
              (\ o ->
                 IterationResult' <$>
                   (o .:? "durationMs") <*> (o .:? "learnRate") <*>
                     (o .:? "evalLoss")
                     <*> (o .:? "trainingLoss")
                     <*> (o .:? "index"))

instance ToJSON IterationResult where
        toJSON IterationResult'{..}
          = object
              (catMaybes
                 [("durationMs" .=) <$> _irDurationMs,
                  ("learnRate" .=) <$> _irLearnRate,
                  ("evalLoss" .=) <$> _irEvalLoss,
                  ("trainingLoss" .=) <$> _irTrainingLoss,
                  ("index" .=) <$> _irIndex])

--
-- /See:/ 'jobStatistics4' smart constructor.
newtype JobStatistics4 = JobStatistics4'
    { _jsDestinationURIFileCounts :: Maybe [Textual Int64]
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobStatistics4' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jsDestinationURIFileCounts'
jobStatistics4
    :: JobStatistics4
jobStatistics4 =
    JobStatistics4'
    { _jsDestinationURIFileCounts = Nothing
    }

-- | [Output-only] Number of files per destination URI or URI pattern
-- specified in the extract configuration. These values will be in the same
-- order as the URIs specified in the \'destinationUris\' field.
jsDestinationURIFileCounts :: Lens' JobStatistics4 [Int64]
jsDestinationURIFileCounts
  = lens _jsDestinationURIFileCounts
      (\ s a -> s{_jsDestinationURIFileCounts = a})
      . _Default
      . _Coerce

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

instance ToJSON JobStatistics4 where
        toJSON JobStatistics4'{..}
          = object
              (catMaybes
                 [("destinationUriFileCounts" .=) <$>
                    _jsDestinationURIFileCounts])

--
-- /See:/ 'projectReference' smart constructor.
newtype ProjectReference = ProjectReference'
    { _prProjectId :: Maybe Text
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ProjectReference' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'prProjectId'
projectReference
    :: ProjectReference
projectReference =
    ProjectReference'
    { _prProjectId = Nothing
    }

-- | [Required] ID of the project. Can be either the numeric ID or the
-- assigned ID of the project.
prProjectId :: Lens' ProjectReference (Maybe Text)
prProjectId
  = lens _prProjectId (\ s a -> s{_prProjectId = a})

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

instance ToJSON ProjectReference where
        toJSON ProjectReference'{..}
          = object
              (catMaybes [("projectId" .=) <$> _prProjectId])

--
-- /See:/ 'explainQueryStage' smart constructor.
data ExplainQueryStage = ExplainQueryStage'
    { _eqsReadMsAvg                 :: !(Maybe (Textual Int64))
    , _eqsStatus                    :: !(Maybe Text)
    , _eqsShuffleOutputBytesSpilled :: !(Maybe (Textual Int64))
    , _eqsReadMsMax                 :: !(Maybe (Textual Int64))
    , _eqsCompletedParallelInputs   :: !(Maybe (Textual Int64))
    , _eqsWaitRatioMax              :: !(Maybe (Textual Double))
    , _eqsParallelInputs            :: !(Maybe (Textual Int64))
    , _eqsShuffleOutputBytes        :: !(Maybe (Textual Int64))
    , _eqsRecordsWritten            :: !(Maybe (Textual Int64))
    , _eqsSteps                     :: !(Maybe [ExplainQueryStep])
    , _eqsInputStages               :: !(Maybe [Textual Int64])
    , _eqsWriteRatioAvg             :: !(Maybe (Textual Double))
    , _eqsRecordsRead               :: !(Maybe (Textual Int64))
    , _eqsComputeRatioAvg           :: !(Maybe (Textual Double))
    , _eqsName                      :: !(Maybe Text)
    , _eqsComputeMsMax              :: !(Maybe (Textual Int64))
    , _eqsReadRatioMax              :: !(Maybe (Textual Double))
    , _eqsWriteMsMax                :: !(Maybe (Textual Int64))
    , _eqsWaitRatioAvg              :: !(Maybe (Textual Double))
    , _eqsWaitMsAvg                 :: !(Maybe (Textual Int64))
    , _eqsId                        :: !(Maybe (Textual Int64))
    , _eqsComputeRatioMax           :: !(Maybe (Textual Double))
    , _eqsWriteRatioMax             :: !(Maybe (Textual Double))
    , _eqsComputeMsAvg              :: !(Maybe (Textual Int64))
    , _eqsReadRatioAvg              :: !(Maybe (Textual Double))
    , _eqsWriteMsAvg                :: !(Maybe (Textual Int64))
    , _eqsStartMs                   :: !(Maybe (Textual Int64))
    , _eqsEndMs                     :: !(Maybe (Textual Int64))
    , _eqsWaitMsMax                 :: !(Maybe (Textual Int64))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'ExplainQueryStage' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'eqsReadMsAvg'
--
-- * 'eqsStatus'
--
-- * 'eqsShuffleOutputBytesSpilled'
--
-- * 'eqsReadMsMax'
--
-- * 'eqsCompletedParallelInputs'
--
-- * 'eqsWaitRatioMax'
--
-- * 'eqsParallelInputs'
--
-- * 'eqsShuffleOutputBytes'
--
-- * 'eqsRecordsWritten'
--
-- * 'eqsSteps'
--
-- * 'eqsInputStages'
--
-- * 'eqsWriteRatioAvg'
--
-- * 'eqsRecordsRead'
--
-- * 'eqsComputeRatioAvg'
--
-- * 'eqsName'
--
-- * 'eqsComputeMsMax'
--
-- * 'eqsReadRatioMax'
--
-- * 'eqsWriteMsMax'
--
-- * 'eqsWaitRatioAvg'
--
-- * 'eqsWaitMsAvg'
--
-- * 'eqsId'
--
-- * 'eqsComputeRatioMax'
--
-- * 'eqsWriteRatioMax'
--
-- * 'eqsComputeMsAvg'
--
-- * 'eqsReadRatioAvg'
--
-- * 'eqsWriteMsAvg'
--
-- * 'eqsStartMs'
--
-- * 'eqsEndMs'
--
-- * 'eqsWaitMsMax'
explainQueryStage
    :: ExplainQueryStage
explainQueryStage =
    ExplainQueryStage'
    { _eqsReadMsAvg = Nothing
    , _eqsStatus = Nothing
    , _eqsShuffleOutputBytesSpilled = Nothing
    , _eqsReadMsMax = Nothing
    , _eqsCompletedParallelInputs = Nothing
    , _eqsWaitRatioMax = Nothing
    , _eqsParallelInputs = Nothing
    , _eqsShuffleOutputBytes = Nothing
    , _eqsRecordsWritten = Nothing
    , _eqsSteps = Nothing
    , _eqsInputStages = Nothing
    , _eqsWriteRatioAvg = Nothing
    , _eqsRecordsRead = Nothing
    , _eqsComputeRatioAvg = Nothing
    , _eqsName = Nothing
    , _eqsComputeMsMax = Nothing
    , _eqsReadRatioMax = Nothing
    , _eqsWriteMsMax = Nothing
    , _eqsWaitRatioAvg = Nothing
    , _eqsWaitMsAvg = Nothing
    , _eqsId = Nothing
    , _eqsComputeRatioMax = Nothing
    , _eqsWriteRatioMax = Nothing
    , _eqsComputeMsAvg = Nothing
    , _eqsReadRatioAvg = Nothing
    , _eqsWriteMsAvg = Nothing
    , _eqsStartMs = Nothing
    , _eqsEndMs = Nothing
    , _eqsWaitMsMax = Nothing
    }

-- | Milliseconds the average shard spent reading input.
eqsReadMsAvg :: Lens' ExplainQueryStage (Maybe Int64)
eqsReadMsAvg
  = lens _eqsReadMsAvg (\ s a -> s{_eqsReadMsAvg = a})
      . mapping _Coerce

-- | Current status for the stage.
eqsStatus :: Lens' ExplainQueryStage (Maybe Text)
eqsStatus
  = lens _eqsStatus (\ s a -> s{_eqsStatus = a})

-- | Total number of bytes written to shuffle and spilled to disk.
eqsShuffleOutputBytesSpilled :: Lens' ExplainQueryStage (Maybe Int64)
eqsShuffleOutputBytesSpilled
  = lens _eqsShuffleOutputBytesSpilled
      (\ s a -> s{_eqsShuffleOutputBytesSpilled = a})
      . mapping _Coerce

-- | Milliseconds the slowest shard spent reading input.
eqsReadMsMax :: Lens' ExplainQueryStage (Maybe Int64)
eqsReadMsMax
  = lens _eqsReadMsMax (\ s a -> s{_eqsReadMsMax = a})
      . mapping _Coerce

-- | Number of parallel input segments completed.
eqsCompletedParallelInputs :: Lens' ExplainQueryStage (Maybe Int64)
eqsCompletedParallelInputs
  = lens _eqsCompletedParallelInputs
      (\ s a -> s{_eqsCompletedParallelInputs = a})
      . mapping _Coerce

-- | Relative amount of time the slowest shard spent waiting to be scheduled.
eqsWaitRatioMax :: Lens' ExplainQueryStage (Maybe Double)
eqsWaitRatioMax
  = lens _eqsWaitRatioMax
      (\ s a -> s{_eqsWaitRatioMax = a})
      . mapping _Coerce

-- | Number of parallel input segments to be processed.
eqsParallelInputs :: Lens' ExplainQueryStage (Maybe Int64)
eqsParallelInputs
  = lens _eqsParallelInputs
      (\ s a -> s{_eqsParallelInputs = a})
      . mapping _Coerce

-- | Total number of bytes written to shuffle.
eqsShuffleOutputBytes :: Lens' ExplainQueryStage (Maybe Int64)
eqsShuffleOutputBytes
  = lens _eqsShuffleOutputBytes
      (\ s a -> s{_eqsShuffleOutputBytes = a})
      . mapping _Coerce

-- | Number of records written by the stage.
eqsRecordsWritten :: Lens' ExplainQueryStage (Maybe Int64)
eqsRecordsWritten
  = lens _eqsRecordsWritten
      (\ s a -> s{_eqsRecordsWritten = a})
      . mapping _Coerce

-- | List of operations within the stage in dependency order (approximately
-- chronological).
eqsSteps :: Lens' ExplainQueryStage [ExplainQueryStep]
eqsSteps
  = lens _eqsSteps (\ s a -> s{_eqsSteps = a}) .
      _Default
      . _Coerce

-- | IDs for stages that are inputs to this stage.
eqsInputStages :: Lens' ExplainQueryStage [Int64]
eqsInputStages
  = lens _eqsInputStages
      (\ s a -> s{_eqsInputStages = a})
      . _Default
      . _Coerce

-- | Relative amount of time the average shard spent on writing output.
eqsWriteRatioAvg :: Lens' ExplainQueryStage (Maybe Double)
eqsWriteRatioAvg
  = lens _eqsWriteRatioAvg
      (\ s a -> s{_eqsWriteRatioAvg = a})
      . mapping _Coerce

-- | Number of records read into the stage.
eqsRecordsRead :: Lens' ExplainQueryStage (Maybe Int64)
eqsRecordsRead
  = lens _eqsRecordsRead
      (\ s a -> s{_eqsRecordsRead = a})
      . mapping _Coerce

-- | Relative amount of time the average shard spent on CPU-bound tasks.
eqsComputeRatioAvg :: Lens' ExplainQueryStage (Maybe Double)
eqsComputeRatioAvg
  = lens _eqsComputeRatioAvg
      (\ s a -> s{_eqsComputeRatioAvg = a})
      . mapping _Coerce

-- | Human-readable name for stage.
eqsName :: Lens' ExplainQueryStage (Maybe Text)
eqsName = lens _eqsName (\ s a -> s{_eqsName = a})

-- | Milliseconds the slowest shard spent on CPU-bound tasks.
eqsComputeMsMax :: Lens' ExplainQueryStage (Maybe Int64)
eqsComputeMsMax
  = lens _eqsComputeMsMax
      (\ s a -> s{_eqsComputeMsMax = a})
      . mapping _Coerce

-- | Relative amount of time the slowest shard spent reading input.
eqsReadRatioMax :: Lens' ExplainQueryStage (Maybe Double)
eqsReadRatioMax
  = lens _eqsReadRatioMax
      (\ s a -> s{_eqsReadRatioMax = a})
      . mapping _Coerce

-- | Milliseconds the slowest shard spent on writing output.
eqsWriteMsMax :: Lens' ExplainQueryStage (Maybe Int64)
eqsWriteMsMax
  = lens _eqsWriteMsMax
      (\ s a -> s{_eqsWriteMsMax = a})
      . mapping _Coerce

-- | Relative amount of time the average shard spent waiting to be scheduled.
eqsWaitRatioAvg :: Lens' ExplainQueryStage (Maybe Double)
eqsWaitRatioAvg
  = lens _eqsWaitRatioAvg
      (\ s a -> s{_eqsWaitRatioAvg = a})
      . mapping _Coerce

-- | Milliseconds the average shard spent waiting to be scheduled.
eqsWaitMsAvg :: Lens' ExplainQueryStage (Maybe Int64)
eqsWaitMsAvg
  = lens _eqsWaitMsAvg (\ s a -> s{_eqsWaitMsAvg = a})
      . mapping _Coerce

-- | Unique ID for stage within plan.
eqsId :: Lens' ExplainQueryStage (Maybe Int64)
eqsId
  = lens _eqsId (\ s a -> s{_eqsId = a}) .
      mapping _Coerce

-- | Relative amount of time the slowest shard spent on CPU-bound tasks.
eqsComputeRatioMax :: Lens' ExplainQueryStage (Maybe Double)
eqsComputeRatioMax
  = lens _eqsComputeRatioMax
      (\ s a -> s{_eqsComputeRatioMax = a})
      . mapping _Coerce

-- | Relative amount of time the slowest shard spent on writing output.
eqsWriteRatioMax :: Lens' ExplainQueryStage (Maybe Double)
eqsWriteRatioMax
  = lens _eqsWriteRatioMax
      (\ s a -> s{_eqsWriteRatioMax = a})
      . mapping _Coerce

-- | Milliseconds the average shard spent on CPU-bound tasks.
eqsComputeMsAvg :: Lens' ExplainQueryStage (Maybe Int64)
eqsComputeMsAvg
  = lens _eqsComputeMsAvg
      (\ s a -> s{_eqsComputeMsAvg = a})
      . mapping _Coerce

-- | Relative amount of time the average shard spent reading input.
eqsReadRatioAvg :: Lens' ExplainQueryStage (Maybe Double)
eqsReadRatioAvg
  = lens _eqsReadRatioAvg
      (\ s a -> s{_eqsReadRatioAvg = a})
      . mapping _Coerce

-- | Milliseconds the average shard spent on writing output.
eqsWriteMsAvg :: Lens' ExplainQueryStage (Maybe Int64)
eqsWriteMsAvg
  = lens _eqsWriteMsAvg
      (\ s a -> s{_eqsWriteMsAvg = a})
      . mapping _Coerce

-- | Stage start time represented as milliseconds since epoch.
eqsStartMs :: Lens' ExplainQueryStage (Maybe Int64)
eqsStartMs
  = lens _eqsStartMs (\ s a -> s{_eqsStartMs = a}) .
      mapping _Coerce

-- | Stage end time represented as milliseconds since epoch.
eqsEndMs :: Lens' ExplainQueryStage (Maybe Int64)
eqsEndMs
  = lens _eqsEndMs (\ s a -> s{_eqsEndMs = a}) .
      mapping _Coerce

-- | Milliseconds the slowest shard spent waiting to be scheduled.
eqsWaitMsMax :: Lens' ExplainQueryStage (Maybe Int64)
eqsWaitMsMax
  = lens _eqsWaitMsMax (\ s a -> s{_eqsWaitMsMax = a})
      . mapping _Coerce

instance FromJSON ExplainQueryStage where
        parseJSON
          = withObject "ExplainQueryStage"
              (\ o ->
                 ExplainQueryStage' <$>
                   (o .:? "readMsAvg") <*> (o .:? "status") <*>
                     (o .:? "shuffleOutputBytesSpilled")
                     <*> (o .:? "readMsMax")
                     <*> (o .:? "completedParallelInputs")
                     <*> (o .:? "waitRatioMax")
                     <*> (o .:? "parallelInputs")
                     <*> (o .:? "shuffleOutputBytes")
                     <*> (o .:? "recordsWritten")
                     <*> (o .:? "steps" .!= mempty)
                     <*> (o .:? "inputStages" .!= mempty)
                     <*> (o .:? "writeRatioAvg")
                     <*> (o .:? "recordsRead")
                     <*> (o .:? "computeRatioAvg")
                     <*> (o .:? "name")
                     <*> (o .:? "computeMsMax")
                     <*> (o .:? "readRatioMax")
                     <*> (o .:? "writeMsMax")
                     <*> (o .:? "waitRatioAvg")
                     <*> (o .:? "waitMsAvg")
                     <*> (o .:? "id")
                     <*> (o .:? "computeRatioMax")
                     <*> (o .:? "writeRatioMax")
                     <*> (o .:? "computeMsAvg")
                     <*> (o .:? "readRatioAvg")
                     <*> (o .:? "writeMsAvg")
                     <*> (o .:? "startMs")
                     <*> (o .:? "endMs")
                     <*> (o .:? "waitMsMax"))

instance ToJSON ExplainQueryStage where
        toJSON ExplainQueryStage'{..}
          = object
              (catMaybes
                 [("readMsAvg" .=) <$> _eqsReadMsAvg,
                  ("status" .=) <$> _eqsStatus,
                  ("shuffleOutputBytesSpilled" .=) <$>
                    _eqsShuffleOutputBytesSpilled,
                  ("readMsMax" .=) <$> _eqsReadMsMax,
                  ("completedParallelInputs" .=) <$>
                    _eqsCompletedParallelInputs,
                  ("waitRatioMax" .=) <$> _eqsWaitRatioMax,
                  ("parallelInputs" .=) <$> _eqsParallelInputs,
                  ("shuffleOutputBytes" .=) <$> _eqsShuffleOutputBytes,
                  ("recordsWritten" .=) <$> _eqsRecordsWritten,
                  ("steps" .=) <$> _eqsSteps,
                  ("inputStages" .=) <$> _eqsInputStages,
                  ("writeRatioAvg" .=) <$> _eqsWriteRatioAvg,
                  ("recordsRead" .=) <$> _eqsRecordsRead,
                  ("computeRatioAvg" .=) <$> _eqsComputeRatioAvg,
                  ("name" .=) <$> _eqsName,
                  ("computeMsMax" .=) <$> _eqsComputeMsMax,
                  ("readRatioMax" .=) <$> _eqsReadRatioMax,
                  ("writeMsMax" .=) <$> _eqsWriteMsMax,
                  ("waitRatioAvg" .=) <$> _eqsWaitRatioAvg,
                  ("waitMsAvg" .=) <$> _eqsWaitMsAvg,
                  ("id" .=) <$> _eqsId,
                  ("computeRatioMax" .=) <$> _eqsComputeRatioMax,
                  ("writeRatioMax" .=) <$> _eqsWriteRatioMax,
                  ("computeMsAvg" .=) <$> _eqsComputeMsAvg,
                  ("readRatioAvg" .=) <$> _eqsReadRatioAvg,
                  ("writeMsAvg" .=) <$> _eqsWriteMsAvg,
                  ("startMs" .=) <$> _eqsStartMs,
                  ("endMs" .=) <$> _eqsEndMs,
                  ("waitMsMax" .=) <$> _eqsWaitMsMax])

-- | [Output-only, Beta] Training options used by this training run. These
-- options are mutable for subsequent training runs. Default values are
-- explicitly stored for options not specified in the input query of the
-- first training run. For subsequent training runs, any option not
-- explicitly specified in the input query will be copied from the previous
-- training run.
--
-- /See:/ 'trainingRunTrainingOptions' smart constructor.
data TrainingRunTrainingOptions = TrainingRunTrainingOptions'
    { _trtoLineSearchInitLearnRate :: !(Maybe (Textual Double))
    , _trtoMinRelProgress          :: !(Maybe (Textual Double))
    , _trtoL1Reg                   :: !(Maybe (Textual Double))
    , _trtoLearnRate               :: !(Maybe (Textual Double))
    , _trtoLearnRateStrategy       :: !(Maybe Text)
    , _trtoMaxIteration            :: !(Maybe (Textual Int64))
    , _trtoEarlyStop               :: !(Maybe Bool)
    , _trtoL2Reg                   :: !(Maybe (Textual Double))
    , _trtoWarmStart               :: !(Maybe Bool)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'TrainingRunTrainingOptions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'trtoLineSearchInitLearnRate'
--
-- * 'trtoMinRelProgress'
--
-- * 'trtoL1Reg'
--
-- * 'trtoLearnRate'
--
-- * 'trtoLearnRateStrategy'
--
-- * 'trtoMaxIteration'
--
-- * 'trtoEarlyStop'
--
-- * 'trtoL2Reg'
--
-- * 'trtoWarmStart'
trainingRunTrainingOptions
    :: TrainingRunTrainingOptions
trainingRunTrainingOptions =
    TrainingRunTrainingOptions'
    { _trtoLineSearchInitLearnRate = Nothing
    , _trtoMinRelProgress = Nothing
    , _trtoL1Reg = Nothing
    , _trtoLearnRate = Nothing
    , _trtoLearnRateStrategy = Nothing
    , _trtoMaxIteration = Nothing
    , _trtoEarlyStop = Nothing
    , _trtoL2Reg = Nothing
    , _trtoWarmStart = Nothing
    }

trtoLineSearchInitLearnRate :: Lens' TrainingRunTrainingOptions (Maybe Double)
trtoLineSearchInitLearnRate
  = lens _trtoLineSearchInitLearnRate
      (\ s a -> s{_trtoLineSearchInitLearnRate = a})
      . mapping _Coerce

trtoMinRelProgress :: Lens' TrainingRunTrainingOptions (Maybe Double)
trtoMinRelProgress
  = lens _trtoMinRelProgress
      (\ s a -> s{_trtoMinRelProgress = a})
      . mapping _Coerce

trtoL1Reg :: Lens' TrainingRunTrainingOptions (Maybe Double)
trtoL1Reg
  = lens _trtoL1Reg (\ s a -> s{_trtoL1Reg = a}) .
      mapping _Coerce

trtoLearnRate :: Lens' TrainingRunTrainingOptions (Maybe Double)
trtoLearnRate
  = lens _trtoLearnRate
      (\ s a -> s{_trtoLearnRate = a})
      . mapping _Coerce

trtoLearnRateStrategy :: Lens' TrainingRunTrainingOptions (Maybe Text)
trtoLearnRateStrategy
  = lens _trtoLearnRateStrategy
      (\ s a -> s{_trtoLearnRateStrategy = a})

trtoMaxIteration :: Lens' TrainingRunTrainingOptions (Maybe Int64)
trtoMaxIteration
  = lens _trtoMaxIteration
      (\ s a -> s{_trtoMaxIteration = a})
      . mapping _Coerce

trtoEarlyStop :: Lens' TrainingRunTrainingOptions (Maybe Bool)
trtoEarlyStop
  = lens _trtoEarlyStop
      (\ s a -> s{_trtoEarlyStop = a})

trtoL2Reg :: Lens' TrainingRunTrainingOptions (Maybe Double)
trtoL2Reg
  = lens _trtoL2Reg (\ s a -> s{_trtoL2Reg = a}) .
      mapping _Coerce

trtoWarmStart :: Lens' TrainingRunTrainingOptions (Maybe Bool)
trtoWarmStart
  = lens _trtoWarmStart
      (\ s a -> s{_trtoWarmStart = a})

instance FromJSON TrainingRunTrainingOptions where
        parseJSON
          = withObject "TrainingRunTrainingOptions"
              (\ o ->
                 TrainingRunTrainingOptions' <$>
                   (o .:? "lineSearchInitLearnRate") <*>
                     (o .:? "minRelProgress")
                     <*> (o .:? "l1Reg")
                     <*> (o .:? "learnRate")
                     <*> (o .:? "learnRateStrategy")
                     <*> (o .:? "maxIteration")
                     <*> (o .:? "earlyStop")
                     <*> (o .:? "l2Reg")
                     <*> (o .:? "warmStart"))

instance ToJSON TrainingRunTrainingOptions where
        toJSON TrainingRunTrainingOptions'{..}
          = object
              (catMaybes
                 [("lineSearchInitLearnRate" .=) <$>
                    _trtoLineSearchInitLearnRate,
                  ("minRelProgress" .=) <$> _trtoMinRelProgress,
                  ("l1Reg" .=) <$> _trtoL1Reg,
                  ("learnRate" .=) <$> _trtoLearnRate,
                  ("learnRateStrategy" .=) <$> _trtoLearnRateStrategy,
                  ("maxIteration" .=) <$> _trtoMaxIteration,
                  ("earlyStop" .=) <$> _trtoEarlyStop,
                  ("l2Reg" .=) <$> _trtoL2Reg,
                  ("warmStart" .=) <$> _trtoWarmStart])

--
-- /See:/ 'bigQueryModelTraining' smart constructor.
data BigQueryModelTraining = BigQueryModelTraining'
    { _bqmtExpectedTotalIterations :: !(Maybe (Textual Int64))
    , _bqmtCurrentIteration        :: !(Maybe (Textual Int32))
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'BigQueryModelTraining' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bqmtExpectedTotalIterations'
--
-- * 'bqmtCurrentIteration'
bigQueryModelTraining
    :: BigQueryModelTraining
bigQueryModelTraining =
    BigQueryModelTraining'
    { _bqmtExpectedTotalIterations = Nothing
    , _bqmtCurrentIteration = Nothing
    }

-- | [Output-only, Beta] Expected number of iterations for the create model
-- query job specified as num_iterations in the input query. The actual
-- total number of iterations may be less than this number due to early
-- stop.
bqmtExpectedTotalIterations :: Lens' BigQueryModelTraining (Maybe Int64)
bqmtExpectedTotalIterations
  = lens _bqmtExpectedTotalIterations
      (\ s a -> s{_bqmtExpectedTotalIterations = a})
      . mapping _Coerce

-- | [Output-only, Beta] Index of current ML training iteration. Updated
-- during create model query job to show job progress.
bqmtCurrentIteration :: Lens' BigQueryModelTraining (Maybe Int32)
bqmtCurrentIteration
  = lens _bqmtCurrentIteration
      (\ s a -> s{_bqmtCurrentIteration = a})
      . mapping _Coerce

instance FromJSON BigQueryModelTraining where
        parseJSON
          = withObject "BigQueryModelTraining"
              (\ o ->
                 BigQueryModelTraining' <$>
                   (o .:? "expectedTotalIterations") <*>
                     (o .:? "currentIteration"))

instance ToJSON BigQueryModelTraining where
        toJSON BigQueryModelTraining'{..}
          = object
              (catMaybes
                 [("expectedTotalIterations" .=) <$>
                    _bqmtExpectedTotalIterations,
                  ("currentIteration" .=) <$> _bqmtCurrentIteration])

--
-- /See:/ 'jobConfigurationLoad' smart constructor.
data JobConfigurationLoad = JobConfigurationLoad'
    { _jclSkipLeadingRows                    :: !(Maybe (Textual Int32))
    , _jclProjectionFields                   :: !(Maybe [Text])
    , _jclDestinationTable                   :: !(Maybe TableReference)
    , _jclWriteDisPosition                   :: !(Maybe Text)
    , _jclAllowJaggedRows                    :: !(Maybe Bool)
    , _jclClustering                         :: !(Maybe Clustering)
    , _jclRangePartitioning                  :: !(Maybe RangePartitioning)
    , _jclSchemaInline                       :: !(Maybe Text)
    , _jclIgnoreUnknownValues                :: !(Maybe Bool)
    , _jclSchemaUpdateOptions                :: !(Maybe [Text])
    , _jclCreateDisPosition                  :: !(Maybe Text)
    , _jclSchemaInlineFormat                 :: !(Maybe Text)
    , _jclAllowQuotedNewlines                :: !(Maybe Bool)
    , _jclSourceFormat                       :: !(Maybe Text)
    , _jclUseAvroLogicalTypes                :: !(Maybe Bool)
    , _jclSchema                             :: !(Maybe TableSchema)
    , _jclTimePartitioning                   :: !(Maybe TimePartitioning)
    , _jclQuote                              :: !(Maybe Text)
    , _jclMaxBadRecords                      :: !(Maybe (Textual Int32))
    , _jclAutodetect                         :: !(Maybe Bool)
    , _jclSourceURIs                         :: !(Maybe [Text])
    , _jclEncoding                           :: !(Maybe Text)
    , _jclDestinationTableProperties         :: !(Maybe DestinationTableProperties)
    , _jclDestinationEncryptionConfiguration :: !(Maybe EncryptionConfiguration)
    , _jclFieldDelimiter                     :: !(Maybe Text)
    , _jclNullMarker                         :: !(Maybe Text)
    } deriving (Eq,Show,Data,Typeable,Generic)

-- | Creates a value of 'JobConfigurationLoad' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jclSkipLeadingRows'
--
-- * 'jclProjectionFields'
--
-- * 'jclDestinationTable'
--
-- * 'jclWriteDisPosition'
--
-- * 'jclAllowJaggedRows'
--
-- * 'jclClustering'
--
-- * 'jclRangePartitioning'
--
-- * 'jclSchemaInline'
--
-- * 'jclIgnoreUnknownValues'
--
-- * 'jclSchemaUpdateOptions'
--
-- * 'jclCreateDisPosition'
--
-- * 'jclSchemaInlineFormat'
--
-- * 'jclAllowQuotedNewlines'
--
-- * 'jclSourceFormat'
--
-- * 'jclUseAvroLogicalTypes'
--
-- * 'jclSchema'
--
-- * 'jclTimePartitioning'
--
-- * 'jclQuote'
--
-- * 'jclMaxBadRecords'
--
-- * 'jclAutodetect'
--
-- * 'jclSourceURIs'
--
-- * 'jclEncoding'
--
-- * 'jclDestinationTableProperties'
--
-- * 'jclDestinationEncryptionConfiguration'
--
-- * 'jclFieldDelimiter'
--
-- * 'jclNullMarker'
jobConfigurationLoad
    :: JobConfigurationLoad
jobConfigurationLoad =
    JobConfigurationLoad'
    { _jclSkipLeadingRows = Nothing
    , _jclProjectionFields = Nothing
    , _jclDestinationTable = Nothing
    , _jclWriteDisPosition = Nothing
    , _jclAllowJaggedRows = Nothing
    , _jclClustering = Nothing
    , _jclRangePartitioning = Nothing
    , _jclSchemaInline = Nothing
    , _jclIgnoreUnknownValues = Nothing
    , _jclSchemaUpdateOptions = Nothing
    , _jclCreateDisPosition = Nothing
    , _jclSchemaInlineFormat = Nothing
    , _jclAllowQuotedNewlines = Nothing
    , _jclSourceFormat = Nothing
    , _jclUseAvroLogicalTypes = Nothing
    , _jclSchema = Nothing
    , _jclTimePartitioning = Nothing
    , _jclQuote = Nothing
    , _jclMaxBadRecords = Nothing
    , _jclAutodetect = Nothing
    , _jclSourceURIs = Nothing
    , _jclEncoding = Nothing
    , _jclDestinationTableProperties = Nothing
    , _jclDestinationEncryptionConfiguration = Nothing
    , _jclFieldDelimiter = Nothing
    , _jclNullMarker = Nothing
    }

-- | [Optional] The number of rows at the top of a CSV file that BigQuery
-- will skip when loading the data. The default value is 0. This property
-- is useful if you have header rows in the file that should be skipped.
jclSkipLeadingRows :: Lens' JobConfigurationLoad (Maybe Int32)
jclSkipLeadingRows
  = lens _jclSkipLeadingRows
      (\ s a -> s{_jclSkipLeadingRows = a})
      . mapping _Coerce

-- | If sourceFormat is set to \"DATASTORE_BACKUP\", indicates which entity
-- properties to load into BigQuery from a Cloud Datastore backup. Property
-- names are case sensitive and must be top-level properties. If no
-- properties are specified, BigQuery loads all properties. If any named
-- property isn\'t found in the Cloud Datastore backup, an invalid error is
-- returned in the job result.
jclProjectionFields :: Lens' JobConfigurationLoad [Text]
jclProjectionFields
  = lens _jclProjectionFields
      (\ s a -> s{_jclProjectionFields = a})
      . _Default
      . _Coerce

-- | [Required] The destination table to load the data into.
jclDestinationTable :: Lens' JobConfigurationLoad (Maybe TableReference)
jclDestinationTable
  = lens _jclDestinationTable
      (\ s a -> s{_jclDestinationTable = a})

-- | [Optional] Specifies the action that occurs if the destination table
-- already exists. The following values are supported: WRITE_TRUNCATE: If
-- the table already exists, BigQuery overwrites the table data.
-- WRITE_APPEND: If the table already exists, BigQuery appends the data to
-- the table. WRITE_EMPTY: If the table already exists and contains data, a
-- \'duplicate\' error is returned in the job result. The default value is
-- WRITE_APPEND. Each action is atomic and only occurs if BigQuery is able
-- to complete the job successfully. Creation, truncation and append
-- actions occur as one atomic update upon job completion.
jclWriteDisPosition :: Lens' JobConfigurationLoad (Maybe Text)
jclWriteDisPosition
  = lens _jclWriteDisPosition
      (\ s a -> s{_jclWriteDisPosition = a})

-- | [Optional] Accept rows that are missing trailing optional columns. The
-- missing values are treated as nulls. If false, records with missing
-- trailing columns are treated as bad records, and if there are too many
-- bad records, an invalid error is returned in the job result. The default
-- value is false. Only applicable to CSV, ignored for other formats.
jclAllowJaggedRows :: Lens' JobConfigurationLoad (Maybe Bool)
jclAllowJaggedRows
  = lens _jclAllowJaggedRows
      (\ s a -> s{_jclAllowJaggedRows = a})

-- | [Beta] Clustering specification for the destination table. Must be
-- specified with time-based partitioning, data in the table will be first
-- partitioned and subsequently clustered.
jclClustering :: Lens' JobConfigurationLoad (Maybe Clustering)
jclClustering
  = lens _jclClustering
      (\ s a -> s{_jclClustering = a})

-- | [TrustedTester] Range partitioning specification for this table. Only
-- one of timePartitioning and rangePartitioning should be specified.
jclRangePartitioning :: Lens' JobConfigurationLoad (Maybe RangePartitioning)
jclRangePartitioning
  = lens _jclRangePartitioning
      (\ s a -> s{_jclRangePartitioning = a})

-- | [Deprecated] The inline schema. For CSV schemas, specify as
-- \"Field1:Type1[,Field2:Type2]*\". For example, \"foo:STRING,
-- bar:INTEGER, baz:FLOAT\".
jclSchemaInline :: Lens' JobConfigurationLoad (Maybe Text)
jclSchemaInline
  = lens _jclSchemaInline
      (\ s a -> s{_jclSchemaInline = a})

-- | [Optional] Indicates if BigQuery should allow extra values that are not
-- represented in the table schema. If true, the extra values are ignored.
-- If false, records with extra columns are treated as bad records, and if
-- there are too many bad records, an invalid error is returned in the job
-- result. The default value is false. The sourceFormat property determines
-- what BigQuery treats as an extra value: CSV: Trailing columns JSON:
-- Named values that don\'t match any column names
jclIgnoreUnknownValues :: Lens' JobConfigurationLoad (Maybe Bool)
jclIgnoreUnknownValues
  = lens _jclIgnoreUnknownValues
      (\ s a -> s{_jclIgnoreUnknownValues = a})

-- | Allows the schema of the destination table to be updated as a side
-- effect of the load job if a schema is autodetected or supplied in the
-- job configuration. Schema update options are supported in two cases:
-- when writeDisposition is WRITE_APPEND; when writeDisposition is
-- WRITE_TRUNCATE and the destination table is a partition of a table,
-- specified by partition decorators. For normal tables, WRITE_TRUNCATE
-- will always overwrite the schema. One or more of the following values
-- are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to
-- the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in
-- the original schema to nullable.
jclSchemaUpdateOptions :: Lens' JobConfigurationLoad [Text]
jclSchemaUpdateOptions
  = lens _jclSchemaUpdateOptions
      (\ s a -> s{_jclSchemaUpdateOptions = a})
      . _Default
      . _Coerce

-- | [Optional] Specifies whether the job is allowed to create new tables.
-- The following values are supported: CREATE_IF_NEEDED: If the table does
-- not exist, BigQuery creates the table. CREATE_NEVER: The table must
-- already exist. If it does not, a \'notFound\' error is returned in the
-- job result. The default value is CREATE_IF_NEEDED. Creation, truncation
-- and append actions occur as one atomic update upon job completion.
jclCreateDisPosition :: Lens' JobConfigurationLoad (Maybe Text)
jclCreateDisPosition
  = lens _jclCreateDisPosition
      (\ s a -> s{_jclCreateDisPosition = a})

-- | [Deprecated] The format of the schemaInline property.
jclSchemaInlineFormat :: Lens' JobConfigurationLoad (Maybe Text)
jclSchemaInlineFormat
  = lens _jclSchemaInlineFormat
      (\ s a -> s{_jclSchemaInlineFormat = a})

-- | Indicates if BigQuery should allow quoted data sections that contain
-- newline characters in a CSV file. The default value is false.
jclAllowQuotedNewlines :: Lens' JobConfigurationLoad (Maybe Bool)
jclAllowQuotedNewlines
  = lens _jclAllowQuotedNewlines
      (\ s a -> s{_jclAllowQuotedNewlines = a})

-- | [Optional] The format of the data files. For CSV files, specify \"CSV\".
-- For datastore backups, specify \"DATASTORE_BACKUP\". For
-- newline-delimited JSON, specify \"NEWLINE_DELIMITED_JSON\". For Avro,
-- specify \"AVRO\". For parquet, specify \"PARQUET\". For orc, specify
-- \"ORC\". The default value is CSV.
jclSourceFormat :: Lens' JobConfigurationLoad (Maybe Text)
jclSourceFormat
  = lens _jclSourceFormat
      (\ s a -> s{_jclSourceFormat = a})

-- | [Optional] If sourceFormat is set to \"AVRO\", indicates whether to
-- enable interpreting logical types into their corresponding types (ie.
-- TIMESTAMP), instead of only using their raw types (ie. INTEGER).
jclUseAvroLogicalTypes :: Lens' JobConfigurationLoad (Maybe Bool)
jclUseAvroLogicalTypes
  = lens _jclUseAvroLogicalTypes
      (\ s a -> s{_jclUseAvroLogicalTypes = a})

-- | [Optional] The schema for the destination table. The schema can be
-- omitted if the destination table already exists, or if you\'re loading
-- data from Google Cloud Datastore.
jclSchema :: Lens' JobConfigurationLoad (Maybe TableSchema)
jclSchema
  = lens _jclSchema (\ s a -> s{_jclSchema = a})

-- | Time-based partitioning specification for the destination table. Only
-- one of timePartitioning and rangePartitioning should be specified.
jclTimePartitioning :: Lens' JobConfigurationLoad (Maybe TimePartitioning)
jclTimePartitioning
  = lens _jclTimePartitioning
      (\ s a -> s{_jclTimePartitioning = a})

-- | [Optional] The value that is used to quote data sections in a CSV file.
-- BigQuery converts the string to ISO-8859-1 encoding, and then uses the
-- first byte of the encoded string to split the data in its raw, binary
-- state. The default value is a double-quote (\'\"\'). If your data does
-- not contain quoted sections, set the property value to an empty string.
-- If your data contains quoted newline characters, you must also set the
-- allowQuotedNewlines property to true.
jclQuote :: Lens' JobConfigurationLoad (Maybe Text)
jclQuote = lens _jclQuote (\ s a -> s{_jclQuote = a})

-- | [Optional] The maximum number of bad records that BigQuery can ignore
-- when running the job. If the number of bad records exceeds this value,
-- an invalid error is returned in the job result. This is only valid for
-- CSV and JSON. The default value is 0, which requires that all records
-- are valid.
jclMaxBadRecords :: Lens' JobConfigurationLoad (Maybe Int32)
jclMaxBadRecords
  = lens _jclMaxBadRecords
      (\ s a -> s{_jclMaxBadRecords = a})
      . mapping _Coerce

-- | [Optional] Indicates if we should automatically infer the options and
-- schema for CSV and JSON sources.
jclAutodetect :: Lens' JobConfigurationLoad (Maybe Bool)
jclAutodetect
  = lens _jclAutodetect
      (\ s a -> s{_jclAutodetect = a})

-- | [Required] The fully-qualified URIs that point to your data in Google
-- Cloud. For Google Cloud Storage URIs: Each URI can contain one \'*\'
-- wildcard character and it must come after the \'bucket\' name. Size
-- limits related to load jobs apply to external data sources. For Google
-- Cloud Bigtable URIs: Exactly one URI can be specified and it has be a
-- fully specified and valid HTTPS URL for a Google Cloud Bigtable table.
-- For Google Cloud Datastore backups: Exactly one URI can be specified.
-- Also, the \'*\' wildcard character is not allowed.
jclSourceURIs :: Lens' JobConfigurationLoad [Text]
jclSourceURIs
  = lens _jclSourceURIs
      (\ s a -> s{_jclSourceURIs = a})
      . _Default
      . _Coerce

-- | [Optional] The character encoding of the data. The supported values are
-- UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the
-- data after the raw, binary data has been split using the values of the
-- quote and fieldDelimiter properties.
jclEncoding :: Lens' JobConfigurationLoad (Maybe Text)
jclEncoding
  = lens _jclEncoding (\ s a -> s{_jclEncoding = a})

-- | [Beta] [Optional] Properties with which to create the destination table
-- if it is new.
jclDestinationTableProperties :: Lens' JobConfigurationLoad (Maybe DestinationTableProperties)
jclDestinationTableProperties
  = lens _jclDestinationTableProperties
      (\ s a -> s{_jclDestinationTableProperties = a})

-- | Custom encryption configuration (e.g., Cloud KMS keys).
jclDestinationEncryptionConfiguration :: Lens' JobConfigurationLoad (Maybe EncryptionConfiguration)
jclDestinationEncryptionConfiguration
  = lens _jclDestinationEncryptionConfiguration
      (\ s a ->
         s{_jclDestinationEncryptionConfiguration = a})

-- | [Optional] The separator for fields in a CSV file. The separator can be
-- any ISO-8859-1 single-byte character. To use a character in the range
-- 128-255, you must encode the character as UTF8. BigQuery converts the
-- string to ISO-8859-1 encoding, and then uses the first byte of the
-- encoded string to split the data in its raw, binary state. BigQuery also
-- supports the escape sequence \"\\t\" to specify a tab separator. The
-- default value is a comma (\',\').
jclFieldDelimiter :: Lens' JobConfigurationLoad (Maybe Text)
jclFieldDelimiter
  = lens _jclFieldDelimiter
      (\ s a -> s{_jclFieldDelimiter = a})

-- | [Optional] Specifies a string that represents a null value in a CSV
-- file. For example, if you specify \"\\N\", BigQuery interprets \"\\N\"
-- as a null value when loading a CSV file. The default value is the empty
-- string. If you set this property to a custom value, BigQuery throws an
-- error if an empty string is present for all data types except for STRING
-- and BYTE. For STRING and BYTE columns, BigQuery interprets the empty
-- string as an empty value.
jclNullMarker :: Lens' JobConfigurationLoad (Maybe Text)
jclNullMarker
  = lens _jclNullMarker
      (\ s a -> s{_jclNullMarker = a})

instance FromJSON JobConfigurationLoad where
        parseJSON
          = withObject "JobConfigurationLoad"
              (\ o ->
                 JobConfigurationLoad' <$>
                   (o .:? "skipLeadingRows") <*>
                     (o .:? "projectionFields" .!= mempty)
                     <*> (o .:? "destinationTable")
                     <*> (