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

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

-- |
-- Module      : Network.Google.Translate.Types.Sum
-- 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.Translate.Types.Sum where

import           Network.Google.Prelude hiding (Bytes)

-- | V1 error format.
data Xgafv
    = X1
      -- ^ @1@
      -- v1 error format
    | X2
      -- ^ @2@
      -- v2 error format
      deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)

instance Hashable Xgafv

instance FromHttpApiData Xgafv where
    parseQueryParam = \case
        "1" -> Right X1
        "2" -> Right X2
        x -> Left ("Unable to parse Xgafv from: " <> x)

instance ToHttpApiData Xgafv where
    toQueryParam = \case
        X1 -> "1"
        X2 -> "2"

instance FromJSON Xgafv where
    parseJSON = parseJSONText "Xgafv"

instance ToJSON Xgafv where
    toJSON = toJSONText

-- | The format of the source text, in either HTML (default) or plain-text. A
-- value of \"html\" indicates HTML and a value of \"text\" indicates
-- plain-text.
data TranslationsListFormat
    = HTML
      -- ^ @html@
      -- Specifies the input is in HTML
    | Text
      -- ^ @text@
      -- Specifies the input is in plain textual format
      deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)

instance Hashable TranslationsListFormat

instance FromHttpApiData TranslationsListFormat where
    parseQueryParam = \case
        "html" -> Right HTML
        "text" -> Right Text
        x -> Left ("Unable to parse TranslationsListFormat from: " <> x)

instance ToHttpApiData TranslationsListFormat where
    toQueryParam = \case
        HTML -> "html"
        Text -> "text"

instance FromJSON TranslationsListFormat where
    parseJSON = parseJSONText "TranslationsListFormat"

instance ToJSON TranslationsListFormat where
    toJSON = toJSONText