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

import           Network.Google.Prelude
import           Network.Google.Sheets.Types.Sum

-- | Information about which values in a pivot group should be used for
-- sorting.
--
-- /See:/ 'pivotGroupSortValueBucket' smart constructor.
data PivotGroupSortValueBucket =
  PivotGroupSortValueBucket'
    { _pgsvbBuckets     :: !(Maybe [ExtendedValue])
    , _pgsvbValuesIndex :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PivotGroupSortValueBucket' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pgsvbBuckets'
--
-- * 'pgsvbValuesIndex'
pivotGroupSortValueBucket
    :: PivotGroupSortValueBucket
pivotGroupSortValueBucket =
  PivotGroupSortValueBucket'
    {_pgsvbBuckets = Nothing, _pgsvbValuesIndex = Nothing}


-- | Determines the bucket from which values are chosen to sort. For example,
-- in a pivot table with one row group & two column groups, the row group
-- can list up to two values. The first value corresponds to a value within
-- the first column group, and the second value corresponds to a value in
-- the second column group. If no values are listed, this would indicate
-- that the row should be sorted according to the \"Grand Total\" over the
-- column groups. If a single value is listed, this would correspond to
-- using the \"Total\" of that bucket.
pgsvbBuckets :: Lens' PivotGroupSortValueBucket [ExtendedValue]
pgsvbBuckets
  = lens _pgsvbBuckets (\ s a -> s{_pgsvbBuckets = a})
      . _Default
      . _Coerce

-- | The offset in the PivotTable.values list which the values in this
-- grouping should be sorted by.
pgsvbValuesIndex :: Lens' PivotGroupSortValueBucket (Maybe Int32)
pgsvbValuesIndex
  = lens _pgsvbValuesIndex
      (\ s a -> s{_pgsvbValuesIndex = a})
      . mapping _Coerce

instance FromJSON PivotGroupSortValueBucket where
        parseJSON
          = withObject "PivotGroupSortValueBucket"
              (\ o ->
                 PivotGroupSortValueBucket' <$>
                   (o .:? "buckets" .!= mempty) <*>
                     (o .:? "valuesIndex"))

instance ToJSON PivotGroupSortValueBucket where
        toJSON PivotGroupSortValueBucket'{..}
          = object
              (catMaybes
                 [("buckets" .=) <$> _pgsvbBuckets,
                  ("valuesIndex" .=) <$> _pgsvbValuesIndex])

-- | Data within a range of the spreadsheet.
--
-- /See:/ 'valueRange' smart constructor.
data ValueRange =
  ValueRange'
    { _vrValues         :: !(Maybe [[JSONValue]])
    , _vrRange          :: !(Maybe Text)
    , _vrMajorDimension :: !(Maybe ValueRangeMajorDimension)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ValueRange' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vrValues'
--
-- * 'vrRange'
--
-- * 'vrMajorDimension'
valueRange
    :: ValueRange
valueRange =
  ValueRange'
    {_vrValues = Nothing, _vrRange = Nothing, _vrMajorDimension = Nothing}


-- | The data that was read or to be written. This is an array of arrays, the
-- outer array representing all the data and each inner array representing
-- a major dimension. Each item in the inner array corresponds with one
-- cell. For output, empty trailing rows and columns will not be included.
-- For input, supported value types are: bool, string, and double. Null
-- values will be skipped. To set a cell to an empty value, set the string
-- value to an empty string.
vrValues :: Lens' ValueRange [[JSONValue]]
vrValues
  = lens _vrValues (\ s a -> s{_vrValues = a}) .
      _Default
      . _Coerce

-- | The range the values cover, in A1 notation. For output, this range
-- indicates the entire requested range, even though the values will
-- exclude trailing rows and columns. When appending values, this field
-- represents the range to search for a table, after which values will be
-- appended.
vrRange :: Lens' ValueRange (Maybe Text)
vrRange = lens _vrRange (\ s a -> s{_vrRange = a})

-- | The major dimension of the values. For output, if the spreadsheet data
-- is: \`A1=1,B1=2,A2=3,B2=4\`, then requesting
-- \`range=A1:B2,majorDimension=ROWS\` will return \`[[1,2],[3,4]]\`,
-- whereas requesting \`range=A1:B2,majorDimension=COLUMNS\` will return
-- \`[[1,3],[2,4]]\`. For input, with \`range=A1:B2,majorDimension=ROWS\`
-- then \`[[1,2],[3,4]]\` will set \`A1=1,B1=2,A2=3,B2=4\`. With
-- \`range=A1:B2,majorDimension=COLUMNS\` then \`[[1,2],[3,4]]\` will set
-- \`A1=1,B1=3,A2=2,B2=4\`. When writing, if this field is not set, it
-- defaults to ROWS.
vrMajorDimension :: Lens' ValueRange (Maybe ValueRangeMajorDimension)
vrMajorDimension
  = lens _vrMajorDimension
      (\ s a -> s{_vrMajorDimension = a})

instance FromJSON ValueRange where
        parseJSON
          = withObject "ValueRange"
              (\ o ->
                 ValueRange' <$>
                   (o .:? "values" .!= mempty) <*> (o .:? "range") <*>
                     (o .:? "majorDimension"))

instance ToJSON ValueRange where
        toJSON ValueRange'{..}
          = object
              (catMaybes
                 [("values" .=) <$> _vrValues,
                  ("range" .=) <$> _vrRange,
                  ("majorDimension" .=) <$> _vrMajorDimension])

-- | Sorts data in rows based on a sort order per column.
--
-- /See:/ 'sortRangeRequest' smart constructor.
data SortRangeRequest =
  SortRangeRequest'
    { _srrSortSpecs :: !(Maybe [SortSpec])
    , _srrRange     :: !(Maybe GridRange)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SortRangeRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'srrSortSpecs'
--
-- * 'srrRange'
sortRangeRequest
    :: SortRangeRequest
sortRangeRequest =
  SortRangeRequest' {_srrSortSpecs = Nothing, _srrRange = Nothing}


-- | The sort order per column. Later specifications are used when values are
-- equal in the earlier specifications.
srrSortSpecs :: Lens' SortRangeRequest [SortSpec]
srrSortSpecs
  = lens _srrSortSpecs (\ s a -> s{_srrSortSpecs = a})
      . _Default
      . _Coerce

-- | The range to sort.
srrRange :: Lens' SortRangeRequest (Maybe GridRange)
srrRange = lens _srrRange (\ s a -> s{_srrRange = a})

instance FromJSON SortRangeRequest where
        parseJSON
          = withObject "SortRangeRequest"
              (\ o ->
                 SortRangeRequest' <$>
                   (o .:? "sortSpecs" .!= mempty) <*> (o .:? "range"))

instance ToJSON SortRangeRequest where
        toJSON SortRangeRequest'{..}
          = object
              (catMaybes
                 [("sortSpecs" .=) <$> _srrSortSpecs,
                  ("range" .=) <$> _srrRange])

-- | Removes the named range with the given ID from the spreadsheet.
--
-- /See:/ 'deleteNamedRangeRequest' smart constructor.
newtype DeleteNamedRangeRequest =
  DeleteNamedRangeRequest'
    { _dnrrNamedRangeId :: Maybe Text
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DeleteNamedRangeRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dnrrNamedRangeId'
deleteNamedRangeRequest
    :: DeleteNamedRangeRequest
deleteNamedRangeRequest = DeleteNamedRangeRequest' {_dnrrNamedRangeId = Nothing}


-- | The ID of the named range to delete.
dnrrNamedRangeId :: Lens' DeleteNamedRangeRequest (Maybe Text)
dnrrNamedRangeId
  = lens _dnrrNamedRangeId
      (\ s a -> s{_dnrrNamedRangeId = a})

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

instance ToJSON DeleteNamedRangeRequest where
        toJSON DeleteNamedRangeRequest'{..}
          = object
              (catMaybes
                 [("namedRangeId" .=) <$> _dnrrNamedRangeId])

-- | Updates properties of the named range with the specified namedRangeId.
--
-- /See:/ 'updateNamedRangeRequest' smart constructor.
data UpdateNamedRangeRequest =
  UpdateNamedRangeRequest'
    { _unrrNamedRange :: !(Maybe NamedRange)
    , _unrrFields     :: !(Maybe GFieldMask)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'UpdateNamedRangeRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'unrrNamedRange'
--
-- * 'unrrFields'
updateNamedRangeRequest
    :: UpdateNamedRangeRequest
updateNamedRangeRequest =
  UpdateNamedRangeRequest' {_unrrNamedRange = Nothing, _unrrFields = Nothing}


-- | The named range to update with the new properties.
unrrNamedRange :: Lens' UpdateNamedRangeRequest (Maybe NamedRange)
unrrNamedRange
  = lens _unrrNamedRange
      (\ s a -> s{_unrrNamedRange = a})

-- | The fields that should be updated. At least one field must be specified.
-- The root \`namedRange\` is implied and should not be specified. A single
-- \`\"*\"\` can be used as short-hand for listing every field.
unrrFields :: Lens' UpdateNamedRangeRequest (Maybe GFieldMask)
unrrFields
  = lens _unrrFields (\ s a -> s{_unrrFields = a})

instance FromJSON UpdateNamedRangeRequest where
        parseJSON
          = withObject "UpdateNamedRangeRequest"
              (\ o ->
                 UpdateNamedRangeRequest' <$>
                   (o .:? "namedRange") <*> (o .:? "fields"))

instance ToJSON UpdateNamedRangeRequest where
        toJSON UpdateNamedRangeRequest'{..}
          = object
              (catMaybes
                 [("namedRange" .=) <$> _unrrNamedRange,
                  ("fields" .=) <$> _unrrFields])

-- | The data included in a domain or series.
--
-- /See:/ 'chartData' smart constructor.
newtype ChartData =
  ChartData'
    { _cdSourceRange :: Maybe ChartSourceRange
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ChartData' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cdSourceRange'
chartData
    :: ChartData
chartData = ChartData' {_cdSourceRange = Nothing}


-- | The source ranges of the data.
cdSourceRange :: Lens' ChartData (Maybe ChartSourceRange)
cdSourceRange
  = lens _cdSourceRange
      (\ s a -> s{_cdSourceRange = a})

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

instance ToJSON ChartData where
        toJSON ChartData'{..}
          = object
              (catMaybes [("sourceRange" .=) <$> _cdSourceRange])

-- | The request for clearing more than one range of values in a spreadsheet.
--
-- /See:/ 'batchClearValuesRequest' smart constructor.
newtype BatchClearValuesRequest =
  BatchClearValuesRequest'
    { _bcvrRanges :: Maybe [Text]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BatchClearValuesRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bcvrRanges'
batchClearValuesRequest
    :: BatchClearValuesRequest
batchClearValuesRequest = BatchClearValuesRequest' {_bcvrRanges = Nothing}


-- | The ranges to clear, in A1 notation.
bcvrRanges :: Lens' BatchClearValuesRequest [Text]
bcvrRanges
  = lens _bcvrRanges (\ s a -> s{_bcvrRanges = a}) .
      _Default
      . _Coerce

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

instance ToJSON BatchClearValuesRequest where
        toJSON BatchClearValuesRequest'{..}
          = object (catMaybes [("ranges" .=) <$> _bcvrRanges])

-- | The response from creating developer metadata.
--
-- /See:/ 'createDeveloperMetadataResponse' smart constructor.
newtype CreateDeveloperMetadataResponse =
  CreateDeveloperMetadataResponse'
    { _cdmrDeveloperMetadata :: Maybe DeveloperMetadata
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'CreateDeveloperMetadataResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cdmrDeveloperMetadata'
createDeveloperMetadataResponse
    :: CreateDeveloperMetadataResponse
createDeveloperMetadataResponse =
  CreateDeveloperMetadataResponse' {_cdmrDeveloperMetadata = Nothing}


-- | The developer metadata that was created.
cdmrDeveloperMetadata :: Lens' CreateDeveloperMetadataResponse (Maybe DeveloperMetadata)
cdmrDeveloperMetadata
  = lens _cdmrDeveloperMetadata
      (\ s a -> s{_cdmrDeveloperMetadata = a})

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

instance ToJSON CreateDeveloperMetadataResponse where
        toJSON CreateDeveloperMetadataResponse'{..}
          = object
              (catMaybes
                 [("developerMetadata" .=) <$>
                    _cdmrDeveloperMetadata])

-- | Allows you to organize the date-time values in a source data column into
-- buckets based on selected parts of their date or time values. For
-- example, consider a pivot table showing sales transactions by date:
-- +----------+--------------+ | Date | SUM of Sales |
-- +----------+--------------+ | 1\/1\/2017 | $621.14 | | 2\/3\/2017 |
-- $708.84 | | 5\/8\/2017 | $326.84 | ... +----------+--------------+
-- Applying a date-time group rule with a DateTimeRuleType of YEAR_MONTH
-- results in the following pivot table. +--------------+--------------+ |
-- Grouped Date | SUM of Sales | +--------------+--------------+ | 2017-Jan
-- | $53,731.78 | | 2017-Feb | $83,475.32 | | 2017-Mar | $94,385.05 | ...
-- +--------------+--------------+
--
-- /See:/ 'dateTimeRule' smart constructor.
newtype DateTimeRule =
  DateTimeRule'
    { _dtrType :: Maybe DateTimeRuleType
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DateTimeRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dtrType'
dateTimeRule
    :: DateTimeRule
dateTimeRule = DateTimeRule' {_dtrType = Nothing}


-- | The type of date-time grouping to apply.
dtrType :: Lens' DateTimeRule (Maybe DateTimeRuleType)
dtrType = lens _dtrType (\ s a -> s{_dtrType = a})

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

instance ToJSON DateTimeRule where
        toJSON DateTimeRule'{..}
          = object (catMaybes [("type" .=) <$> _dtrType])

-- | Properties of a spreadsheet.
--
-- /See:/ 'spreadsheetProperties' smart constructor.
data SpreadsheetProperties =
  SpreadsheetProperties'
    { _spDefaultFormat                :: !(Maybe CellFormat)
    , _spLocale                       :: !(Maybe Text)
    , _spIterativeCalculationSettings :: !(Maybe IterativeCalculationSettings)
    , _spAutoRecalc                   :: !(Maybe SpreadsheetPropertiesAutoRecalc)
    , _spTitle                        :: !(Maybe Text)
    , _spTimeZone                     :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SpreadsheetProperties' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'spDefaultFormat'
--
-- * 'spLocale'
--
-- * 'spIterativeCalculationSettings'
--
-- * 'spAutoRecalc'
--
-- * 'spTitle'
--
-- * 'spTimeZone'
spreadsheetProperties
    :: SpreadsheetProperties
spreadsheetProperties =
  SpreadsheetProperties'
    { _spDefaultFormat = Nothing
    , _spLocale = Nothing
    , _spIterativeCalculationSettings = Nothing
    , _spAutoRecalc = Nothing
    , _spTitle = Nothing
    , _spTimeZone = Nothing
    }


-- | The default format of all cells in the spreadsheet.
-- CellData.effectiveFormat will not be set if the cell\'s format is equal
-- to this default format. This field is read-only.
spDefaultFormat :: Lens' SpreadsheetProperties (Maybe CellFormat)
spDefaultFormat
  = lens _spDefaultFormat
      (\ s a -> s{_spDefaultFormat = a})

-- | The locale of the spreadsheet in one of the following formats: * an ISO
-- 639-1 language code such as \`en\` * an ISO 639-2 language code such as
-- \`fil\`, if no 639-1 code exists * a combination of the ISO language
-- code and country code, such as \`en_US\` Note: when updating this field,
-- not all locales\/languages are supported.
spLocale :: Lens' SpreadsheetProperties (Maybe Text)
spLocale = lens _spLocale (\ s a -> s{_spLocale = a})

-- | Determines whether and how circular references are resolved with
-- iterative calculation. Absence of this field means that circular
-- references will result in calculation errors.
spIterativeCalculationSettings :: Lens' SpreadsheetProperties (Maybe IterativeCalculationSettings)
spIterativeCalculationSettings
  = lens _spIterativeCalculationSettings
      (\ s a -> s{_spIterativeCalculationSettings = a})

-- | The amount of time to wait before volatile functions are recalculated.
spAutoRecalc :: Lens' SpreadsheetProperties (Maybe SpreadsheetPropertiesAutoRecalc)
spAutoRecalc
  = lens _spAutoRecalc (\ s a -> s{_spAutoRecalc = a})

-- | The title of the spreadsheet.
spTitle :: Lens' SpreadsheetProperties (Maybe Text)
spTitle = lens _spTitle (\ s a -> s{_spTitle = a})

-- | The time zone of the spreadsheet, in CLDR format such as
-- \`America\/New_York\`. If the time zone isn\'t recognized, this may be a
-- custom time zone such as \`GMT-07:00\`.
spTimeZone :: Lens' SpreadsheetProperties (Maybe Text)
spTimeZone
  = lens _spTimeZone (\ s a -> s{_spTimeZone = a})

instance FromJSON SpreadsheetProperties where
        parseJSON
          = withObject "SpreadsheetProperties"
              (\ o ->
                 SpreadsheetProperties' <$>
                   (o .:? "defaultFormat") <*> (o .:? "locale") <*>
                     (o .:? "iterativeCalculationSettings")
                     <*> (o .:? "autoRecalc")
                     <*> (o .:? "title")
                     <*> (o .:? "timeZone"))

instance ToJSON SpreadsheetProperties where
        toJSON SpreadsheetProperties'{..}
          = object
              (catMaybes
                 [("defaultFormat" .=) <$> _spDefaultFormat,
                  ("locale" .=) <$> _spLocale,
                  ("iterativeCalculationSettings" .=) <$>
                    _spIterativeCalculationSettings,
                  ("autoRecalc" .=) <$> _spAutoRecalc,
                  ("title" .=) <$> _spTitle,
                  ("timeZone" .=) <$> _spTimeZone])

-- | The borders of the cell.
--
-- /See:/ 'bOrders' smart constructor.
data BOrders =
  BOrders'
    { _boBottom :: !(Maybe BOrder)
    , _boLeft   :: !(Maybe BOrder)
    , _boRight  :: !(Maybe BOrder)
    , _boTop    :: !(Maybe BOrder)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BOrders' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'boBottom'
--
-- * 'boLeft'
--
-- * 'boRight'
--
-- * 'boTop'
bOrders
    :: BOrders
bOrders =
  BOrders'
    { _boBottom = Nothing
    , _boLeft = Nothing
    , _boRight = Nothing
    , _boTop = Nothing
    }


-- | The bottom border of the cell.
boBottom :: Lens' BOrders (Maybe BOrder)
boBottom = lens _boBottom (\ s a -> s{_boBottom = a})

-- | The left border of the cell.
boLeft :: Lens' BOrders (Maybe BOrder)
boLeft = lens _boLeft (\ s a -> s{_boLeft = a})

-- | The right border of the cell.
boRight :: Lens' BOrders (Maybe BOrder)
boRight = lens _boRight (\ s a -> s{_boRight = a})

-- | The top border of the cell.
boTop :: Lens' BOrders (Maybe BOrder)
boTop = lens _boTop (\ s a -> s{_boTop = a})

instance FromJSON BOrders where
        parseJSON
          = withObject "BOrders"
              (\ o ->
                 BOrders' <$>
                   (o .:? "bottom") <*> (o .:? "left") <*>
                     (o .:? "right")
                     <*> (o .:? "top"))

instance ToJSON BOrders where
        toJSON BOrders'{..}
          = object
              (catMaybes
                 [("bottom" .=) <$> _boBottom,
                  ("left" .=) <$> _boLeft, ("right" .=) <$> _boRight,
                  ("top" .=) <$> _boTop])

-- | The request for clearing more than one range selected by a DataFilter in
-- a spreadsheet.
--
-- /See:/ 'batchClearValuesByDataFilterRequest' smart constructor.
newtype BatchClearValuesByDataFilterRequest =
  BatchClearValuesByDataFilterRequest'
    { _bcvbdfrDataFilters :: Maybe [DataFilter]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BatchClearValuesByDataFilterRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bcvbdfrDataFilters'
batchClearValuesByDataFilterRequest
    :: BatchClearValuesByDataFilterRequest
batchClearValuesByDataFilterRequest =
  BatchClearValuesByDataFilterRequest' {_bcvbdfrDataFilters = Nothing}


-- | The DataFilters used to determine which ranges to clear.
bcvbdfrDataFilters :: Lens' BatchClearValuesByDataFilterRequest [DataFilter]
bcvbdfrDataFilters
  = lens _bcvbdfrDataFilters
      (\ s a -> s{_bcvbdfrDataFilters = a})
      . _Default
      . _Coerce

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

instance ToJSON BatchClearValuesByDataFilterRequest
         where
        toJSON BatchClearValuesByDataFilterRequest'{..}
          = object
              (catMaybes
                 [("dataFilters" .=) <$> _bcvbdfrDataFilters])

-- | A run of a text format. The format of this run continues until the start
-- index of the next run. When updating, all fields must be set.
--
-- /See:/ 'textFormatRun' smart constructor.
data TextFormatRun =
  TextFormatRun'
    { _tfrFormat     :: !(Maybe TextFormat)
    , _tfrStartIndex :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'TextFormatRun' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tfrFormat'
--
-- * 'tfrStartIndex'
textFormatRun
    :: TextFormatRun
textFormatRun = TextFormatRun' {_tfrFormat = Nothing, _tfrStartIndex = Nothing}


-- | The format of this run. Absent values inherit the cell\'s format.
tfrFormat :: Lens' TextFormatRun (Maybe TextFormat)
tfrFormat
  = lens _tfrFormat (\ s a -> s{_tfrFormat = a})

-- | The character index where this run starts.
tfrStartIndex :: Lens' TextFormatRun (Maybe Int32)
tfrStartIndex
  = lens _tfrStartIndex
      (\ s a -> s{_tfrStartIndex = a})
      . mapping _Coerce

instance FromJSON TextFormatRun where
        parseJSON
          = withObject "TextFormatRun"
              (\ o ->
                 TextFormatRun' <$>
                   (o .:? "format") <*> (o .:? "startIndex"))

instance ToJSON TextFormatRun where
        toJSON TextFormatRun'{..}
          = object
              (catMaybes
                 [("format" .=) <$> _tfrFormat,
                  ("startIndex" .=) <$> _tfrStartIndex])

-- | Deletes a group over the specified range by decrementing the depth of
-- the dimensions in the range. For example, assume the sheet has a depth-1
-- group over B:E and a depth-2 group over C:D. Deleting a group over D:E
-- leaves the sheet with a depth-1 group over B:D and a depth-2 group over
-- C:C.
--
-- /See:/ 'deleteDimensionGroupRequest' smart constructor.
newtype DeleteDimensionGroupRequest =
  DeleteDimensionGroupRequest'
    { _ddgrRange :: Maybe DimensionRange
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DeleteDimensionGroupRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ddgrRange'
deleteDimensionGroupRequest
    :: DeleteDimensionGroupRequest
deleteDimensionGroupRequest =
  DeleteDimensionGroupRequest' {_ddgrRange = Nothing}


-- | The range of the group to be deleted.
ddgrRange :: Lens' DeleteDimensionGroupRequest (Maybe DimensionRange)
ddgrRange
  = lens _ddgrRange (\ s a -> s{_ddgrRange = a})

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

instance ToJSON DeleteDimensionGroupRequest where
        toJSON DeleteDimensionGroupRequest'{..}
          = object (catMaybes [("range" .=) <$> _ddgrRange])

-- | Updates the state of the specified group.
--
-- /See:/ 'updateDimensionGroupRequest' smart constructor.
data UpdateDimensionGroupRequest =
  UpdateDimensionGroupRequest'
    { _udgrDimensionGroup :: !(Maybe DimensionGroup)
    , _udgrFields         :: !(Maybe GFieldMask)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'UpdateDimensionGroupRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'udgrDimensionGroup'
--
-- * 'udgrFields'
updateDimensionGroupRequest
    :: UpdateDimensionGroupRequest
updateDimensionGroupRequest =
  UpdateDimensionGroupRequest'
    {_udgrDimensionGroup = Nothing, _udgrFields = Nothing}


-- | The group whose state should be updated. The range and depth of the
-- group should specify a valid group on the sheet, and all other fields
-- updated.
udgrDimensionGroup :: Lens' UpdateDimensionGroupRequest (Maybe DimensionGroup)
udgrDimensionGroup
  = lens _udgrDimensionGroup
      (\ s a -> s{_udgrDimensionGroup = a})

-- | The fields that should be updated. At least one field must be specified.
-- The root \`dimensionGroup\` is implied and should not be specified. A
-- single \`\"*\"\` can be used as short-hand for listing every field.
udgrFields :: Lens' UpdateDimensionGroupRequest (Maybe GFieldMask)
udgrFields
  = lens _udgrFields (\ s a -> s{_udgrFields = a})

instance FromJSON UpdateDimensionGroupRequest where
        parseJSON
          = withObject "UpdateDimensionGroupRequest"
              (\ o ->
                 UpdateDimensionGroupRequest' <$>
                   (o .:? "dimensionGroup") <*> (o .:? "fields"))

instance ToJSON UpdateDimensionGroupRequest where
        toJSON UpdateDimensionGroupRequest'{..}
          = object
              (catMaybes
                 [("dimensionGroup" .=) <$> _udgrDimensionGroup,
                  ("fields" .=) <$> _udgrFields])

-- | Adds a new sheet. When a sheet is added at a given index, all subsequent
-- sheets\' indexes are incremented. To add an object sheet, use
-- AddChartRequest instead and specify EmbeddedObjectPosition.sheetId or
-- EmbeddedObjectPosition.newSheet.
--
-- /See:/ 'addSheetRequest' smart constructor.
newtype AddSheetRequest =
  AddSheetRequest'
    { _asrProperties :: Maybe SheetProperties
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AddSheetRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'asrProperties'
addSheetRequest
    :: AddSheetRequest
addSheetRequest = AddSheetRequest' {_asrProperties = Nothing}


-- | The properties the new sheet should have. All properties are optional.
-- The sheetId field is optional; if one is not set, an id will be randomly
-- generated. (It is an error to specify the ID of a sheet that already
-- exists.)
asrProperties :: Lens' AddSheetRequest (Maybe SheetProperties)
asrProperties
  = lens _asrProperties
      (\ s a -> s{_asrProperties = a})

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

instance ToJSON AddSheetRequest where
        toJSON AddSheetRequest'{..}
          = object
              (catMaybes [("properties" .=) <$> _asrProperties])

-- | A sort order associated with a specific column or row.
--
-- /See:/ 'sortSpec' smart constructor.
data SortSpec =
  SortSpec'
    { _ssSortOrder      :: !(Maybe SortSpecSortOrder)
    , _ssDimensionIndex :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SortSpec' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ssSortOrder'
--
-- * 'ssDimensionIndex'
sortSpec
    :: SortSpec
sortSpec = SortSpec' {_ssSortOrder = Nothing, _ssDimensionIndex = Nothing}


-- | The order data should be sorted.
ssSortOrder :: Lens' SortSpec (Maybe SortSpecSortOrder)
ssSortOrder
  = lens _ssSortOrder (\ s a -> s{_ssSortOrder = a})

-- | The dimension the sort should be applied to.
ssDimensionIndex :: Lens' SortSpec (Maybe Int32)
ssDimensionIndex
  = lens _ssDimensionIndex
      (\ s a -> s{_ssDimensionIndex = a})
      . mapping _Coerce

instance FromJSON SortSpec where
        parseJSON
          = withObject "SortSpec"
              (\ o ->
                 SortSpec' <$>
                   (o .:? "sortOrder") <*> (o .:? "dimensionIndex"))

instance ToJSON SortSpec where
        toJSON SortSpec'{..}
          = object
              (catMaybes
                 [("sortOrder" .=) <$> _ssSortOrder,
                  ("dimensionIndex" .=) <$> _ssDimensionIndex])

-- | A group over an interval of rows or columns on a sheet, which can
-- contain or be contained within other groups. A group can be collapsed or
-- expanded as a unit on the sheet.
--
-- /See:/ 'dimensionGroup' smart constructor.
data DimensionGroup =
  DimensionGroup'
    { _dgCollapsed :: !(Maybe Bool)
    , _dgRange     :: !(Maybe DimensionRange)
    , _dgDepth     :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DimensionGroup' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dgCollapsed'
--
-- * 'dgRange'
--
-- * 'dgDepth'
dimensionGroup
    :: DimensionGroup
dimensionGroup =
  DimensionGroup'
    {_dgCollapsed = Nothing, _dgRange = Nothing, _dgDepth = Nothing}


-- | This field is true if this group is collapsed. A collapsed group remains
-- collapsed if an overlapping group at a shallower depth is expanded. A
-- true value does not imply that all dimensions within the group are
-- hidden, since a dimension\'s visibility can change independently from
-- this group property. However, when this property is updated, all
-- dimensions within it are set to hidden if this field is true, or set to
-- visible if this field is false.
dgCollapsed :: Lens' DimensionGroup (Maybe Bool)
dgCollapsed
  = lens _dgCollapsed (\ s a -> s{_dgCollapsed = a})

-- | The range over which this group exists.
dgRange :: Lens' DimensionGroup (Maybe DimensionRange)
dgRange = lens _dgRange (\ s a -> s{_dgRange = a})

-- | The depth of the group, representing how many groups have a range that
-- wholly contains the range of this group.
dgDepth :: Lens' DimensionGroup (Maybe Int32)
dgDepth
  = lens _dgDepth (\ s a -> s{_dgDepth = a}) .
      mapping _Coerce

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

instance ToJSON DimensionGroup where
        toJSON DimensionGroup'{..}
          = object
              (catMaybes
                 [("collapsed" .=) <$> _dgCollapsed,
                  ("range" .=) <$> _dgRange,
                  ("depth" .=) <$> _dgDepth])

-- | Copies data from the source to the destination.
--
-- /See:/ 'copyPasteRequest' smart constructor.
data CopyPasteRequest =
  CopyPasteRequest'
    { _cprDestination      :: !(Maybe GridRange)
    , _cprSource           :: !(Maybe GridRange)
    , _cprPasteOrientation :: !(Maybe CopyPasteRequestPasteOrientation)
    , _cprPasteType        :: !(Maybe CopyPasteRequestPasteType)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'CopyPasteRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cprDestination'
--
-- * 'cprSource'
--
-- * 'cprPasteOrientation'
--
-- * 'cprPasteType'
copyPasteRequest
    :: CopyPasteRequest
copyPasteRequest =
  CopyPasteRequest'
    { _cprDestination = Nothing
    , _cprSource = Nothing
    , _cprPasteOrientation = Nothing
    , _cprPasteType = Nothing
    }


-- | The location to paste to. If the range covers a span that\'s a multiple
-- of the source\'s height or width, then the data will be repeated to fill
-- in the destination range. If the range is smaller than the source range,
-- the entire source data will still be copied (beyond the end of the
-- destination range).
cprDestination :: Lens' CopyPasteRequest (Maybe GridRange)
cprDestination
  = lens _cprDestination
      (\ s a -> s{_cprDestination = a})

-- | The source range to copy.
cprSource :: Lens' CopyPasteRequest (Maybe GridRange)
cprSource
  = lens _cprSource (\ s a -> s{_cprSource = a})

-- | How that data should be oriented when pasting.
cprPasteOrientation :: Lens' CopyPasteRequest (Maybe CopyPasteRequestPasteOrientation)
cprPasteOrientation
  = lens _cprPasteOrientation
      (\ s a -> s{_cprPasteOrientation = a})

-- | What kind of data to paste.
cprPasteType :: Lens' CopyPasteRequest (Maybe CopyPasteRequestPasteType)
cprPasteType
  = lens _cprPasteType (\ s a -> s{_cprPasteType = a})

instance FromJSON CopyPasteRequest where
        parseJSON
          = withObject "CopyPasteRequest"
              (\ o ->
                 CopyPasteRequest' <$>
                   (o .:? "destination") <*> (o .:? "source") <*>
                     (o .:? "pasteOrientation")
                     <*> (o .:? "pasteType"))

instance ToJSON CopyPasteRequest where
        toJSON CopyPasteRequest'{..}
          = object
              (catMaybes
                 [("destination" .=) <$> _cprDestination,
                  ("source" .=) <$> _cprSource,
                  ("pasteOrientation" .=) <$> _cprPasteOrientation,
                  ("pasteType" .=) <$> _cprPasteType])

-- | A range on a sheet. All indexes are zero-based. Indexes are half open,
-- e.g the start index is inclusive and the end index is exclusive --
-- [start_index, end_index). Missing indexes indicate the range is
-- unbounded on that side. For example, if \`\"Sheet1\"\` is sheet ID 0,
-- then: \`Sheet1!A1:A1 == sheet_id: 0, start_row_index: 0, end_row_index:
-- 1, start_column_index: 0, end_column_index: 1\` \`Sheet1!A3:B4 ==
-- sheet_id: 0, start_row_index: 2, end_row_index: 4, start_column_index:
-- 0, end_column_index: 2\` \`Sheet1!A:B == sheet_id: 0,
-- start_column_index: 0, end_column_index: 2\` \`Sheet1!A5:B == sheet_id:
-- 0, start_row_index: 4, start_column_index: 0, end_column_index: 2\`
-- \`Sheet1 == sheet_id:0\` The start index must always be less than or
-- equal to the end index. If the start index equals the end index, then
-- the range is empty. Empty ranges are typically not meaningful and are
-- usually rendered in the UI as \`#REF!\`.
--
-- /See:/ 'gridRange' smart constructor.
data GridRange =
  GridRange'
    { _grEndColumnIndex   :: !(Maybe (Textual Int32))
    , _grStartColumnIndex :: !(Maybe (Textual Int32))
    , _grEndRowIndex      :: !(Maybe (Textual Int32))
    , _grStartRowIndex    :: !(Maybe (Textual Int32))
    , _grSheetId          :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GridRange' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grEndColumnIndex'
--
-- * 'grStartColumnIndex'
--
-- * 'grEndRowIndex'
--
-- * 'grStartRowIndex'
--
-- * 'grSheetId'
gridRange
    :: GridRange
gridRange =
  GridRange'
    { _grEndColumnIndex = Nothing
    , _grStartColumnIndex = Nothing
    , _grEndRowIndex = Nothing
    , _grStartRowIndex = Nothing
    , _grSheetId = Nothing
    }


-- | The end column (exclusive) of the range, or not set if unbounded.
grEndColumnIndex :: Lens' GridRange (Maybe Int32)
grEndColumnIndex
  = lens _grEndColumnIndex
      (\ s a -> s{_grEndColumnIndex = a})
      . mapping _Coerce

-- | The start column (inclusive) of the range, or not set if unbounded.
grStartColumnIndex :: Lens' GridRange (Maybe Int32)
grStartColumnIndex
  = lens _grStartColumnIndex
      (\ s a -> s{_grStartColumnIndex = a})
      . mapping _Coerce

-- | The end row (exclusive) of the range, or not set if unbounded.
grEndRowIndex :: Lens' GridRange (Maybe Int32)
grEndRowIndex
  = lens _grEndRowIndex
      (\ s a -> s{_grEndRowIndex = a})
      . mapping _Coerce

-- | The start row (inclusive) of the range, or not set if unbounded.
grStartRowIndex :: Lens' GridRange (Maybe Int32)
grStartRowIndex
  = lens _grStartRowIndex
      (\ s a -> s{_grStartRowIndex = a})
      . mapping _Coerce

-- | The sheet this range is on.
grSheetId :: Lens' GridRange (Maybe Int32)
grSheetId
  = lens _grSheetId (\ s a -> s{_grSheetId = a}) .
      mapping _Coerce

instance FromJSON GridRange where
        parseJSON
          = withObject "GridRange"
              (\ o ->
                 GridRange' <$>
                   (o .:? "endColumnIndex") <*>
                     (o .:? "startColumnIndex")
                     <*> (o .:? "endRowIndex")
                     <*> (o .:? "startRowIndex")
                     <*> (o .:? "sheetId"))

instance ToJSON GridRange where
        toJSON GridRange'{..}
          = object
              (catMaybes
                 [("endColumnIndex" .=) <$> _grEndColumnIndex,
                  ("startColumnIndex" .=) <$> _grStartColumnIndex,
                  ("endRowIndex" .=) <$> _grEndRowIndex,
                  ("startRowIndex" .=) <$> _grStartRowIndex,
                  ("sheetId" .=) <$> _grSheetId])

-- | The result of adding a filter view.
--
-- /See:/ 'addFilterViewResponse' smart constructor.
newtype AddFilterViewResponse =
  AddFilterViewResponse'
    { _afvrFilter :: Maybe FilterView
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AddFilterViewResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'afvrFilter'
addFilterViewResponse
    :: AddFilterViewResponse
addFilterViewResponse = AddFilterViewResponse' {_afvrFilter = Nothing}


-- | The newly added filter view.
afvrFilter :: Lens' AddFilterViewResponse (Maybe FilterView)
afvrFilter
  = lens _afvrFilter (\ s a -> s{_afvrFilter = a})

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

instance ToJSON AddFilterViewResponse where
        toJSON AddFilterViewResponse'{..}
          = object (catMaybes [("filter" .=) <$> _afvrFilter])

-- | A condition that can evaluate to true or false. BooleanConditions are
-- used by conditional formatting, data validation, and the criteria in
-- filters.
--
-- /See:/ 'booleanCondition' smart constructor.
data BooleanCondition =
  BooleanCondition'
    { _bcValues :: !(Maybe [ConditionValue])
    , _bcType   :: !(Maybe BooleanConditionType)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BooleanCondition' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bcValues'
--
-- * 'bcType'
booleanCondition
    :: BooleanCondition
booleanCondition = BooleanCondition' {_bcValues = Nothing, _bcType = Nothing}


-- | The values of the condition. The number of supported values depends on
-- the condition type. Some support zero values, others one or two values,
-- and ConditionType.ONE_OF_LIST supports an arbitrary number of values.
bcValues :: Lens' BooleanCondition [ConditionValue]
bcValues
  = lens _bcValues (\ s a -> s{_bcValues = a}) .
      _Default
      . _Coerce

-- | The type of condition.
bcType :: Lens' BooleanCondition (Maybe BooleanConditionType)
bcType = lens _bcType (\ s a -> s{_bcType = a})

instance FromJSON BooleanCondition where
        parseJSON
          = withObject "BooleanCondition"
              (\ o ->
                 BooleanCondition' <$>
                   (o .:? "values" .!= mempty) <*> (o .:? "type"))

instance ToJSON BooleanCondition where
        toJSON BooleanCondition'{..}
          = object
              (catMaybes
                 [("values" .=) <$> _bcValues,
                  ("type" .=) <$> _bcType])

-- | Automatically resizes one or more dimensions based on the contents of
-- the cells in that dimension.
--
-- /See:/ 'autoResizeDimensionsRequest' smart constructor.
newtype AutoResizeDimensionsRequest =
  AutoResizeDimensionsRequest'
    { _ardrDimensions :: Maybe DimensionRange
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AutoResizeDimensionsRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ardrDimensions'
autoResizeDimensionsRequest
    :: AutoResizeDimensionsRequest
autoResizeDimensionsRequest =
  AutoResizeDimensionsRequest' {_ardrDimensions = Nothing}


-- | The dimensions to automatically resize.
ardrDimensions :: Lens' AutoResizeDimensionsRequest (Maybe DimensionRange)
ardrDimensions
  = lens _ardrDimensions
      (\ s a -> s{_ardrDimensions = a})

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

instance ToJSON AutoResizeDimensionsRequest where
        toJSON AutoResizeDimensionsRequest'{..}
          = object
              (catMaybes [("dimensions" .=) <$> _ardrDimensions])

-- | A </chart/interactive/docs/gallery/bubblechart bubble chart>.
--
-- /See:/ 'bubbleChartSpec' smart constructor.
data BubbleChartSpec =
  BubbleChartSpec'
    { _bcsBubbleTextStyle     :: !(Maybe TextFormat)
    , _bcsBubbleBOrderColor   :: !(Maybe Color)
    , _bcsLegendPosition      :: !(Maybe BubbleChartSpecLegendPosition)
    , _bcsDomain              :: !(Maybe ChartData)
    , _bcsSeries              :: !(Maybe ChartData)
    , _bcsBubbleLabels        :: !(Maybe ChartData)
    , _bcsGroupIds            :: !(Maybe ChartData)
    , _bcsBubbleMinRadiusSize :: !(Maybe (Textual Int32))
    , _bcsBubbleMaxRadiusSize :: !(Maybe (Textual Int32))
    , _bcsBubbleOpacity       :: !(Maybe (Textual Double))
    , _bcsBubbleSizes         :: !(Maybe ChartData)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BubbleChartSpec' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bcsBubbleTextStyle'
--
-- * 'bcsBubbleBOrderColor'
--
-- * 'bcsLegendPosition'
--
-- * 'bcsDomain'
--
-- * 'bcsSeries'
--
-- * 'bcsBubbleLabels'
--
-- * 'bcsGroupIds'
--
-- * 'bcsBubbleMinRadiusSize'
--
-- * 'bcsBubbleMaxRadiusSize'
--
-- * 'bcsBubbleOpacity'
--
-- * 'bcsBubbleSizes'
bubbleChartSpec
    :: BubbleChartSpec
bubbleChartSpec =
  BubbleChartSpec'
    { _bcsBubbleTextStyle = Nothing
    , _bcsBubbleBOrderColor = Nothing
    , _bcsLegendPosition = Nothing
    , _bcsDomain = Nothing
    , _bcsSeries = Nothing
    , _bcsBubbleLabels = Nothing
    , _bcsGroupIds = Nothing
    , _bcsBubbleMinRadiusSize = Nothing
    , _bcsBubbleMaxRadiusSize = Nothing
    , _bcsBubbleOpacity = Nothing
    , _bcsBubbleSizes = Nothing
    }


-- | The format of the text inside the bubbles. Underline and Strikethrough
-- are not supported.
bcsBubbleTextStyle :: Lens' BubbleChartSpec (Maybe TextFormat)
bcsBubbleTextStyle
  = lens _bcsBubbleTextStyle
      (\ s a -> s{_bcsBubbleTextStyle = a})

-- | The bubble border color.
bcsBubbleBOrderColor :: Lens' BubbleChartSpec (Maybe Color)
bcsBubbleBOrderColor
  = lens _bcsBubbleBOrderColor
      (\ s a -> s{_bcsBubbleBOrderColor = a})

-- | Where the legend of the chart should be drawn.
bcsLegendPosition :: Lens' BubbleChartSpec (Maybe BubbleChartSpecLegendPosition)
bcsLegendPosition
  = lens _bcsLegendPosition
      (\ s a -> s{_bcsLegendPosition = a})

-- | The data containing the bubble x-values. These values locate the bubbles
-- in the chart horizontally.
bcsDomain :: Lens' BubbleChartSpec (Maybe ChartData)
bcsDomain
  = lens _bcsDomain (\ s a -> s{_bcsDomain = a})

-- | The data contianing the bubble y-values. These values locate the bubbles
-- in the chart vertically.
bcsSeries :: Lens' BubbleChartSpec (Maybe ChartData)
bcsSeries
  = lens _bcsSeries (\ s a -> s{_bcsSeries = a})

-- | The data containing the bubble labels. These do not need to be unique.
bcsBubbleLabels :: Lens' BubbleChartSpec (Maybe ChartData)
bcsBubbleLabels
  = lens _bcsBubbleLabels
      (\ s a -> s{_bcsBubbleLabels = a})

-- | The data containing the bubble group IDs. All bubbles with the same
-- group ID are drawn in the same color. If bubble_sizes is specified then
-- this field must also be specified but may contain blank values. This
-- field is optional.
bcsGroupIds :: Lens' BubbleChartSpec (Maybe ChartData)
bcsGroupIds
  = lens _bcsGroupIds (\ s a -> s{_bcsGroupIds = a})

-- | The minimum radius size of the bubbles, in pixels. If specific, the
-- field must be a positive value.
bcsBubbleMinRadiusSize :: Lens' BubbleChartSpec (Maybe Int32)
bcsBubbleMinRadiusSize
  = lens _bcsBubbleMinRadiusSize
      (\ s a -> s{_bcsBubbleMinRadiusSize = a})
      . mapping _Coerce

-- | The max radius size of the bubbles, in pixels. If specified, the field
-- must be a positive value.
bcsBubbleMaxRadiusSize :: Lens' BubbleChartSpec (Maybe Int32)
bcsBubbleMaxRadiusSize
  = lens _bcsBubbleMaxRadiusSize
      (\ s a -> s{_bcsBubbleMaxRadiusSize = a})
      . mapping _Coerce

-- | The opacity of the bubbles between 0 and 1.0. 0 is fully transparent and
-- 1 is fully opaque.
bcsBubbleOpacity :: Lens' BubbleChartSpec (Maybe Double)
bcsBubbleOpacity
  = lens _bcsBubbleOpacity
      (\ s a -> s{_bcsBubbleOpacity = a})
      . mapping _Coerce

-- | The data contianing the bubble sizes. Bubble sizes are used to draw the
-- bubbles at different sizes relative to each other. If specified,
-- group_ids must also be specified. This field is optional.
bcsBubbleSizes :: Lens' BubbleChartSpec (Maybe ChartData)
bcsBubbleSizes
  = lens _bcsBubbleSizes
      (\ s a -> s{_bcsBubbleSizes = a})

instance FromJSON BubbleChartSpec where
        parseJSON
          = withObject "BubbleChartSpec"
              (\ o ->
                 BubbleChartSpec' <$>
                   (o .:? "bubbleTextStyle") <*>
                     (o .:? "bubbleBorderColor")
                     <*> (o .:? "legendPosition")
                     <*> (o .:? "domain")
                     <*> (o .:? "series")
                     <*> (o .:? "bubbleLabels")
                     <*> (o .:? "groupIds")
                     <*> (o .:? "bubbleMinRadiusSize")
                     <*> (o .:? "bubbleMaxRadiusSize")
                     <*> (o .:? "bubbleOpacity")
                     <*> (o .:? "bubbleSizes"))

instance ToJSON BubbleChartSpec where
        toJSON BubbleChartSpec'{..}
          = object
              (catMaybes
                 [("bubbleTextStyle" .=) <$> _bcsBubbleTextStyle,
                  ("bubbleBorderColor" .=) <$> _bcsBubbleBOrderColor,
                  ("legendPosition" .=) <$> _bcsLegendPosition,
                  ("domain" .=) <$> _bcsDomain,
                  ("series" .=) <$> _bcsSeries,
                  ("bubbleLabels" .=) <$> _bcsBubbleLabels,
                  ("groupIds" .=) <$> _bcsGroupIds,
                  ("bubbleMinRadiusSize" .=) <$>
                    _bcsBubbleMinRadiusSize,
                  ("bubbleMaxRadiusSize" .=) <$>
                    _bcsBubbleMaxRadiusSize,
                  ("bubbleOpacity" .=) <$> _bcsBubbleOpacity,
                  ("bubbleSizes" .=) <$> _bcsBubbleSizes])

-- | Deletes a range of cells, shifting other cells into the deleted area.
--
-- /See:/ 'deleteRangeRequest' smart constructor.
data DeleteRangeRequest =
  DeleteRangeRequest'
    { _drrShiftDimension :: !(Maybe DeleteRangeRequestShiftDimension)
    , _drrRange          :: !(Maybe GridRange)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DeleteRangeRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'drrShiftDimension'
--
-- * 'drrRange'
deleteRangeRequest
    :: DeleteRangeRequest
deleteRangeRequest =
  DeleteRangeRequest' {_drrShiftDimension = Nothing, _drrRange = Nothing}


-- | The dimension from which deleted cells will be replaced with. If ROWS,
-- existing cells will be shifted upward to replace the deleted cells. If
-- COLUMNS, existing cells will be shifted left to replace the deleted
-- cells.
drrShiftDimension :: Lens' DeleteRangeRequest (Maybe DeleteRangeRequestShiftDimension)
drrShiftDimension
  = lens _drrShiftDimension
      (\ s a -> s{_drrShiftDimension = a})

-- | The range of cells to delete.
drrRange :: Lens' DeleteRangeRequest (Maybe GridRange)
drrRange = lens _drrRange (\ s a -> s{_drrRange = a})

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

instance ToJSON DeleteRangeRequest where
        toJSON DeleteRangeRequest'{..}
          = object
              (catMaybes
                 [("shiftDimension" .=) <$> _drrShiftDimension,
                  ("range" .=) <$> _drrRange])

-- | A sheet in a spreadsheet.
--
-- /See:/ 'sheet' smart constructor.
data Sheet =
  Sheet'
    { _sColumnGroups       :: !(Maybe [DimensionGroup])
    , _sData               :: !(Maybe [GridData])
    , _sMerges             :: !(Maybe [GridRange])
    , _sRowGroups          :: !(Maybe [DimensionGroup])
    , _sProtectedRanges    :: !(Maybe [ProtectedRange])
    , _sBandedRanges       :: !(Maybe [BandedRange])
    , _sCharts             :: !(Maybe [EmbeddedChart])
    , _sBasicFilter        :: !(Maybe BasicFilter)
    , _sDeveloperMetadata  :: !(Maybe [DeveloperMetadata])
    , _sConditionalFormats :: !(Maybe [ConditionalFormatRule])
    , _sFilterViews        :: !(Maybe [FilterView])
    , _sProperties         :: !(Maybe SheetProperties)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Sheet' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sColumnGroups'
--
-- * 'sData'
--
-- * 'sMerges'
--
-- * 'sRowGroups'
--
-- * 'sProtectedRanges'
--
-- * 'sBandedRanges'
--
-- * 'sCharts'
--
-- * 'sBasicFilter'
--
-- * 'sDeveloperMetadata'
--
-- * 'sConditionalFormats'
--
-- * 'sFilterViews'
--
-- * 'sProperties'
sheet
    :: Sheet
sheet =
  Sheet'
    { _sColumnGroups = Nothing
    , _sData = Nothing
    , _sMerges = Nothing
    , _sRowGroups = Nothing
    , _sProtectedRanges = Nothing
    , _sBandedRanges = Nothing
    , _sCharts = Nothing
    , _sBasicFilter = Nothing
    , _sDeveloperMetadata = Nothing
    , _sConditionalFormats = Nothing
    , _sFilterViews = Nothing
    , _sProperties = Nothing
    }


-- | All column groups on this sheet, ordered by increasing range start
-- index, then by group depth.
sColumnGroups :: Lens' Sheet [DimensionGroup]
sColumnGroups
  = lens _sColumnGroups
      (\ s a -> s{_sColumnGroups = a})
      . _Default
      . _Coerce

-- | Data in the grid, if this is a grid sheet. The number of GridData
-- objects returned is dependent on the number of ranges requested on this
-- sheet. For example, if this is representing \`Sheet1\`, and the
-- spreadsheet was requested with ranges \`Sheet1!A1:C10\` and
-- \`Sheet1!D15:E20\`, then the first GridData will have a
-- startRow\/startColumn of \`0\`, while the second one will have
-- \`startRow 14\` (zero-based row 15), and \`startColumn 3\` (zero-based
-- column D).
sData :: Lens' Sheet [GridData]
sData
  = lens _sData (\ s a -> s{_sData = a}) . _Default .
      _Coerce

-- | The ranges that are merged together.
sMerges :: Lens' Sheet [GridRange]
sMerges
  = lens _sMerges (\ s a -> s{_sMerges = a}) . _Default
      . _Coerce

-- | All row groups on this sheet, ordered by increasing range start index,
-- then by group depth.
sRowGroups :: Lens' Sheet [DimensionGroup]
sRowGroups
  = lens _sRowGroups (\ s a -> s{_sRowGroups = a}) .
      _Default
      . _Coerce

-- | The protected ranges in this sheet.
sProtectedRanges :: Lens' Sheet [ProtectedRange]
sProtectedRanges
  = lens _sProtectedRanges
      (\ s a -> s{_sProtectedRanges = a})
      . _Default
      . _Coerce

-- | The banded (alternating colors) ranges on this sheet.
sBandedRanges :: Lens' Sheet [BandedRange]
sBandedRanges
  = lens _sBandedRanges
      (\ s a -> s{_sBandedRanges = a})
      . _Default
      . _Coerce

-- | The specifications of every chart on this sheet.
sCharts :: Lens' Sheet [EmbeddedChart]
sCharts
  = lens _sCharts (\ s a -> s{_sCharts = a}) . _Default
      . _Coerce

-- | The filter on this sheet, if any.
sBasicFilter :: Lens' Sheet (Maybe BasicFilter)
sBasicFilter
  = lens _sBasicFilter (\ s a -> s{_sBasicFilter = a})

-- | The developer metadata associated with a sheet.
sDeveloperMetadata :: Lens' Sheet [DeveloperMetadata]
sDeveloperMetadata
  = lens _sDeveloperMetadata
      (\ s a -> s{_sDeveloperMetadata = a})
      . _Default
      . _Coerce

-- | The conditional format rules in this sheet.
sConditionalFormats :: Lens' Sheet [ConditionalFormatRule]
sConditionalFormats
  = lens _sConditionalFormats
      (\ s a -> s{_sConditionalFormats = a})
      . _Default
      . _Coerce

-- | The filter views in this sheet.
sFilterViews :: Lens' Sheet [FilterView]
sFilterViews
  = lens _sFilterViews (\ s a -> s{_sFilterViews = a})
      . _Default
      . _Coerce

-- | The properties of the sheet.
sProperties :: Lens' Sheet (Maybe SheetProperties)
sProperties
  = lens _sProperties (\ s a -> s{_sProperties = a})

instance FromJSON Sheet where
        parseJSON
          = withObject "Sheet"
              (\ o ->
                 Sheet' <$>
                   (o .:? "columnGroups" .!= mempty) <*>
                     (o .:? "data" .!= mempty)
                     <*> (o .:? "merges" .!= mempty)
                     <*> (o .:? "rowGroups" .!= mempty)
                     <*> (o .:? "protectedRanges" .!= mempty)
                     <*> (o .:? "bandedRanges" .!= mempty)
                     <*> (o .:? "charts" .!= mempty)
                     <*> (o .:? "basicFilter")
                     <*> (o .:? "developerMetadata" .!= mempty)
                     <*> (o .:? "conditionalFormats" .!= mempty)
                     <*> (o .:? "filterViews" .!= mempty)
                     <*> (o .:? "properties"))

instance ToJSON Sheet where
        toJSON Sheet'{..}
          = object
              (catMaybes
                 [("columnGroups" .=) <$> _sColumnGroups,
                  ("data" .=) <$> _sData, ("merges" .=) <$> _sMerges,
                  ("rowGroups" .=) <$> _sRowGroups,
                  ("protectedRanges" .=) <$> _sProtectedRanges,
                  ("bandedRanges" .=) <$> _sBandedRanges,
                  ("charts" .=) <$> _sCharts,
                  ("basicFilter" .=) <$> _sBasicFilter,
                  ("developerMetadata" .=) <$> _sDeveloperMetadata,
                  ("conditionalFormats" .=) <$> _sConditionalFormats,
                  ("filterViews" .=) <$> _sFilterViews,
                  ("properties" .=) <$> _sProperties])

-- | A coordinate in a sheet. All indexes are zero-based.
--
-- /See:/ 'gridCoordinate' smart constructor.
data GridCoordinate =
  GridCoordinate'
    { _gcColumnIndex :: !(Maybe (Textual Int32))
    , _gcRowIndex    :: !(Maybe (Textual Int32))
    , _gcSheetId     :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GridCoordinate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'gcColumnIndex'
--
-- * 'gcRowIndex'
--
-- * 'gcSheetId'
gridCoordinate
    :: GridCoordinate
gridCoordinate =
  GridCoordinate'
    {_gcColumnIndex = Nothing, _gcRowIndex = Nothing, _gcSheetId = Nothing}


-- | The column index of the coordinate.
gcColumnIndex :: Lens' GridCoordinate (Maybe Int32)
gcColumnIndex
  = lens _gcColumnIndex
      (\ s a -> s{_gcColumnIndex = a})
      . mapping _Coerce

-- | The row index of the coordinate.
gcRowIndex :: Lens' GridCoordinate (Maybe Int32)
gcRowIndex
  = lens _gcRowIndex (\ s a -> s{_gcRowIndex = a}) .
      mapping _Coerce

-- | The sheet this coordinate is on.
gcSheetId :: Lens' GridCoordinate (Maybe Int32)
gcSheetId
  = lens _gcSheetId (\ s a -> s{_gcSheetId = a}) .
      mapping _Coerce

instance FromJSON GridCoordinate where
        parseJSON
          = withObject "GridCoordinate"
              (\ o ->
                 GridCoordinate' <$>
                   (o .:? "columnIndex") <*> (o .:? "rowIndex") <*>
                     (o .:? "sheetId"))

instance ToJSON GridCoordinate where
        toJSON GridCoordinate'{..}
          = object
              (catMaybes
                 [("columnIndex" .=) <$> _gcColumnIndex,
                  ("rowIndex" .=) <$> _gcRowIndex,
                  ("sheetId" .=) <$> _gcSheetId])

-- | The response when clearing a range of values in a spreadsheet.
--
-- /See:/ 'clearValuesResponse' smart constructor.
data ClearValuesResponse =
  ClearValuesResponse'
    { _cvrClearedRange  :: !(Maybe Text)
    , _cvrSpreadsheetId :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ClearValuesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cvrClearedRange'
--
-- * 'cvrSpreadsheetId'
clearValuesResponse
    :: ClearValuesResponse
clearValuesResponse =
  ClearValuesResponse' {_cvrClearedRange = Nothing, _cvrSpreadsheetId = Nothing}


-- | The range (in A1 notation) that was cleared. (If the request was for an
-- unbounded range or a ranger larger than the bounds of the sheet, this
-- will be the actual range that was cleared, bounded to the sheet\'s
-- limits.)
cvrClearedRange :: Lens' ClearValuesResponse (Maybe Text)
cvrClearedRange
  = lens _cvrClearedRange
      (\ s a -> s{_cvrClearedRange = a})

-- | The spreadsheet the updates were applied to.
cvrSpreadsheetId :: Lens' ClearValuesResponse (Maybe Text)
cvrSpreadsheetId
  = lens _cvrSpreadsheetId
      (\ s a -> s{_cvrSpreadsheetId = a})

instance FromJSON ClearValuesResponse where
        parseJSON
          = withObject "ClearValuesResponse"
              (\ o ->
                 ClearValuesResponse' <$>
                   (o .:? "clearedRange") <*> (o .:? "spreadsheetId"))

instance ToJSON ClearValuesResponse where
        toJSON ClearValuesResponse'{..}
          = object
              (catMaybes
                 [("clearedRange" .=) <$> _cvrClearedRange,
                  ("spreadsheetId" .=) <$> _cvrSpreadsheetId])

-- | Clears the basic filter, if any exists on the sheet.
--
-- /See:/ 'clearBasicFilterRequest' smart constructor.
newtype ClearBasicFilterRequest =
  ClearBasicFilterRequest'
    { _cbfrSheetId :: Maybe (Textual Int32)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ClearBasicFilterRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cbfrSheetId'
clearBasicFilterRequest
    :: ClearBasicFilterRequest
clearBasicFilterRequest = ClearBasicFilterRequest' {_cbfrSheetId = Nothing}


-- | The sheet ID on which the basic filter should be cleared.
cbfrSheetId :: Lens' ClearBasicFilterRequest (Maybe Int32)
cbfrSheetId
  = lens _cbfrSheetId (\ s a -> s{_cbfrSheetId = a}) .
      mapping _Coerce

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

instance ToJSON ClearBasicFilterRequest where
        toJSON ClearBasicFilterRequest'{..}
          = object
              (catMaybes [("sheetId" .=) <$> _cbfrSheetId])

-- | Update an embedded object\'s position (such as a moving or resizing a
-- chart or image).
--
-- /See:/ 'updateEmbeddedObjectPositionRequest' smart constructor.
data UpdateEmbeddedObjectPositionRequest =
  UpdateEmbeddedObjectPositionRequest'
    { _ueoprNewPosition :: !(Maybe EmbeddedObjectPosition)
    , _ueoprObjectId    :: !(Maybe (Textual Int32))
    , _ueoprFields      :: !(Maybe GFieldMask)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'UpdateEmbeddedObjectPositionRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ueoprNewPosition'
--
-- * 'ueoprObjectId'
--
-- * 'ueoprFields'
updateEmbeddedObjectPositionRequest
    :: UpdateEmbeddedObjectPositionRequest
updateEmbeddedObjectPositionRequest =
  UpdateEmbeddedObjectPositionRequest'
    { _ueoprNewPosition = Nothing
    , _ueoprObjectId = Nothing
    , _ueoprFields = Nothing
    }


-- | An explicit position to move the embedded object to. If
-- newPosition.sheetId is set, a new sheet with that ID will be created. If
-- newPosition.newSheet is set to true, a new sheet will be created with an
-- ID that will be chosen for you.
ueoprNewPosition :: Lens' UpdateEmbeddedObjectPositionRequest (Maybe EmbeddedObjectPosition)
ueoprNewPosition
  = lens _ueoprNewPosition
      (\ s a -> s{_ueoprNewPosition = a})

-- | The ID of the object to moved.
ueoprObjectId :: Lens' UpdateEmbeddedObjectPositionRequest (Maybe Int32)
ueoprObjectId
  = lens _ueoprObjectId
      (\ s a -> s{_ueoprObjectId = a})
      . mapping _Coerce

-- | The fields of OverlayPosition that should be updated when setting a new
-- position. Used only if newPosition.overlayPosition is set, in which case
-- at least one field must be specified. The root
-- \`newPosition.overlayPosition\` is implied and should not be specified.
-- A single \`\"*\"\` can be used as short-hand for listing every field.
ueoprFields :: Lens' UpdateEmbeddedObjectPositionRequest (Maybe GFieldMask)
ueoprFields
  = lens _ueoprFields (\ s a -> s{_ueoprFields = a})

instance FromJSON UpdateEmbeddedObjectPositionRequest
         where
        parseJSON
          = withObject "UpdateEmbeddedObjectPositionRequest"
              (\ o ->
                 UpdateEmbeddedObjectPositionRequest' <$>
                   (o .:? "newPosition") <*> (o .:? "objectId") <*>
                     (o .:? "fields"))

instance ToJSON UpdateEmbeddedObjectPositionRequest
         where
        toJSON UpdateEmbeddedObjectPositionRequest'{..}
          = object
              (catMaybes
                 [("newPosition" .=) <$> _ueoprNewPosition,
                  ("objectId" .=) <$> _ueoprObjectId,
                  ("fields" .=) <$> _ueoprFields])

-- | A rule that may or may not match, depending on the condition.
--
-- /See:/ 'booleanRule' smart constructor.
data BooleanRule =
  BooleanRule'
    { _brFormat    :: !(Maybe CellFormat)
    , _brCondition :: !(Maybe BooleanCondition)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BooleanRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'brFormat'
--
-- * 'brCondition'
booleanRule
    :: BooleanRule
booleanRule = BooleanRule' {_brFormat = Nothing, _brCondition = Nothing}


-- | The format to apply. Conditional formatting can only apply a subset of
-- formatting: bold, italic, strikethrough, foreground color & background
-- color.
brFormat :: Lens' BooleanRule (Maybe CellFormat)
brFormat = lens _brFormat (\ s a -> s{_brFormat = a})

-- | The condition of the rule. If the condition evaluates to true, the
-- format is applied.
brCondition :: Lens' BooleanRule (Maybe BooleanCondition)
brCondition
  = lens _brCondition (\ s a -> s{_brCondition = a})

instance FromJSON BooleanRule where
        parseJSON
          = withObject "BooleanRule"
              (\ o ->
                 BooleanRule' <$>
                   (o .:? "format") <*> (o .:? "condition"))

instance ToJSON BooleanRule where
        toJSON BooleanRule'{..}
          = object
              (catMaybes
                 [("format" .=) <$> _brFormat,
                  ("condition" .=) <$> _brCondition])

-- | The response when retrieving more than one range of values in a
-- spreadsheet selected by DataFilters.
--
-- /See:/ 'batchGetValuesByDataFilterResponse' smart constructor.
data BatchGetValuesByDataFilterResponse =
  BatchGetValuesByDataFilterResponse'
    { _bgvbdfrSpreadsheetId :: !(Maybe Text)
    , _bgvbdfrValueRanges   :: !(Maybe [MatchedValueRange])
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BatchGetValuesByDataFilterResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bgvbdfrSpreadsheetId'
--
-- * 'bgvbdfrValueRanges'
batchGetValuesByDataFilterResponse
    :: BatchGetValuesByDataFilterResponse
batchGetValuesByDataFilterResponse =
  BatchGetValuesByDataFilterResponse'
    {_bgvbdfrSpreadsheetId = Nothing, _bgvbdfrValueRanges = Nothing}


-- | The ID of the spreadsheet the data was retrieved from.
bgvbdfrSpreadsheetId :: Lens' BatchGetValuesByDataFilterResponse (Maybe Text)
bgvbdfrSpreadsheetId
  = lens _bgvbdfrSpreadsheetId
      (\ s a -> s{_bgvbdfrSpreadsheetId = a})

-- | The requested values with the list of data filters that matched them.
bgvbdfrValueRanges :: Lens' BatchGetValuesByDataFilterResponse [MatchedValueRange]
bgvbdfrValueRanges
  = lens _bgvbdfrValueRanges
      (\ s a -> s{_bgvbdfrValueRanges = a})
      . _Default
      . _Coerce

instance FromJSON BatchGetValuesByDataFilterResponse
         where
        parseJSON
          = withObject "BatchGetValuesByDataFilterResponse"
              (\ o ->
                 BatchGetValuesByDataFilterResponse' <$>
                   (o .:? "spreadsheetId") <*>
                     (o .:? "valueRanges" .!= mempty))

instance ToJSON BatchGetValuesByDataFilterResponse
         where
        toJSON BatchGetValuesByDataFilterResponse'{..}
          = object
              (catMaybes
                 [("spreadsheetId" .=) <$> _bgvbdfrSpreadsheetId,
                  ("valueRanges" .=) <$> _bgvbdfrValueRanges])

-- | A combination of a source range and how to extend that source.
--
-- /See:/ 'sourceAndDestination' smart constructor.
data SourceAndDestination =
  SourceAndDestination'
    { _sadDimension  :: !(Maybe SourceAndDestinationDimension)
    , _sadSource     :: !(Maybe GridRange)
    , _sadFillLength :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'SourceAndDestination' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sadDimension'
--
-- * 'sadSource'
--
-- * 'sadFillLength'
sourceAndDestination
    :: SourceAndDestination
sourceAndDestination =
  SourceAndDestination'
    {_sadDimension = Nothing, _sadSource = Nothing, _sadFillLength = Nothing}


-- | The dimension that data should be filled into.
sadDimension :: Lens' SourceAndDestination (Maybe SourceAndDestinationDimension)
sadDimension
  = lens _sadDimension (\ s a -> s{_sadDimension = a})

-- | The location of the data to use as the source of the autofill.
sadSource :: Lens' SourceAndDestination (Maybe GridRange)
sadSource
  = lens _sadSource (\ s a -> s{_sadSource = a})

-- | The number of rows or columns that data should be filled into. Positive
-- numbers expand beyond the last row or last column of the source.
-- Negative numbers expand before the first row or first column of the
-- source.
sadFillLength :: Lens' SourceAndDestination (Maybe Int32)
sadFillLength
  = lens _sadFillLength
      (\ s a -> s{_sadFillLength = a})
      . mapping _Coerce

instance FromJSON SourceAndDestination where
        parseJSON
          = withObject "SourceAndDestination"
              (\ o ->
                 SourceAndDestination' <$>
                   (o .:? "dimension") <*> (o .:? "source") <*>
                     (o .:? "fillLength"))

instance ToJSON SourceAndDestination where
        toJSON SourceAndDestination'{..}
          = object
              (catMaybes
                 [("dimension" .=) <$> _sadDimension,
                  ("source" .=) <$> _sadSource,
                  ("fillLength" .=) <$> _sadFillLength])

-- | Inserts data into the spreadsheet starting at the specified coordinate.
--
-- /See:/ 'pasteDataRequest' smart constructor.
data PasteDataRequest =
  PasteDataRequest'
    { _pdrData       :: !(Maybe Text)
    , _pdrCoordinate :: !(Maybe GridCoordinate)
    , _pdrHTML       :: !(Maybe Bool)
    , _pdrType       :: !(Maybe PasteDataRequestType)
    , _pdrDelimiter  :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PasteDataRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pdrData'
--
-- * 'pdrCoordinate'
--
-- * 'pdrHTML'
--
-- * 'pdrType'
--
-- * 'pdrDelimiter'
pasteDataRequest
    :: PasteDataRequest
pasteDataRequest =
  PasteDataRequest'
    { _pdrData = Nothing
    , _pdrCoordinate = Nothing
    , _pdrHTML = Nothing
    , _pdrType = Nothing
    , _pdrDelimiter = Nothing
    }


-- | The data to insert.
pdrData :: Lens' PasteDataRequest (Maybe Text)
pdrData = lens _pdrData (\ s a -> s{_pdrData = a})

-- | The coordinate at which the data should start being inserted.
pdrCoordinate :: Lens' PasteDataRequest (Maybe GridCoordinate)
pdrCoordinate
  = lens _pdrCoordinate
      (\ s a -> s{_pdrCoordinate = a})

-- | True if the data is HTML.
pdrHTML :: Lens' PasteDataRequest (Maybe Bool)
pdrHTML = lens _pdrHTML (\ s a -> s{_pdrHTML = a})

-- | How the data should be pasted.
pdrType :: Lens' PasteDataRequest (Maybe PasteDataRequestType)
pdrType = lens _pdrType (\ s a -> s{_pdrType = a})

-- | The delimiter in the data.
pdrDelimiter :: Lens' PasteDataRequest (Maybe Text)
pdrDelimiter
  = lens _pdrDelimiter (\ s a -> s{_pdrDelimiter = a})

instance FromJSON PasteDataRequest where
        parseJSON
          = withObject "PasteDataRequest"
              (\ o ->
                 PasteDataRequest' <$>
                   (o .:? "data") <*> (o .:? "coordinate") <*>
                     (o .:? "html")
                     <*> (o .:? "type")
                     <*> (o .:? "delimiter"))

instance ToJSON PasteDataRequest where
        toJSON PasteDataRequest'{..}
          = object
              (catMaybes
                 [("data" .=) <$> _pdrData,
                  ("coordinate" .=) <$> _pdrCoordinate,
                  ("html" .=) <$> _pdrHTML, ("type" .=) <$> _pdrType,
                  ("delimiter" .=) <$> _pdrDelimiter])

-- | Adds new cells after the last row with data in a sheet, inserting new
-- rows into the sheet if necessary.
--
-- /See:/ 'appendCellsRequest' smart constructor.
data AppendCellsRequest =
  AppendCellsRequest'
    { _acrRows    :: !(Maybe [RowData])
    , _acrSheetId :: !(Maybe (Textual Int32))
    , _acrFields  :: !(Maybe GFieldMask)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AppendCellsRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'acrRows'
--
-- * 'acrSheetId'
--
-- * 'acrFields'
appendCellsRequest
    :: AppendCellsRequest
appendCellsRequest =
  AppendCellsRequest'
    {_acrRows = Nothing, _acrSheetId = Nothing, _acrFields = Nothing}


-- | The data to append.
acrRows :: Lens' AppendCellsRequest [RowData]
acrRows
  = lens _acrRows (\ s a -> s{_acrRows = a}) . _Default
      . _Coerce

-- | The sheet ID to append the data to.
acrSheetId :: Lens' AppendCellsRequest (Maybe Int32)
acrSheetId
  = lens _acrSheetId (\ s a -> s{_acrSheetId = a}) .
      mapping _Coerce

-- | The fields of CellData that should be updated. At least one field must
-- be specified. The root is the CellData; \'row.values.\' should not be
-- specified. A single \`\"*\"\` can be used as short-hand for listing
-- every field.
acrFields :: Lens' AppendCellsRequest (Maybe GFieldMask)
acrFields
  = lens _acrFields (\ s a -> s{_acrFields = a})

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

instance ToJSON AppendCellsRequest where
        toJSON AppendCellsRequest'{..}
          = object
              (catMaybes
                 [("rows" .=) <$> _acrRows,
                  ("sheetId" .=) <$> _acrSheetId,
                  ("fields" .=) <$> _acrFields])

-- | The result of the find\/replace.
--
-- /See:/ 'findReplaceResponse' smart constructor.
data FindReplaceResponse =
  FindReplaceResponse'
    { _frrValuesChanged      :: !(Maybe (Textual Int32))
    , _frrFormulasChanged    :: !(Maybe (Textual Int32))
    , _frrRowsChanged        :: !(Maybe (Textual Int32))
    , _frrSheetsChanged      :: !(Maybe (Textual Int32))
    , _frrOccurrencesChanged :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'FindReplaceResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'frrValuesChanged'
--
-- * 'frrFormulasChanged'
--
-- * 'frrRowsChanged'
--
-- * 'frrSheetsChanged'
--
-- * 'frrOccurrencesChanged'
findReplaceResponse
    :: FindReplaceResponse
findReplaceResponse =
  FindReplaceResponse'
    { _frrValuesChanged = Nothing
    , _frrFormulasChanged = Nothing
    , _frrRowsChanged = Nothing
    , _frrSheetsChanged = Nothing
    , _frrOccurrencesChanged = Nothing
    }


-- | The number of non-formula cells changed.
frrValuesChanged :: Lens' FindReplaceResponse (Maybe Int32)
frrValuesChanged
  = lens _frrValuesChanged
      (\ s a -> s{_frrValuesChanged = a})
      . mapping _Coerce

-- | The number of formula cells changed.
frrFormulasChanged :: Lens' FindReplaceResponse (Maybe Int32)
frrFormulasChanged
  = lens _frrFormulasChanged
      (\ s a -> s{_frrFormulasChanged = a})
      . mapping _Coerce

-- | The number of rows changed.
frrRowsChanged :: Lens' FindReplaceResponse (Maybe Int32)
frrRowsChanged
  = lens _frrRowsChanged
      (\ s a -> s{_frrRowsChanged = a})
      . mapping _Coerce

-- | The number of sheets changed.
frrSheetsChanged :: Lens' FindReplaceResponse (Maybe Int32)
frrSheetsChanged
  = lens _frrSheetsChanged
      (\ s a -> s{_frrSheetsChanged = a})
      . mapping _Coerce

-- | The number of occurrences (possibly multiple within a cell) changed. For
-- example, if replacing \`\"e\"\` with \`\"o\"\` in \`\"Google Sheets\"\`,
-- this would be \`\"3\"\` because \`\"Google Sheets\"\` -> \`\"Googlo
-- Shoots\"\`.
frrOccurrencesChanged :: Lens' FindReplaceResponse (Maybe Int32)
frrOccurrencesChanged
  = lens _frrOccurrencesChanged
      (\ s a -> s{_frrOccurrencesChanged = a})
      . mapping _Coerce

instance FromJSON FindReplaceResponse where
        parseJSON
          = withObject "FindReplaceResponse"
              (\ o ->
                 FindReplaceResponse' <$>
                   (o .:? "valuesChanged") <*> (o .:? "formulasChanged")
                     <*> (o .:? "rowsChanged")
                     <*> (o .:? "sheetsChanged")
                     <*> (o .:? "occurrencesChanged"))

instance ToJSON FindReplaceResponse where
        toJSON FindReplaceResponse'{..}
          = object
              (catMaybes
                 [("valuesChanged" .=) <$> _frrValuesChanged,
                  ("formulasChanged" .=) <$> _frrFormulasChanged,
                  ("rowsChanged" .=) <$> _frrRowsChanged,
                  ("sheetsChanged" .=) <$> _frrSheetsChanged,
                  ("occurrencesChanged" .=) <$>
                    _frrOccurrencesChanged])

-- | The result of adding a group.
--
-- /See:/ 'addDimensionGroupResponse' smart constructor.
newtype AddDimensionGroupResponse =
  AddDimensionGroupResponse'
    { _adgrDimensionGroups :: Maybe [DimensionGroup]
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AddDimensionGroupResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'adgrDimensionGroups'
addDimensionGroupResponse
    :: AddDimensionGroupResponse
addDimensionGroupResponse =
  AddDimensionGroupResponse' {_adgrDimensionGroups = Nothing}


-- | All groups of a dimension after adding a group to that dimension.
adgrDimensionGroups :: Lens' AddDimensionGroupResponse [DimensionGroup]
adgrDimensionGroups
  = lens _adgrDimensionGroups
      (\ s a -> s{_adgrDimensionGroups = a})
      . _Default
      . _Coerce

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

instance ToJSON AddDimensionGroupResponse where
        toJSON AddDimensionGroupResponse'{..}
          = object
              (catMaybes
                 [("dimensionGroups" .=) <$> _adgrDimensionGroups])

-- | A </chart/interactive/docs/gallery/piechart pie chart>.
--
-- /See:/ 'pieChartSpec' smart constructor.
data PieChartSpec =
  PieChartSpec'
    { _pcsPieHole          :: !(Maybe (Textual Double))
    , _pcsLegendPosition   :: !(Maybe PieChartSpecLegendPosition)
    , _pcsDomain           :: !(Maybe ChartData)
    , _pcsSeries           :: !(Maybe ChartData)
    , _pcsThreeDimensional :: !(Maybe Bool)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PieChartSpec' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pcsPieHole'
--
-- * 'pcsLegendPosition'
--
-- * 'pcsDomain'
--
-- * 'pcsSeries'
--
-- * 'pcsThreeDimensional'
pieChartSpec
    :: PieChartSpec
pieChartSpec =
  PieChartSpec'
    { _pcsPieHole = Nothing
    , _pcsLegendPosition = Nothing
    , _pcsDomain = Nothing
    , _pcsSeries = Nothing
    , _pcsThreeDimensional = Nothing
    }


-- | The size of the hole in the pie chart.
pcsPieHole :: Lens' PieChartSpec (Maybe Double)
pcsPieHole
  = lens _pcsPieHole (\ s a -> s{_pcsPieHole = a}) .
      mapping _Coerce

-- | Where the legend of the pie chart should be drawn.
pcsLegendPosition :: Lens' PieChartSpec (Maybe PieChartSpecLegendPosition)
pcsLegendPosition
  = lens _pcsLegendPosition
      (\ s a -> s{_pcsLegendPosition = a})

-- | The data that covers the domain of the pie chart.
pcsDomain :: Lens' PieChartSpec (Maybe ChartData)
pcsDomain
  = lens _pcsDomain (\ s a -> s{_pcsDomain = a})

-- | The data that covers the one and only series of the pie chart.
pcsSeries :: Lens' PieChartSpec (Maybe ChartData)
pcsSeries
  = lens _pcsSeries (\ s a -> s{_pcsSeries = a})

-- | True if the pie is three dimensional.
pcsThreeDimensional :: Lens' PieChartSpec (Maybe Bool)
pcsThreeDimensional
  = lens _pcsThreeDimensional
      (\ s a -> s{_pcsThreeDimensional = a})

instance FromJSON PieChartSpec where
        parseJSON
          = withObject "PieChartSpec"
              (\ o ->
                 PieChartSpec' <$>
                   (o .:? "pieHole") <*> (o .:? "legendPosition") <*>
                     (o .:? "domain")
                     <*> (o .:? "series")
                     <*> (o .:? "threeDimensional"))

instance ToJSON PieChartSpec where
        toJSON PieChartSpec'{..}
          = object
              (catMaybes
                 [("pieHole" .=) <$> _pcsPieHole,
                  ("legendPosition" .=) <$> _pcsLegendPosition,
                  ("domain" .=) <$> _pcsDomain,
                  ("series" .=) <$> _pcsSeries,
                  ("threeDimensional" .=) <$> _pcsThreeDimensional])

-- | The response when updating a range of values in a spreadsheet.
--
-- /See:/ 'batchUpdateValuesByDataFilterResponse' smart constructor.
data BatchUpdateValuesByDataFilterResponse =
  BatchUpdateValuesByDataFilterResponse'
    { _buvbdfrTotalUpdatedColumns :: !(Maybe (Textual Int32))
    , _buvbdfrResponses           :: !(Maybe [UpdateValuesByDataFilterResponse])
    , _buvbdfrSpreadsheetId       :: !(Maybe Text)
    , _buvbdfrTotalUpdatedSheets  :: !(Maybe (Textual Int32))
    , _buvbdfrTotalUpdatedCells   :: !(Maybe (Textual Int32))
    , _buvbdfrTotalUpdatedRows    :: !(Maybe (Textual Int32))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BatchUpdateValuesByDataFilterResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'buvbdfrTotalUpdatedColumns'
--
-- * 'buvbdfrResponses'
--
-- * 'buvbdfrSpreadsheetId'
--
-- * 'buvbdfrTotalUpdatedSheets'
--
-- * 'buvbdfrTotalUpdatedCells'
--
-- * 'buvbdfrTotalUpdatedRows'
batchUpdateValuesByDataFilterResponse
    :: BatchUpdateValuesByDataFilterResponse
batchUpdateValuesByDataFilterResponse =
  BatchUpdateValuesByDataFilterResponse'
    { _buvbdfrTotalUpdatedColumns = Nothing
    , _buvbdfrResponses = Nothing
    , _buvbdfrSpreadsheetId = Nothing
    , _buvbdfrTotalUpdatedSheets = Nothing
    , _buvbdfrTotalUpdatedCells = Nothing
    , _buvbdfrTotalUpdatedRows = Nothing
    }


-- | The total number of columns where at least one cell in the column was
-- updated.
buvbdfrTotalUpdatedColumns :: Lens' BatchUpdateValuesByDataFilterResponse (Maybe Int32)
buvbdfrTotalUpdatedColumns
  = lens _buvbdfrTotalUpdatedColumns
      (\ s a -> s{_buvbdfrTotalUpdatedColumns = a})
      . mapping _Coerce

-- | The response for each range updated.
buvbdfrResponses :: Lens' BatchUpdateValuesByDataFilterResponse [UpdateValuesByDataFilterResponse]
buvbdfrResponses
  = lens _buvbdfrResponses
      (\ s a -> s{_buvbdfrResponses = a})
      . _Default
      . _Coerce

-- | The spreadsheet the updates were applied to.
buvbdfrSpreadsheetId :: Lens' BatchUpdateValuesByDataFilterResponse (Maybe Text)
buvbdfrSpreadsheetId
  = lens _buvbdfrSpreadsheetId
      (\ s a -> s{_buvbdfrSpreadsheetId = a})

-- | The total number of sheets where at least one cell in the sheet was
-- updated.
buvbdfrTotalUpdatedSheets :: Lens' BatchUpdateValuesByDataFilterResponse (Maybe Int32)
buvbdfrTotalUpdatedSheets
  = lens _buvbdfrTotalUpdatedSheets
      (\ s a -> s{_buvbdfrTotalUpdatedSheets = a})
      . mapping _Coerce

-- | The total number of cells updated.
buvbdfrTotalUpdatedCells :: Lens' BatchUpdateValuesByDataFilterResponse (Maybe Int32)
buvbdfrTotalUpdatedCells
  = lens _buvbdfrTotalUpdatedCells
      (\ s a -> s{_buvbdfrTotalUpdatedCells = a})
      . mapping _Coerce

-- | The total number of rows where at least one cell in the row was updated.
buvbdfrTotalUpdatedRows :: Lens' BatchUpdateValuesByDataFilterResponse (Maybe Int32)
buvbdfrTotalUpdatedRows
  = lens _buvbdfrTotalUpdatedRows
      (\ s a -> s{_buvbdfrTotalUpdatedRows = a})
      . mapping _Coerce

instance FromJSON
           BatchUpdateValuesByDataFilterResponse
         where
        parseJSON
          = withObject "BatchUpdateValuesByDataFilterResponse"
              (\ o ->
                 BatchUpdateValuesByDataFilterResponse' <$>
                   (o .:? "totalUpdatedColumns") <*>
                     (o .:? "responses" .!= mempty)
                     <*> (o .:? "spreadsheetId")
                     <*> (o .:? "totalUpdatedSheets")
                     <*> (o .:? "totalUpdatedCells")
                     <*> (o .:? "totalUpdatedRows"))

instance ToJSON BatchUpdateValuesByDataFilterResponse
         where
        toJSON BatchUpdateValuesByDataFilterResponse'{..}
          = object
              (catMaybes
                 [("totalUpdatedColumns" .=) <$>
                    _buvbdfrTotalUpdatedColumns,
                  ("responses" .=) <$> _buvbdfrResponses,
                  ("spreadsheetId" .=) <$> _buvbdfrSpreadsheetId,
                  ("totalUpdatedSheets" .=) <$>
                    _buvbdfrTotalUpdatedSheets,
                  ("totalUpdatedCells" .=) <$>
                    _buvbdfrTotalUpdatedCells,
                  ("totalUpdatedRows" .=) <$>
                    _buvbdfrTotalUpdatedRows])

-- | The response when updating a range of values in a spreadsheet.
--
-- /See:/ 'appendValuesResponse' smart constructor.
data AppendValuesResponse =
  AppendValuesResponse'
    { _avrSpreadsheetId :: !(Maybe Text)
    , _avrUpdates       :: !(Maybe UpdateValuesResponse)
    , _avrTableRange    :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AppendValuesResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'avrSpreadsheetId'
--
-- * 'avrUpdates'
--
-- * 'avrTableRange'
appendValuesResponse
    :: AppendValuesResponse
appendValuesResponse =
  AppendValuesResponse'
    { _avrSpreadsheetId = Nothing
    , _avrUpdates = Nothing
    , _avrTableRange = Nothing
    }


-- | The spreadsheet the updates were applied to.
avrSpreadsheetId :: Lens' AppendValuesResponse (Maybe Text)
avrSpreadsheetId
  = lens _avrSpreadsheetId
      (\ s a -> s{_avrSpreadsheetId = a})

-- | Information about the updates that were applied.
avrUpdates :: Lens' AppendValuesResponse (Maybe UpdateValuesResponse)
avrUpdates
  = lens _avrUpdates (\ s a -> s{_avrUpdates = a})

-- | The range (in A1 notation) of the table that values are being appended
-- to (before the values were appended). Empty if no table was found.
avrTableRange :: Lens' AppendValuesResponse (Maybe Text)
avrTableRange
  = lens _avrTableRange
      (\ s a -> s{_avrTableRange = a})

instance FromJSON AppendValuesResponse where
        parseJSON
          = withObject "AppendValuesResponse"
              (\ o ->
                 AppendValuesResponse' <$>
                   (o .:? "spreadsheetId") <*> (o .:? "updates") <*>
                     (o .:? "tableRange"))

instance ToJSON AppendValuesResponse where
        toJSON AppendValuesResponse'{..}
          = object
              (catMaybes
                 [("spreadsheetId" .=) <$> _avrSpreadsheetId,
                  ("updates" .=) <$> _avrUpdates,
                  ("tableRange" .=) <$> _avrTableRange])

-- | A data validation rule.
--
-- /See:/ 'dataValidationRule' smart constructor.
data DataValidationRule =
  DataValidationRule'
    { _dvrShowCustomUi :: !(Maybe Bool)
    , _dvrInputMessage :: !(Maybe Text)
    , _dvrStrict       :: !(Maybe Bool)
    , _dvrCondition    :: !(Maybe BooleanCondition)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DataValidationRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dvrShowCustomUi'
--
-- * 'dvrInputMessage'
--
-- * 'dvrStrict'
--
-- * 'dvrCondition'
dataValidationRule
    :: DataValidationRule
dataValidationRule =
  DataValidationRule'
    { _dvrShowCustomUi = Nothing
    , _dvrInputMessage = Nothing
    , _dvrStrict = Nothing
    , _dvrCondition = Nothing
    }


-- | True if the UI should be customized based on the kind of condition. If
-- true, \"List\" conditions will show a dropdown.
dvrShowCustomUi :: Lens' DataValidationRule (Maybe Bool)
dvrShowCustomUi
  = lens _dvrShowCustomUi
      (\ s a -> s{_dvrShowCustomUi = a})

-- | A message to show the user when adding data to the cell.
dvrInputMessage :: Lens' DataValidationRule (Maybe Text)
dvrInputMessage
  = lens _dvrInputMessage
      (\ s a -> s{_dvrInputMessage = a})

-- | True if invalid data should be rejected.
dvrStrict :: Lens' DataValidationRule (Maybe Bool)
dvrStrict
  = lens _dvrStrict (\ s a -> s{_dvrStrict = a})

-- | The condition that data in the cell must match.
dvrCondition :: Lens' DataValidationRule (Maybe BooleanCondition)
dvrCondition
  = lens _dvrCondition (\ s a -> s{_dvrCondition = a})

instance FromJSON DataValidationRule where
        parseJSON
          = withObject "DataValidationRule"
              (\ o ->
                 DataValidationRule' <$>
                   (o .:? "showCustomUi") <*> (o .:? "inputMessage") <*>
                     (o .:? "strict")
                     <*> (o .:? "condition"))

instance ToJSON DataValidationRule where
        toJSON DataValidationRule'{..}
          = object
              (catMaybes
                 [("showCustomUi" .=) <$> _dvrShowCustomUi,
                  ("inputMessage" .=) <$> _dvrInputMessage,
                  ("strict" .=) <$> _dvrStrict,
                  ("condition" .=) <$> _dvrCondition])

-- | A filter view.
--
-- /See:/ 'filterView' smart constructor.
data FilterView =
  FilterView'
    { _fvSortSpecs    :: !(Maybe [SortSpec])
    , _fvNamedRangeId :: !(Maybe Text)
    , _fvRange        :: !(Maybe GridRange)
    , _fvFilterViewId :: !(Maybe (Textual Int32))
    , _fvTitle        :: !(Maybe Text)
    , _fvCriteria     :: !(Maybe FilterViewCriteria)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'FilterView' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'fvSortSpecs'
--
-- * 'fvNamedRangeId'
--
-- * 'fvRange'
--
-- * 'fvFilterViewId'
--
-- * 'fvTitle'
--
-- * 'fvCriteria'
filterView
    :: FilterView
filterView =
  FilterView'
    { _fvSortSpecs = Nothing
    , _fvNamedRangeId = Nothing
    , _fvRange = Nothing
    , _fvFilterViewId = Nothing
    , _fvTitle = Nothing
    , _fvCriteria = Nothing
    }


-- | The sort order per column. Later specifications are used when values are
-- equal in the earlier specifications.
fvSortSpecs :: Lens' FilterView [SortSpec]
fvSortSpecs
  = lens _fvSortSpecs (\ s a -> s{_fvSortSpecs = a}) .
      _Default
      . _Coerce

-- | The named range this filter view is backed by, if any. When writing,
-- only one of range or named_range_id may be set.
fvNamedRangeId :: Lens' FilterView (Maybe Text)
fvNamedRangeId
  = lens _fvNamedRangeId
      (\ s a -> s{_fvNamedRangeId = a})

-- | The range this filter view covers. When writing, only one of range or
-- named_range_id may be set.
fvRange :: Lens' FilterView (Maybe GridRange)
fvRange = lens _fvRange (\ s a -> s{_fvRange = a})

-- | The ID of the filter view.
fvFilterViewId :: Lens' FilterView (Maybe Int32)
fvFilterViewId
  = lens _fvFilterViewId
      (\ s a -> s{_fvFilterViewId = a})
      . mapping _Coerce

-- | The name of the filter view.
fvTitle :: Lens' FilterView (Maybe Text)
fvTitle = lens _fvTitle (\ s a -> s{_fvTitle = a})

-- | The criteria for showing\/hiding values per column. The map\'s key is
-- the column index, and the value is the criteria for that column.
fvCriteria :: Lens' FilterView (Maybe FilterViewCriteria)
fvCriteria
  = lens _fvCriteria (\ s a -> s{_fvCriteria = a})

instance FromJSON FilterView where
        parseJSON
          = withObject "FilterView"
              (\ o ->
                 FilterView' <$>
                   (o .:? "sortSpecs" .!= mempty) <*>
                     (o .:? "namedRangeId")
                     <*> (o .:? "range")
                     <*> (o .:? "filterViewId")
                     <*> (o .:? "title")
                     <*> (o .:? "criteria"))

instance ToJSON FilterView where
        toJSON FilterView'{..}
          = object
              (catMaybes
                 [("sortSpecs" .=) <$> _fvSortSpecs,
                  ("namedRangeId" .=) <$> _fvNamedRangeId,
                  ("range" .=) <$> _fvRange,
                  ("filterViewId" .=) <$> _fvFilterViewId,
                  ("title" .=) <$> _fvTitle,
                  ("criteria" .=) <$> _fvCriteria])

-- | Represents a color in the RGBA color space. This representation is
-- designed for simplicity of conversion to\/from color representations in
-- various languages over compactness; for example, the fields of this
-- representation can be trivially provided to the constructor of
-- \"java.awt.Color\" in Java; it can also be trivially provided to
-- UIColor\'s \"+colorWithRed:green:blue:alpha\" method in iOS; and, with
-- just a little work, it can be easily formatted into a CSS \"rgba()\"
-- string in JavaScript, as well. Note: this proto does not carry
-- information about the absolute color space that should be used to
-- interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.).
-- By default, applications SHOULD assume the sRGB color space. Example
-- (Java): import com.google.type.Color; \/\/ ... public static
-- java.awt.Color fromProto(Color protocolor) { float alpha =
-- protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return
-- new java.awt.Color( protocolor.getRed(), protocolor.getGreen(),
-- protocolor.getBlue(), alpha); } public static Color
-- toProto(java.awt.Color color) { float red = (float) color.getRed();
-- float green = (float) color.getGreen(); float blue = (float)
-- color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder
-- = Color .newBuilder() .setRed(red \/ denominator) .setGreen(green \/
-- denominator) .setBlue(blue \/ denominator); int alpha =
-- color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue
-- .newBuilder() .setValue(((float) alpha) \/ denominator) .build()); }
-- return resultBuilder.build(); } \/\/ ... Example (iOS \/ Obj-C): \/\/
-- ... static UIColor* fromProto(Color* protocolor) { float red =
-- [protocolor red]; float green = [protocolor green]; float blue =
-- [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float
-- alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value];
-- } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; }
-- static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha;
-- if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return
-- nil; } Color* result = [[Color alloc] init]; [result setRed:red];
-- [result setGreen:green]; [result setBlue:blue]; if (alpha \<= 0.9999) {
-- [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease];
-- return result; } \/\/ ... Example (JavaScript): \/\/ ... var
-- protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red ||
-- 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac =
-- rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green =
-- Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if
-- (!(\'alpha\' in rgb_color)) { return rgbToCssColor_(red, green, blue); }
-- var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red,
-- green, blue].join(\',\'); return [\'rgba(\', rgbParams, \',\',
-- alphaFrac, \')\'].join(\'\'); }; var rgbToCssColor_ = function(red,
-- green, blue) { var rgbNumber = new Number((red \<\< 16) | (green \<\< 8)
-- | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 -
-- hexString.length; var resultBuilder = [\'#\']; for (var i = 0; i \<
-- missingZeros; i++) { resultBuilder.push(\'0\'); }
-- resultBuilder.push(hexString); return resultBuilder.join(\'\'); }; \/\/
-- ...
--
-- /See:/ 'color' smart constructor.
data Color =
  Color'
    { _cRed   :: !(Maybe (Textual Double))
    , _cAlpha :: !(Maybe (Textual Double))
    , _cGreen :: !(Maybe (Textual Double))
    , _cBlue  :: !(Maybe (Textual Double))
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Color' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cRed'
--
-- * 'cAlpha'
--
-- * 'cGreen'
--
-- * 'cBlue'
color
    :: Color
color =
  Color'
    {_cRed = Nothing, _cAlpha = Nothing, _cGreen = Nothing, _cBlue = Nothing}


-- | The amount of red in the color as a value in the interval [0, 1].
cRed :: Lens' Color (Maybe Double)
cRed
  = lens _cRed (\ s a -> s{_cRed = a}) .
      mapping _Coerce

-- | The fraction of this color that should be applied to the pixel. That is,
-- the final pixel color is defined by the equation: pixel color = alpha *
-- (this color) + (1.0 - alpha) * (background color) This means that a
-- value of 1.0 corresponds to a solid color, whereas a value of 0.0
-- corresponds to a completely transparent color. This uses a wrapper
-- message rather than a simple float scalar so that it is possible to
-- distinguish between a default value and the value being unset. If
-- omitted, this color object is to be rendered as a solid color (as if the
-- alpha value had been explicitly given with a value of 1.0).
cAlpha :: Lens' Color (Maybe Double)
cAlpha
  = lens _cAlpha (\ s a -> s{_cAlpha = a}) .
      mapping _Coerce

-- | The amount of green in the color as a value in the interval [0, 1].
cGreen :: Lens' Color (Maybe Double)
cGreen
  = lens _cGreen (\ s a -> s{_cGreen = a}) .
      mapping _Coerce

-- | The amount of blue in the color as a value in the interval [0, 1].
cBlue :: Lens' Color (Maybe Double)
cBlue
  = lens _cBlue (\ s a -> s{_cBlue = a}) .
      mapping _Coerce

instance FromJSON Color where
        parseJSON
          = withObject "Color"
              (\ o ->
                 Color' <$>
                   (o .:? "red") <*> (o .:? "alpha") <*> (o .:? "green")
                     <*> (o .:? "blue"))

instance ToJSON Color where
        toJSON Color'{..}
          = object
              (catMaybes
                 [("red" .=) <$> _cRed, ("alpha" .=) <$> _cAlpha,
                  ("green" .=) <$> _cGreen, ("blue" .=) <$> _cBlue])

-- | Deletes a particular filter view.
--
-- /See:/ 'deleteFilterViewRequest' smart constructor.
newtype DeleteFilterViewRequest =
  DeleteFilterViewRequest'
    { _dfvrFilterId :: Maybe (Textual Int32)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DeleteFilterViewRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dfvrFilterId'
deleteFilterViewRequest
    :: DeleteFilterViewRequest
deleteFilterViewRequest = DeleteFilterViewRequest' {_dfvrFilterId = Nothing}


-- | The ID of the filter to delete.
dfvrFilterId :: Lens' DeleteFilterViewRequest (Maybe Int32)
dfvrFilterId
  = lens _dfvrFilterId (\ s a -> s{_dfvrFilterId = a})
      . mapping _Coerce

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

instance ToJSON DeleteFilterViewRequest where
        toJSON DeleteFilterViewRequest'{..}
          = object
              (catMaybes [("filterId" .=) <$> _dfvrFilterId])

-- | Updates properties of the filter view.
--
-- /See:/ 'updateFilterViewRequest' smart constructor.
data UpdateFilterViewRequest =
  UpdateFilterViewRequest'
    { _ufvrFilter :: !(Maybe FilterView)
    , _ufvrFields :: !(Maybe GFieldMask)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'UpdateFilterViewRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ufvrFilter'
--
-- * 'ufvrFields'
updateFilterViewRequest
    :: UpdateFilterViewRequest
updateFilterViewRequest =
  UpdateFilterViewRequest' {_ufvrFilter = Nothing, _ufvrFields = Nothing}


-- | The new properties of the filter view.
ufvrFilter :: Lens' UpdateFilterViewRequest (Maybe FilterView)
ufvrFilter
  = lens _ufvrFilter (\ s a -> s{_ufvrFilter = a})

-- | The fields that should be updated. At least one field must be specified.
-- The root \`filter\` is implied and should not be specified. A single
-- \`\"*\"\` can be used as short-hand for listing every field.
ufvrFields :: Lens' UpdateFilterViewRequest (Maybe GFieldMask)
ufvrFields
  = lens _ufvrFields (\ s a -> s{_ufvrFields = a})

instance FromJSON UpdateFilterViewRequest where
        parseJSON
          = withObject "UpdateFilterViewRequest"
              (\ o ->
                 UpdateFilterViewRequest' <$>
                   (o .:? "filter") <*> (o .:? "fields"))

instance ToJSON UpdateFilterViewRequest where
        toJSON UpdateFilterViewRequest'{..}
          = object
              (catMaybes
                 [("filter" .=) <$> _ufvrFilter,
                  ("fields" .=) <$> _ufvrFields])

-- | A single series of data in a chart. For example, if charting stock
-- prices over time, multiple series may exist, one for the \"Open Price\",
-- \"High Price\", \"Low Price\" and \"Close Price\".
--
-- /See:/ 'basicChartSeries' smart constructor.
data BasicChartSeries =
  BasicChartSeries'
    { _bTargetAxis :: !(Maybe BasicChartSeriesTargetAxis)
    , _bColor      :: !(Maybe Color)
    , _bSeries     :: !(Maybe ChartData)
    , _bType       :: !(Maybe BasicChartSeriesType)
    , _bLineStyle  :: !(Maybe LineStyle)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BasicChartSeries' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bTargetAxis'
--
-- * 'bColor'
--
-- * 'bSeries'
--
-- * 'bType'
--
-- * 'bLineStyle'
basicChartSeries
    :: BasicChartSeries
basicChartSeries =
  BasicChartSeries'
    { _bTargetAxis = Nothing
    , _bColor = Nothing
    , _bSeries = Nothing
    , _bType = Nothing
    , _bLineStyle = Nothing
    }


-- | The minor axis that will specify the range of values for this series.
-- For example, if charting stocks over time, the \"Volume\" series may
-- want to be pinned to the right with the prices pinned to the left,
-- because the scale of trading volume is different than the scale of
-- prices. It is an error to specify an axis that isn\'t a valid minor axis
-- for the chart\'s type.
bTargetAxis :: Lens' BasicChartSeries (Maybe BasicChartSeriesTargetAxis)
bTargetAxis
  = lens _bTargetAxis (\ s a -> s{_bTargetAxis = a})

-- | The color for elements (i.e. bars, lines, points) associated with this
-- series. If empty, a default color is used.
bColor :: Lens' BasicChartSeries (Maybe Color)
bColor = lens _bColor (\ s a -> s{_bColor = a})

-- | The data being visualized in this chart series.
bSeries :: Lens' BasicChartSeries (Maybe ChartData)
bSeries = lens _bSeries (\ s a -> s{_bSeries = a})

-- | The type of this series. Valid only if the chartType is COMBO. Different
-- types will change the way the series is visualized. Only LINE, AREA, and
-- COLUMN are supported.
bType :: Lens' BasicChartSeries (Maybe BasicChartSeriesType)
bType = lens _bType (\ s a -> s{_bType = a})

-- | The line style of this series. Valid only if the chartType is AREA,
-- LINE, or SCATTER. COMBO charts are also supported if the series chart
-- type is AREA or LINE.
bLineStyle :: Lens' BasicChartSeries (Maybe LineStyle)
bLineStyle
  = lens _bLineStyle (\ s a -> s{_bLineStyle = a})

instance FromJSON BasicChartSeries where
        parseJSON
          = withObject "BasicChartSeries"
              (\ o ->
                 BasicChartSeries' <$>
                   (o .:? "targetAxis") <*> (o .:? "color") <*>
                     (o .:? "series")
                     <*> (o .:? "type")
                     <*> (o .:? "lineStyle"))

instance ToJSON BasicChartSeries where
        toJSON BasicChartSeries'{..}
          = object
              (catMaybes
                 [("targetAxis" .=) <$> _bTargetAxis,
                  ("color" .=) <$> _bColor, ("series" .=) <$> _bSeries,
                  ("type" .=) <$> _bType,
                  ("lineStyle" .=) <$> _bLineStyle])

-- | An optional setting on a PivotGroup that defines buckets for the values
-- in the source data column rather than breaking out each individual
-- value. Only one PivotGroup with a group rule may be added for each
-- column in the source data, though on any given column you may add both a
-- PivotGroup that has a rule and a PivotGroup that does not.
--
-- /See:/ 'pivotGroupRule' smart constructor.
data PivotGroupRule =
  PivotGroupRule'
    { _pgrDateTimeRule  :: !(Maybe DateTimeRule)
    , _pgrManualRule    :: !(Maybe ManualRule)
    , _pgrHistogramRule :: !(Maybe HistogramRule)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'PivotGroupRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pgrDateTimeRule'
--
-- * 'pgrManualRule'
--
-- * 'pgrHistogramRule'
pivotGroupRule
    :: PivotGroupRule
pivotGroupRule =
  PivotGroupRule'
    { _pgrDateTimeRule = Nothing
    , _pgrManualRule = Nothing
    , _pgrHistogramRule = Nothing
    }


-- | A DateTimeRule.
pgrDateTimeRule :: Lens' PivotGroupRule (Maybe DateTimeRule)
pgrDateTimeRule
  = lens _pgrDateTimeRule
      (\ s a -> s{_pgrDateTimeRule = a})

-- | A ManualRule.
pgrManualRule :: Lens' PivotGroupRule (Maybe ManualRule)
pgrManualRule
  = lens _pgrManualRule
      (\ s a -> s{_pgrManualRule = a})

-- | A HistogramRule.
pgrHistogramRule :: Lens' PivotGroupRule (Maybe HistogramRule)
pgrHistogramRule
  = lens _pgrHistogramRule
      (\ s a -> s{_pgrHistogramRule = a})

instance FromJSON PivotGroupRule where
        parseJSON
          = withObject "PivotGroupRule"
              (\ o ->
                 PivotGroupRule' <$>
                   (o .:? "dateTimeRule") <*> (o .:? "manualRule") <*>
                     (o .:? "histogramRule"))

instance ToJSON PivotGroupRule where
        toJSON PivotGroupRule'{..}
          = object
              (catMaybes
                 [("dateTimeRule" .=) <$> _pgrDateTimeRule,
                  ("manualRule" .=) <$> _pgrManualRule,
                  ("histogramRule" .=) <$> _pgrHistogramRule])

-- | Adds a new protected range.
--
-- /See:/ 'addProtectedRangeRequest' smart constructor.
newtype AddProtectedRangeRequest =
  AddProtectedRangeRequest'
    { _aprrProtectedRange :: Maybe ProtectedRange
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'AddProtectedRangeRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'aprrProtectedRange'
addProtectedRangeRequest
    :: AddProtectedRangeRequest
addProtectedRangeRequest =
  AddProtectedRangeRequest' {_aprrProtectedRange = Nothing}


-- | The protected range to be added. The protectedRangeId field is optional;
-- if one is not set, an id will be randomly generated. (It is an error to
-- specify the ID of a range that already exists.)
aprrProtectedRange :: Lens' AddProtectedRangeRequest (Maybe ProtectedRange)
aprrProtectedRange
  = lens _aprrProtectedRange
      (\ s a -> s{_aprrProtectedRange = a})

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

instance ToJSON AddProtectedRangeRequest where
        toJSON AddProtectedRangeRequest'{..}
          = object
              (catMaybes
                 [("protectedRange" .=) <$> _aprrProtectedRange])

-- | Updates all cells in the range to the values in the given Cell object.
-- Only the fields listed in the fields field are updated; others are
-- unchanged. If writing a cell with a formula, the formula\'s ranges will
-- automatically increment for each field in the range. For example, if
-- writing a cell with formula \`=A1\` into range B2:C4, B2 would be
-- \`=A1\`, B3 would be \`=A2\`, B4 would be \`=A3\`, C2 would be \`=B1\`,
-- C3 would be \`=B2\`, C4 would be \`=B3\`. To keep the formula\'s ranges
-- static, use the \`$\` indicator. For example, use the formula \`=$A$1\`
-- to prevent both the row and the column from incrementing.
--
-- /See:/ 'repeatCellRequest' smart constructor.
data RepeatCellRequest =
  RepeatCellRequest'
    { _rcrCell   :: !(Maybe CellData)
    , _rcrRange  :: !(Maybe GridRange)
    , _rcrFields :: !(Maybe GFieldMask)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'RepeatCellRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rcrCell'
--
-- * 'rcrRange'
--
-- * 'rcrFields'
repeatCellRequest
    :: RepeatCellRequest
repeatCellRequest =
  RepeatCellRequest'
    {_rcrCell = Nothing, _rcrRange = Nothing, _rcrFields = Nothing}


-- | The data to write.
rcrCell :: Lens' RepeatCellRequest (Maybe CellData)
rcrCell = lens _rcrCell (\ s a -> s{_rcrCell = a})

-- | The range to repeat the cell in.
rcrRange :: Lens' RepeatCellRequest (Maybe GridRange)
rcrRange = lens _rcrRange (\ s a -> s{_rcrRange = a})

-- | The fields that should be updated. At least one field must be specified.
-- The root \`cell\` is implied and should not be specified. A single
-- \`\"*\"\` can be used as short-hand for listing every field.
rcrFields :: Lens' RepeatCellRequest (Maybe GFieldMask)
rcrFields
  = lens _rcrFields (\ s a -> s{_rcrFields = a})

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

instance ToJSON RepeatCellRequest where
        toJSON RepeatCellRequest'{..}
          = object
              (catMaybes
                 [("cell" .=) <$> _rcrCell,
                  ("range" .=) <$> _rcrRange,
                  ("fields" .=) <$> _rcrFields])

-- | The value of the condition.
--
-- /See:/ 'conditionValue' smart constructor.
data ConditionValue =
  ConditionValue'
    { _cvRelativeDate     :: !(Maybe ConditionValueRelativeDate)
    , _cvUserEnteredValue :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'ConditionValue' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cvRelativeDate'
--
-- * 'cvUserEnteredValue'
conditionValue
    :: ConditionValue
conditionValue =
  ConditionValue' {_cvRelativeDate = Nothing, _cvUserEnteredValue = Nothing}


-- | A relative date (based on the current date). Valid only if the type is
-- DATE_BEFORE, DATE_AFTER, DATE_ON_OR_BEFORE or DATE_ON_OR_AFTER. Relative
-- dates are not supported in data validation. They are supported only in
-- conditional formatting and conditional filters.
cvRelativeDate :: Lens' ConditionValue (Maybe ConditionValueRelativeDate)
cvRelativeDate
  = lens _cvRelativeDate
      (\ s a -> s{_cvRelativeDate = a})

-- | A value the condition is based on. The value is parsed as if the user
-- typed into a cell. Formulas are supported (and must begin with an \`=\`
-- or a \'+\').
cvUserEnteredValue :: Lens' ConditionValue (Maybe Text)
cvUserEnteredValue
  = lens _cvUserEnteredValue
      (\ s a -> s{_cvUserEnteredValue = a})

instance FromJSON ConditionValue where
        parseJSON
          = withObject "ConditionValue"
              (\ o ->
                 ConditionValue' <$>
                   (o .:? "relativeDate") <*>
                     (o .:? "userEnteredValue"))

instance ToJSON ConditionValue where
        toJSON ConditionValue'{..}
          = object
              (catMaybes
                 [("relativeDate" .=) <$> _cvRelativeDate,
                  ("userEnteredValue" .=) <$> _cvUserEnteredValue])

-- | Deletes the dimensions from the sheet.
--
-- /See:/ 'deleteDimensionRequest' smart constructor.
newtype DeleteDimensionRequest =
  DeleteDimensionRequest'
    { _ddrRange :: Maybe DimensionRange
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'DeleteDimensionRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ddrRange'
deleteDimensionRequest
    :: DeleteDimensionRequest
deleteDimensionRequest = DeleteDimensionRequest' {_ddrRange = Nothing}


-- | The dimensions to delete from the sheet.
ddrRange :: Lens' DeleteDimensionRequest (Maybe DimensionRange)
ddrRange = lens _ddrRange (\ s a -> s{_ddrRange = a})

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

instance ToJSON DeleteDimensionRequest where
        toJSON DeleteDimensionRequest'{..}
          = object (catMaybes [("range" .=) <$> _ddrRange])

-- | The request for clearing a range of values in a spreadsheet.
--
-- /See:/ 'clearValuesRequest' smart constructor.
data ClearValuesRequest =
  ClearValuesRequest'
  deriving (Eq, Show, Data, Typeable, Generic)


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


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

instance ToJSON ClearValuesRequest where
        toJSON = const emptyObject

-- | Finds and replaces data in cells over a range, sheet, or all sheets.
--
-- /See:/ 'findReplaceRequest' smart constructor.
data FindReplaceRequest =
  FindReplaceRequest'
    { _frrMatchCase       :: !(Maybe Bool)
    , _frrAllSheets       :: !(Maybe Bool)
    , _frrIncludeFormulas :: !(Maybe Bool)
    , _frrMatchEntireCell :: !(Maybe Bool)
    , _frrRange           :: !(Maybe GridRange)
    , _frrSheetId         :: !(Maybe (Textual Int32))
    , _frrFind            :: !(Maybe Text)
    , _frrSearchByRegex   :: !(Maybe Bool)
    , _frrReplacement     :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'FindReplaceRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'frrMatchCase'
--
-- * 'frrAllSheets'
--
-- * 'frrIncludeFormulas'
--
-- * 'frrMatchEntireCell'
--
-- * 'frrRange'
--
-- * 'frrSheetId'
--
-- * 'frrFind'
--
-- * 'frrSearchByRegex'
--
-- * 'frrReplacement'
findReplaceRequest
    :: FindReplaceRequest
findReplaceRequest =
  FindReplaceRequest'
    { _frrMatchCase = Nothing
    , _frrAllSheets = Nothing
    , _frrIncludeFormulas = Nothing
    , _frrMatchEntireCell = Nothing
    , _frrRange = Nothing
    , _frrSheetId = Nothing
    , _frrFind = Nothing
    , _frrSearchByRegex = Nothing
    , _frrReplacement = Nothing
    }


-- | True if the search is case sensitive.
frrMatchCase :: Lens' FindReplaceRequest (Maybe Bool)
frrMatchCase
  = lens _frrMatchCase (\ s a -> s{_frrMatchCase = a})

-- | True to find\/replace over all sheets.
frrAllSheets :: Lens' FindReplaceRequest (Maybe Bool)
frrAllSheets
  = lens _frrAllSheets (\ s a -> s{_frrAllSheets = a})

-- | True if the search should include cells with formulas. False to skip
-- cells with formulas.
frrIncludeFormulas :: Lens' FindReplaceRequest (Maybe Bool)
frrIncludeFormulas
  = lens _frrIncludeFormulas
      (\ s a -> s{_frrIncludeFormulas = a})

-- | True if the find value should match the entire cell.
frrMatchEntireCell :: Lens' FindReplaceRequest (Maybe Bool)
frrMatchEntireCell
  = lens _frrMatchEntireCell
      (\ s a -> s{_frrMatchEntireCell = a})

-- | The range to find\/replace over.
frrRange :: Lens' FindReplaceRequest (Maybe GridRange)
frrRange = lens _frrRange (\ s a -> s{_frrRange = a})

-- | The sheet to find\/replace over.
frrSheetId :: Lens' FindReplaceRequest (Maybe Int32)
frrSheetId
  = lens _frrSheetId (\ s a -> s{_frrSheetId = a}) .
      mapping _Coerce

-- | The value to search.
frrFind :: Lens' FindReplaceRequest (Maybe Text)
frrFind = lens _frrFind (\ s a -> s{_frrFind = a})

-- | True if the find value is a regex. The regular expression and
-- replacement should follow Java regex rules at
-- https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/util\/regex\/Pattern.html.
-- The replacement string is allowed to refer to capturing groups. For
-- example, if one cell has the contents \`\"Google Sheets\"\` and another
-- has \`\"Google Docs\"\`, then searching for \`\"o.* (.*)\"\` with a
-- replacement of \`\"$1 Rocks\"\` would change the contents of the cells
-- to \`\"GSheets Rocks\"\` and \`\"GDocs Rocks\"\` respectively.
frrSearchByRegex :: Lens' FindReplaceRequest (Maybe Bool)
frrSearchByRegex
  = lens _frrSearchByRegex
      (\ s a -> s{_frrSearchByRegex = a})

-- | The value to use as the replacement.
frrReplacement :: Lens' FindReplaceRequest (Maybe Text)
frrReplacement
  = lens _frrReplacement
      (\ s a -> s{_frrReplacement = a})

instance FromJSON FindReplaceRequest where
        parseJSON
          = withObject "FindReplaceRequest"
              (\ o ->
                 FindReplaceRequest' <$>
                   (o .:? "matchCase") <*> (o .:? "allSheets") <*>
                     (o .:? "includeFormulas")
                     <*> (o .:? "matchEntireCell")
                     <*> (o .:? "range")
                     <*> (o .:? "sheetId")
                     <*> (o .:? "find")
                     <*> (o .:? "searchByRegex")
                     <*> (o .:? "replacement"))

instance ToJSON FindReplaceRequest where
        toJSON FindReplaceRequest'{..}
          = object
              (catMaybes
                 [("matchCase" .=) <$> _frrMatchCase,
                  ("allSheets" .=) <$> _frrAllSheets,
                  ("includeFormulas" .=) <$> _frrIncludeFormulas,
                  ("matchEntireCell" .=) <$> _frrMatchEntireCell,
                  ("range" .=) <$> _frrRange,
                  ("sheetId" .=) <$> _frrSheetId,
                  ("find" .=) <$> _frrFind,
                  ("searchByRegex" .=) <$> _frrSearchByRegex,
                  ("replacement" .=) <$> _frrReplacement])

-- | Moves one or more rows or columns.
--
-- /See:/ 'moveDimensionRequest' smart constructor.
data MoveDimensionRequest =
  MoveDimensionRequest'
    { _mdrDestinationIndex :: !(Maybe (Textual Int32))
    , _mdrSource           :: !(Maybe DimensionRange)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'MoveDimensionRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mdrDestinationIndex'
--
-- * 'mdrSource'
moveDimensionRequest
    :: MoveDimensionRequest
moveDimensionRequest =
  MoveDimensionRequest' {_mdrDestinationIndex = Nothing, _mdrSource = Nothing}


-- | The zero-based start index of where to move the source data to, based on
-- the coordinates *before* the source data is removed from the grid.
-- Existing data will be shifted down or right (depending on the dimension)
-- to make room for the moved dimensions. The source dimensions are removed
-- from the grid, so the the data may end up in a different index than
-- specified. For example, given \`A1..A5\` of \`0, 1, 2, 3, 4\` and
-- wanting to move \`\"1\"\` and \`\"2\"\` to between \`\"3\"\` and
-- \`\"4\"\`, the source would be \`ROWS [1..3)\`,and the destination index
-- would be \`\"4\"\` (the zero-based index of row 5). The end result would
-- be \`A1..A5\` of \`0, 3, 1, 2, 4\`.
mdrDestinationIndex :: Lens' MoveDimensionRequest (Maybe Int32)
mdrDestinationIndex
  = lens _mdrDestinationIndex
      (\ s a -> s{_mdrDestinationIndex = a})
      . mapping _Coerce

-- | The source dimensions to move.
mdrSource :: Lens' MoveDimensionRequest (Maybe DimensionRange)
mdrSource
  = lens _mdrSource (\ s a -> s{_mdrSource = a})

instance FromJSON MoveDimensionRequest where
        parseJSON
          = withObject "MoveDimensionRequest"
              (\ o ->
                 MoveDimensionRequest' <$>
                   (o .:? "destinationIndex") <*> (o .:? "source"))

instance ToJSON MoveDimensionRequest where
        toJSON MoveDimensionRequest'{..}
          = object
              (catMaybes
                 [("destinationIndex" .=) <$> _mdrDestinationIndex,
                  ("source" .=) <$> _mdrSource])

-- | The request for retrieving a range of values in a spreadsheet selected
-- by a set of DataFilters.
--
-- /See:/ 'batchGetValuesByDataFilterRequest' smart constructor.
data BatchGetValuesByDataFilterRequest =
  BatchGetValuesByDataFilterRequest'
    { _bgvbdfrValueRenderOption    :: !(Maybe BatchGetValuesByDataFilterRequestValueRenderOption)
    , _bgvbdfrDataFilters          :: !(Maybe [DataFilter])
    , _bgvbdfrDateTimeRenderOption :: !(Maybe BatchGetValuesByDataFilterRequestDateTimeRenderOption)
    , _bgvbdfrMajorDimension       :: !(Maybe BatchGetValuesByDataFilterRequestMajorDimension)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'BatchGetValuesByDataFilterRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bgvbdfrValueRenderOption'
--
-- * 'bgvbdfrDataFilters'
--
-- * 'bgvbdfrDateTimeRenderOption'
--
-- * 'bgvbdfrMajorDimension'
batchGetValuesByDataFilterRequest
    :: BatchGetValuesByDataFilterRequest
batchGetValuesByDataFilterRequest =
  BatchGetValuesByDataFilterRequest'
    { _bgvbdfrValueRenderOption = Nothing
    , _bgvbdfrDataFilters = Nothing
    , _bgvbdfrDateTimeRenderOption = Nothing
    , _bgvbdfrMajorDimension = Nothing
    }


-- | How values should be represented in the output. The default render
-- option is ValueRenderOption.FORMATTED_VALUE.
bgvbdfrValueRenderOption :: Lens' BatchGetValuesByDataFilterRequest (Maybe BatchGetValuesByDataFilterRequestValueRenderOption)
bgvbdfrValueRenderOption
  = lens _bgvbdfrValueRenderOption
      (\ s a -> s{_bgvbdfrValueRenderOption = a})

-- | The data filters used to match the ranges of values to retrieve. Ranges
-- that match any of the specified data filters will be included in the
-- response.
bgvbdfrDataFilters :: Lens' BatchGetValuesByDataFilterRequest [DataFilter]
bgvbdfrDataFilters
  = lens _bgvbdfrDataFilters
      (\ s a -> s{_bgvbdfrDataFilters = a})
      . _Default
      . _Coerce

-- | How dates, times, and durations should be represented in the output.
-- This is ignored if value_render_option is FORMATTED_VALUE. The default
-- dateTime render option is [DateTimeRenderOption.SERIAL_NUMBER].
bgvbdfrDateTimeRenderOption :: Lens' BatchGetValuesByDataFilterRequest (Maybe BatchGetValuesByDataFilterRequestDateTimeRenderOption)
bgvbdfrDateTimeRenderOption
  = lens _bgvbdfrDateTimeRenderOption
      (\ s a -> s{_bgvbdfrDateTimeRenderOption = a})

-- | The major dimension that results should use. For example, if the
-- spreadsheet data is: \`A1=1,B1=2,A2=3,B2=4\`, then a request that
-- selects that range and sets \`majorDimension=ROWS\` will return
-- \`[[1,2],[3,4]]\`, whereas a request that sets
-- \`majorDimension=COLUMNS\` will return \`[[1,3],[2,4]]\`.
bgvbdfrMajorDimension :: Lens' BatchGetValuesByDataFilterRequest (Maybe BatchGetValuesByDataFilterRequestMajorDimension)
bgvbdfrMajorDimension
  = lens _bgvbdfrMajorDimension
      (\ s a -> s{_bgvbdfrMajorDimension = a})

instance FromJSON BatchGetValuesByDataFilterRequest
         where
        parseJSON
          = withObject "BatchGetValuesByDataFilterRequest"
              (\ o ->
                 BatchGetValuesByDataFilterRequest' <$>
                   (o .:? "valueRenderOption") <*>
                     (o .:? "dataFilters" .!= mempty)
                     <*> (o .:? "dateTimeRenderOption")
                     <*> (o .:? "majorDimension"))

instance ToJSON BatchGetValuesByDataFilterRequest
         where
        toJSON BatchGetValuesByDataFilterRequest'{..}
          = object
              (catMaybes
                 [("valueRenderOption" .=) <$>
                    _bgvbdfrValueRenderOption,
                  ("dataFilters" .=) <$> _bgvbdfrDataFilters,
                  ("dateTimeRenderOption" .=) <$>
                    _bgvbdfrDateTimeRenderOption,
                  ("majorDimension" .=) <$> _bgvbdfrMajorDimension])

-- | A rule that applies a gradient color scale format, based on the
-- interpolation points listed. The format of a cell will vary based on its
-- contents as compared to the values of the interpolation points.
--
-- /See:/ 'gradientRule' smart constructor.
data GradientRule =
  GradientRule'
    { _grMidpoint :: !(Maybe InterpolationPoint)
    , _grMaxpoint :: !(Maybe InterpolationPoint)
    , _grMinpoint :: !(Maybe InterpolationPoint)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'GradientRule' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'grMidpoint'
--
-- * 'grMaxpoint'
--
-- * 'grMinpoint'
gradientRule
    :: GradientRule
gradientRule =
  GradientRule'
    {_grMidpoint = Nothing, _grMaxpoint = Nothing, _grMinpoint = Nothing}


-- | An optional midway interpolation point.
grMidpoint :: Lens' GradientRule (Maybe InterpolationPoint)
grMidpoint
  = lens _grMidpoint (\ s a -> s{_grMidpoint = a})

-- | The final interpolation point.
grMaxpoint :: Lens' GradientRule (Maybe InterpolationPoint)
grMaxpoint
  = lens _grMaxpoint (\ s a -> s{_grMaxpoint = a})

-- | The starting interpolation point.
grMinpoint :: Lens' GradientRule (Maybe InterpolationPoint)
grMinpoint
  = lens _grMinpoint (\ s a -> s{_grMinpoint = a})

instance FromJSON GradientRule where
        parseJSON
          = withObject "GradientRule"
              (\ o ->
                 GradientRule' <$>
                   (o .:? "midpoint") <*> (o .:? "maxpoint") <*>
                     (o .:? "minpoint"))

instance ToJSON GradientRule where
        toJSON GradientRule'{..}
          = object
              (catMaybes
                 [("midpoint" .=) <$> _grMidpoint,
                  ("maxpoint" .=) <$> _grMaxpoint,
                  ("minpoint" .=) <$> _grMinpoint])

-- | Moves data from the source to the destination.
--
-- /See:/ 'cutPasteRequest' smart constructor.
data CutPasteRequest =
  CutPasteRequest'
    { _cDestination :: !(Maybe GridCoordinate)
    , _cSource      :: !(Maybe GridRange)
    , _cPasteType   :: !(Maybe CutPasteRequestPasteType)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'CutPasteRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'cDestination'
--
-- * 'cSource'
--
-- * 'cPasteType'
cutPasteRequest
    :: CutPasteRequest
cutPasteRequest =
  CutPasteRequest'
    {_cDestination = Nothing, _cSource = Nothing, _cPasteType = Nothing}


-- | The top-left coordinate where the data should be pasted.
cDestination :: Lens' CutPasteRequest (Maybe GridCoordinate)
cDestination
  = lens _cDestination (\ s a -> s{_cDestination = a})

-- | The source data to cut.
cSource :: Lens' CutPasteRequest (Maybe GridRange)
cSource = lens _cSource (\ s a -> s{_cSource = a})

-- | What kind of data to paste. All the source data will be cut, regardless
-- of what is pasted.
cPasteType :: Lens' CutPasteRequest (Maybe CutPasteRequestPasteType)
cPasteType
  = lens _cPasteType (\ s a -> s{_cPasteType = a})

instance FromJSON CutPasteRequest where
        parseJSON
          = withObject "CutPasteRequest"
              (\ o ->
                 CutPasteRequest' <$>
                   (o .:? "destination") <*> (o .:? "source") <*>
                     (o .:? "pasteType"))

instance ToJSON CutPasteRequest where
        toJSON CutPasteRequest'{..}
          = object
              (catMaybes
                 [("destination" .=) <$> _cDestination,
                  ("source" .=) <$> _cSource,
                  ("pasteType" .=) <$> _cPasteType])

-- | The result of updating an embedded object\'s position.
--
-- /See:/ 'updateEmbeddedObjectPositionResponse' smart constructor.
newtype UpdateEmbeddedObjectPositionResponse =
  UpdateEmbeddedObjectPositionResponse'
    { _ueoprPosition :: Maybe EmbeddedObjectPosition
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'UpdateEmbeddedObjectPositionResponse' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'ueoprPosition'
updateEmbeddedObjectPositionResponse
    :: UpdateEmbeddedObjectPositionResponse
updateEmbeddedObjectPositionResponse =
  UpdateEmbeddedObjectPositionResponse' {_ueoprPosition = Nothing}


-- | The new position of the embedded object.
ueoprPosition :: Lens' UpdateEmbeddedObjectPositionResponse (Maybe EmbeddedObjectPosition)
ueoprPosition
  = lens _ueoprPosition
      (\ s a -> s{_ueoprPosition = a})

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

instance ToJSON UpdateEmbeddedObjectPositionResponse
         where
        toJSON UpdateEmbeddedObjectPositionResponse'{..}
          = object
              (catMaybes [("position" .=) <$> _ueoprPosition])

-- | A custom subtotal column for a waterfall chart series.
--
-- /See:/ 'waterfallChartCustomSubtotal' smart constructor.
data WaterfallChartCustomSubtotal =
  WaterfallChartCustomSubtotal'
    { _wccsDataIsSubtotal :: !(Maybe Bool)
    , _wccsSubtotalIndex  :: !(Maybe (Textual Int32))
    , _wccsLabel          :: !(Maybe Text)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'WaterfallChartCustomSubtotal' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'wccsDataIsSubtotal'
--
-- * 'wccsSubtotalIndex'
--
-- * 'wccsLabel'
waterfallChartCustomSubtotal
    :: WaterfallChartCustomSubtotal
waterfallChartCustomSubtotal =
  WaterfallChartCustomSubtotal'
    { _wccsDataIsSubtotal = Nothing
    , _wccsSubtotalIndex = Nothing
    , _wccsLabel = Nothing
    }


-- | True if the data point at subtotal_index is the subtotal. If false, the
-- subtotal will be computed and appear after the data point.
wccsDataIsSubtotal :: Lens' WaterfallChartCustomSubtotal (Maybe Bool)
wccsDataIsSubtotal
  = lens _wccsDataIsSubtotal
      (\ s a -> s{_wccsDataIsSubtotal = a})

-- | The 0-based index of a data point within the series. If data_is_subtotal
-- is true, the data point at this index is the subtotal. Otherwise, the
-- subtotal appears after the data point with this index. A series can have
-- multiple subtotals at arbitrary indices, but subtotals do not affect the
-- indices of the data points. For example, if a series has three data
-- points, their indices will always be 0, 1, and 2, regardless of how many
-- subtotals exist on the series or what data points they are associated
-- with.
wccsSubtotalIndex :: Lens' WaterfallChartCustomSubtotal (Maybe Int32)
wccsSubtotalIndex
  = lens _wccsSubtotalIndex
      (\ s a -> s{_wccsSubtotalIndex = a})
      . mapping _Coerce

-- | A label for the subtotal column.
wccsLabel :: Lens' WaterfallChartCustomSubtotal (Maybe Text)
wccsLabel
  = lens _wccsLabel (\ s a -> s{_wccsLabel = a})

instance FromJSON WaterfallChartCustomSubtotal where
        parseJSON
          = withObject "WaterfallChartCustomSubtotal"
              (\ o ->
                 WaterfallChartCustomSubtotal' <$>
                   (o .:? "dataIsSubtotal") <*> (o .:? "subtotalIndex")
                     <*> (o .:? "label"))

instance ToJSON WaterfallChartCustomSubtotal where
        toJSON WaterfallChartCustomSubtotal'{..}
          = object
              (catMaybes
                 [("dataIsSubtotal" .=) <$> _wccsDataIsSubtotal,
                  ("subtotalIndex" .=) <$> _wccsSubtotalIndex,
                  ("label" .=) <$> _wccsLabel])

-- | A single response from an update.
--
-- /See:/ 'response' smart constructor.
data Response =
  Response'
    { _rAddFilterView                :: !(Maybe AddFilterViewResponse)
    , _rCreateDeveloperMetadata      :: !(Maybe CreateDeveloperMetadataResponse)
    , _rDuplicateFilterView          :: !(Maybe DuplicateFilterViewResponse)
    , _rUpdateEmbeddedObjectPosition :: !(Maybe UpdateEmbeddedObjectPositionResponse)
    , _rDeleteDimensionGroup         :: !(Maybe DeleteDimensionGroupResponse)
    , _rAddSheet                     :: !(Maybe AddSheetResponse)
    , _rFindReplace                  :: !(Maybe FindReplaceResponse)
    , _rAddProtectedRange            :: !(Maybe AddProtectedRangeResponse)
    , _rDeleteConditionalFormatRule  :: !(Maybe DeleteConditionalFormatRuleResponse)
    , _rUpdateConditionalFormatRule  :: !(Maybe UpdateConditionalFormatRuleResponse)
    , _rDeleteDeveloperMetadata      :: !(Maybe DeleteDeveloperMetadataResponse)
    , _rUpdateDeveloperMetadata      :: !(Maybe UpdateDeveloperMetadataResponse)
    , _rAddNamedRange                :: !(Maybe AddNamedRangeResponse)
    , _rAddChart                     :: !(Maybe AddChartResponse)
    , _rAddBanding                   :: !(Maybe AddBandingResponse)
    , _rDuplicateSheet               :: !(Maybe DuplicateSheetResponse)
    , _rAddDimensionGroup            :: !(Maybe AddDimensionGroupResponse)
    }
  deriving (Eq, Show, Data, Typeable, Generic)


-- | Creates a value of 'Response' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rAddFilterView'
--
-- * 'rCreateDeveloperMetadata'
--
-- * 'rDuplicateFilterView'
--
-- * 'rUpdateEmbeddedObjectPosition'
--
-- * 'rDeleteDimensionGroup'
--
-- * 'rAddSheet'
--
-- * 'rFindReplace'
--
-- * 'rAddProtectedRange'
--
-- * 'rDeleteConditionalFormatRule'
--
-- * 'rUpdateConditionalFormatRule'
--
-- * 'rDeleteDeveloperMetadata'
--
-- * 'rUpdateDeveloperMetadata'
--
-- * 'rAddNamedRange'
--
-- * 'rAddChart'
--
-- * 'rAddBanding'
--
-- * 'rDuplicateSheet'
--
-- * 'rAddDimensionGroup'
response
    :: Response
response =
  Response'
    { _rAddFilterView = Nothing
    , _rCreateDeveloperMetadata = Nothing
    , _rDuplicateFilterView = Nothing
    , _rUpdateEmbeddedObjectPosition = Nothing
    , _rDeleteDimensionGroup = Nothing
    , _rAddSheet = Nothing
    , _rFindReplace = Nothing
    , _rAddProtectedRange = Nothing
    , _rDeleteConditionalFormatRule = Nothing
    , _rUpdateConditionalFormatRule = Nothing
    , _rDeleteDeveloperMetadata = Nothing
    , _rUpdateDeveloperMetadata = Nothing
    , _rAddNamedRange = Nothing
    , _rAddChart = Nothing
    , _rAddBanding = Nothing
    , _rDuplicateSheet = Nothing
    , _rAddDimensionGroup = Nothing
    }


-- | A reply from adding a filter view.
rAddFilterView :: Lens' Response (Maybe AddFilterViewResponse)
rAddFilterView